зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 7d0893f1b6ce (bug 1389021) for leaking in mda2 on Linux x64 asan (bug 1374856). r=backout a=backout
MozReview-Commit-ID: AeaKVgSJTmt
This commit is contained in:
Родитель
996cae01db
Коммит
fe767114c9
|
@ -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> CompositorManagerParent::sInstance;
|
||||
StaticAutoPtr<nsTArray<CompositorManagerParent*>> CompositorManagerParent::sActiveActors;
|
||||
StaticMutex CompositorManagerParent::sMutex;
|
||||
|
||||
/* static */ already_AddRefed<CompositorManagerParent>
|
||||
|
@ -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<CompositorManagerParent*>();
|
||||
}
|
||||
sActiveActors->AppendElement(parent);
|
||||
return parent.forget();
|
||||
}
|
||||
|
||||
|
@ -131,12 +124,6 @@ CompositorManagerParent::Bind(Endpoint<PCompositorManagerParent>&& 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<CompositorManagerParent*>();
|
||||
}
|
||||
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<nsTArray<CompositorManagerParent*>> 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)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,6 @@ class CompositorManagerParent final : public PCompositorManagerParent
|
|||
public:
|
||||
static already_AddRefed<CompositorManagerParent> CreateSameProcess();
|
||||
static void Create(Endpoint<PCompositorManagerParent>&& aEndpoint);
|
||||
static void Shutdown();
|
||||
|
||||
static already_AddRefed<CompositorBridgeParent>
|
||||
CreateSameProcessWidgetCompositorBridge(CSSToLayoutDeviceScale aScale,
|
||||
|
@ -42,11 +41,8 @@ public:
|
|||
|
||||
private:
|
||||
static StaticRefPtr<CompositorManagerParent> sInstance;
|
||||
static StaticAutoPtr<nsTArray<CompositorManagerParent*>> sActiveActors;
|
||||
static StaticMutex sMutex;
|
||||
|
||||
static void ShutdownInternal();
|
||||
|
||||
CompositorManagerParent();
|
||||
~CompositorManagerParent() override;
|
||||
|
||||
|
|
|
@ -129,7 +129,6 @@ CompositorThreadHolder::Shutdown()
|
|||
ReleaseImageBridgeParentSingleton();
|
||||
gfx::ReleaseVRManagerParentSingleton();
|
||||
MediaSystemResourceService::Shutdown();
|
||||
CompositorManagerParent::Shutdown();
|
||||
|
||||
sCompositorThreadHolder = nullptr;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче