From fe767114c9a9b11134deaaa2864636819cc4c83b Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Sun, 17 Sep 2017 14:26:25 +0200 Subject: [PATCH] Backed out changeset 7d0893f1b6ce (bug 1389021) for leaking in mda2 on Linux x64 asan (bug 1374856). r=backout a=backout MozReview-Commit-ID: AeaKVgSJTmt --- gfx/layers/ipc/CompositorManagerParent.cpp | 47 ---------------------- gfx/layers/ipc/CompositorManagerParent.h | 4 -- gfx/layers/ipc/CompositorThread.cpp | 1 - 3 files changed, 52 deletions(-) diff --git a/gfx/layers/ipc/CompositorManagerParent.cpp b/gfx/layers/ipc/CompositorManagerParent.cpp index 649896bf86a9..38b0c6794153 100644 --- a/gfx/layers/ipc/CompositorManagerParent.cpp +++ b/gfx/layers/ipc/CompositorManagerParent.cpp @@ -9,14 +9,12 @@ #include "mozilla/layers/CompositorBridgeParent.h" #include "mozilla/layers/CrossProcessCompositorBridgeParent.h" #include "mozilla/layers/CompositorThread.h" -#include "nsAutoPtr.h" #include "VsyncSource.h" namespace mozilla { namespace layers { StaticRefPtr CompositorManagerParent::sInstance; -StaticAutoPtr> CompositorManagerParent::sActiveActors; StaticMutex CompositorManagerParent::sMutex; /* static */ already_AddRefed @@ -44,11 +42,6 @@ CompositorManagerParent::CreateSameProcess() // we don't use that in the same process case. parent.get()->AddRef(); sInstance = parent; - - if (!sActiveActors) { - sActiveActors = new nsTArray(); - } - sActiveActors->AppendElement(parent); return parent.forget(); } @@ -131,12 +124,6 @@ CompositorManagerParent::Bind(Endpoint&& aEndpoint) // Add the IPDL reference to ourself, so we can't get freed until IPDL is // done with us. AddRef(); - - StaticMutexAutoLock lock(sMutex); - if (!sActiveActors) { - sActiveActors = new nsTArray(); - } - sActiveActors->AppendElement(this); } void @@ -156,10 +143,6 @@ CompositorManagerParent::DeallocPCompositorManagerParent() this, &CompositorManagerParent::DeferredDestroy)); - StaticMutexAutoLock lock(sMutex); - if (sActiveActors) { - sActiveActors->RemoveElement(this); - } Release(); } @@ -169,36 +152,6 @@ CompositorManagerParent::DeferredDestroy() mCompositorThreadHolder = nullptr; } -/* static */ void -CompositorManagerParent::ShutdownInternal() -{ - nsAutoPtr> actors; - - // We move here because we may attempt to acquire the same lock during the - // destroy to remove the reference in sActiveActors. - { - StaticMutexAutoLock lock(sMutex); - actors = sActiveActors.forget(); - } - - if (actors) { - for (auto& actor : *actors) { - actor->Close(); - } - } -} - -/* static */ void -CompositorManagerParent::Shutdown() -{ - MOZ_ASSERT(NS_IsMainThread()); - - CompositorThreadHolder::Loop()->PostTask( - NS_NewRunnableFunction("layers::CompositorManagerParent::Shutdown", []() -> void { - CompositorManagerParent::ShutdownInternal(); - })); -} - PCompositorBridgeParent* CompositorManagerParent::AllocPCompositorBridgeParent(const CompositorBridgeOptions& aOpt) { diff --git a/gfx/layers/ipc/CompositorManagerParent.h b/gfx/layers/ipc/CompositorManagerParent.h index 34a3ef28f143..0458188bd0ef 100644 --- a/gfx/layers/ipc/CompositorManagerParent.h +++ b/gfx/layers/ipc/CompositorManagerParent.h @@ -27,7 +27,6 @@ class CompositorManagerParent final : public PCompositorManagerParent public: static already_AddRefed CreateSameProcess(); static void Create(Endpoint&& aEndpoint); - static void Shutdown(); static already_AddRefed CreateSameProcessWidgetCompositorBridge(CSSToLayoutDeviceScale aScale, @@ -42,11 +41,8 @@ public: private: static StaticRefPtr sInstance; - static StaticAutoPtr> sActiveActors; static StaticMutex sMutex; - static void ShutdownInternal(); - CompositorManagerParent(); ~CompositorManagerParent() override; diff --git a/gfx/layers/ipc/CompositorThread.cpp b/gfx/layers/ipc/CompositorThread.cpp index de0c0272cb5f..d813465ced36 100644 --- a/gfx/layers/ipc/CompositorThread.cpp +++ b/gfx/layers/ipc/CompositorThread.cpp @@ -129,7 +129,6 @@ CompositorThreadHolder::Shutdown() ReleaseImageBridgeParentSingleton(); gfx::ReleaseVRManagerParentSingleton(); MediaSystemResourceService::Shutdown(); - CompositorManagerParent::Shutdown(); sCompositorThreadHolder = nullptr;