From 9699c6d4db8344f3469941f3780655bc9fe3040f Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 11 Sep 2018 16:50:48 +0200 Subject: [PATCH] Bug 1352877 - Clear the compositor map later during shutdown. r=mattwoodrow --- gfx/layers/ipc/CompositorBridgeParent.cpp | 15 +++++++-------- gfx/layers/ipc/CompositorBridgeParent.h | 7 +------ gfx/layers/ipc/CompositorThread.cpp | 1 - 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 816564fc33c4..be4b51cc3e33 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -313,17 +313,16 @@ CompositorBridgeParent::Setup() sCompositorMap = new CompositorMap; } -void -CompositorBridgeParent::Shutdown() -{ - MOZ_ASSERT(sCompositorMap); - MOZ_ASSERT(sCompositorMap->empty()); - sCompositorMap = nullptr; -} - void CompositorBridgeParent::FinishShutdown() { + MOZ_ASSERT(NS_IsMainThread()); + + if (sCompositorMap) { + MOZ_ASSERT(sCompositorMap->empty()); + sCompositorMap = nullptr; + } + // TODO: this should be empty by now... sIndirectLayerTrees.clear(); } diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h index 6e127542d62f..e0fa44d746b0 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -576,12 +576,7 @@ protected: static void Setup(); /** - * Destroys the compositor thread and global compositor map. - */ - static void Shutdown(); - - /** - * Finish the shutdown operation on the compositor thread. + * Remaning cleanups after the compositore thread is gone. */ static void FinishShutdown(); diff --git a/gfx/layers/ipc/CompositorThread.cpp b/gfx/layers/ipc/CompositorThread.cpp index 326988fc525d..c42e8b848dbe 100644 --- a/gfx/layers/ipc/CompositorThread.cpp +++ b/gfx/layers/ipc/CompositorThread.cpp @@ -69,7 +69,6 @@ CompositorThreadHolder::DestroyCompositorThread(base::Thread* aCompositorThread) MOZ_ASSERT(!sCompositorThreadHolder, "We shouldn't be destroying the compositor thread yet."); - CompositorBridgeParent::Shutdown(); delete aCompositorThread; sFinishedCompositorShutDown = true; }