mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1133426 - Care about new CompositorChild and CompositorParent re-creation.
This commit is contained in:
parent
781672fbb6
commit
124a6df323
@ -181,21 +181,24 @@ nsBaseWidget::Shutdown()
|
||||
mShutdownObserver = nullptr;
|
||||
}
|
||||
|
||||
static void DeferredDestroyCompositor(CompositorParent* aCompositorParent,
|
||||
CompositorChild* aCompositorChild)
|
||||
static void DeferredDestroyCompositor(nsRefPtr<CompositorParent> aCompositorParent,
|
||||
nsRefPtr<CompositorChild> aCompositorChild)
|
||||
{
|
||||
// Bug 848949 needs to be fixed before
|
||||
// we can close the channel properly
|
||||
//aCompositorChild->Close();
|
||||
aCompositorParent->Release();
|
||||
aCompositorChild->Release();
|
||||
}
|
||||
|
||||
void nsBaseWidget::DestroyCompositor()
|
||||
{
|
||||
if (mCompositorChild) {
|
||||
mCompositorChild->SendWillStop();
|
||||
mCompositorChild->Destroy();
|
||||
nsRefPtr<CompositorChild> compositorChild = mCompositorChild.forget();
|
||||
nsRefPtr<CompositorParent> compositorParent = mCompositorParent.forget();
|
||||
|
||||
compositorChild->SendWillStop();
|
||||
// New LayerManager, CompositorParent and CompositorChild might be created
|
||||
// as a result of internal GetLayerManager() call.
|
||||
compositorChild->Destroy();
|
||||
|
||||
// The call just made to SendWillStop can result in IPC from the
|
||||
// CompositorParent to the CompositorChild (e.g. caused by the destruction
|
||||
@ -204,13 +207,12 @@ void nsBaseWidget::DestroyCompositor()
|
||||
// events already in the MessageLoop get processed before the
|
||||
// CompositorChild is destroyed, so we add a task to the MessageLoop to
|
||||
// handle compositor desctruction.
|
||||
|
||||
// The DefferedDestroyCompositor task takes ownership of compositorParent and
|
||||
// will release them when it runs.
|
||||
MessageLoop::current()->PostTask(FROM_HERE,
|
||||
NewRunnableFunction(DeferredDestroyCompositor, mCompositorParent,
|
||||
mCompositorChild));
|
||||
// The DestroyCompositor task we just added to the MessageLoop will handle
|
||||
// releasing mCompositorParent and mCompositorChild.
|
||||
unused << mCompositorParent.forget();
|
||||
unused << mCompositorChild.forget();
|
||||
NewRunnableFunction(DeferredDestroyCompositor, compositorParent,
|
||||
compositorChild));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user