Bug 1389021 - Release the compositor thread after CompositorManagerParent IPDL reference is released. r=nical

We need to ensure the compositor thread is released but we cannot upon
freeing CompositorManagerParent to do that. This is because it needs to
live longer than the thread so that shared memory allocated with this
top level protocol can be freed after the fact. As such, just release
the thread reference after IPDL has released CompositorManagerParent.
This commit is contained in:
Andrew Osmond 2017-08-17 09:24:07 -04:00
parent b3bc155fb6
commit ec1a805248
2 changed files with 13 additions and 0 deletions

View File

@ -138,9 +138,20 @@ CompositorManagerParent::ActorDestroy(ActorDestroyReason aReason)
void
CompositorManagerParent::DeallocPCompositorManagerParent()
{
MessageLoop::current()->PostTask(
NewRunnableMethod("layers::CompositorManagerParent::DeferredDestroy",
this,
&CompositorManagerParent::DeferredDestroy));
Release();
}
void
CompositorManagerParent::DeferredDestroy()
{
mCompositorThreadHolder = nullptr;
}
PCompositorBridgeParent*
CompositorManagerParent::AllocPCompositorBridgeParent(const CompositorBridgeOptions& aOpt)
{

View File

@ -50,6 +50,8 @@ private:
void DeallocPCompositorManagerParent() override;
void DeferredDestroy();
RefPtr<CompositorThreadHolder> mCompositorThreadHolder;
AutoTArray<RefPtr<CompositorBridgeParent>, 1> mPendingCompositorBridges;