コード例 #1
0
void
CompositorChild::Destroy()
{
  mLayerManager->Destroy();
  mLayerManager = nullptr;
  while (size_t len = ManagedPLayerTransactionChild().Length()) {
    LayerTransactionChild* layers =
      static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[len - 1]);
    layers->Destroy();
  }
  SendStop();
}
コード例 #2
0
void
CompositorChild::Destroy()
{
  mLayerManager->Destroy();
  mLayerManager = nullptr;
  // start from the end of the array because Destroy() can cause the
  // LayerTransactionChild to be removed from the array.
  for (int i = ManagedPLayerTransactionChild().Length() - 1; i >= 0; --i) {
    RefPtr<LayerTransactionChild> layers =
      static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[i]);
    layers->Destroy();
  }
  MOZ_ASSERT(!mCanSend);
  SendStop();
}
コード例 #3
0
void
CompositorChild::Destroy()
{
  // This must not be called from the destructor!
  MOZ_ASSERT(mRefCnt != 0);

  if (!mCanSend) {
    return;
  }

  mCanSend = false;

  // Destroying the layer manager may cause all sorts of things to happen, so
  // let's make sure there is still a reference to keep this alive whatever
  // happens.
  nsRefPtr<CompositorChild> selfRef = this;

  SendWillStop();
  // The call just made to SendWillStop can result in IPC from the
  // CompositorParent to the CompositorChild (e.g. caused by the destruction
  // of shared memory). We need to ensure this gets processed by the
  // CompositorChild before it gets destroyed. It suffices to ensure that
  // events already in the MessageLoop get processed before the
  // CompositorChild is destroyed, so we add a task to the MessageLoop to
  // handle compositor desctruction.

  // From now on the only message we can send is Stop.

  if (mLayerManager) {
    mLayerManager->Destroy();
    mLayerManager = nullptr;
  }

  // start from the end of the array because Destroy() can cause the
  // LayerTransactionChild to be removed from the array.
  for (int i = ManagedPLayerTransactionChild().Length() - 1; i >= 0; --i) {
    RefPtr<LayerTransactionChild> layers =
      static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[i]);
    layers->Destroy();
  }

  SendStop();

  // The DeferredDestroyCompositor task takes ownership of compositorParent and
  // will release them when it runs.
  MessageLoop::current()->PostTask(FROM_HERE,
             NewRunnableFunction(DeferredDestroyCompositor, mCompositorParent, selfRef));
}
コード例 #4
0
void
RenderFrameChild::Destroy()
{
    size_t numChildren = ManagedPLayerTransactionChild().Length();
    NS_ABORT_IF_FALSE(0 == numChildren || 1 == numChildren,
                      "render frame must only have 0 or 1 layer forwarder");

    if (numChildren) {
        LayerTransactionChild* layers =
            static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[0]);
        layers->Destroy();
        // |layers| was just deleted, take care
    }

    Send__delete__(this);
    // WARNING: |this| is dead, hands off
}