mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset fbb86a21aba0 (bug 924622) for leaks on OS X 10.6; CLOSED TREE
This commit is contained in:
parent
654e84274f
commit
6a82d86fc3
@ -173,33 +173,13 @@ static void StopImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone)
|
||||
NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
|
||||
"Should be in ImageBridgeChild thread.");
|
||||
if (sImageBridgeChildSingleton) {
|
||||
// Force all managed protocols to shut themselves down cleanly
|
||||
InfallibleTArray<PCompositableChild*> compositables;
|
||||
sImageBridgeChildSingleton->ManagedPCompositableChild(compositables);
|
||||
for (int i = compositables.Length() - 1; i >= 0; --i) {
|
||||
CompositableClient::FromIPDLActor(compositables[i])->Destroy();
|
||||
}
|
||||
InfallibleTArray<PTextureChild*> textures;
|
||||
sImageBridgeChildSingleton->ManagedPTextureChild(textures);
|
||||
for (int i = textures.Length() - 1; i >= 0; --i) {
|
||||
TextureClient::AsTextureClient(textures[i])->ForceRemove();
|
||||
}
|
||||
|
||||
sImageBridgeChildSingleton->SendStop();
|
||||
sImageBridgeChildSingleton->MarkShutDown();
|
||||
// From now on, no message can be sent through the image bridge from the
|
||||
// client side.
|
||||
}
|
||||
*aDone = true;
|
||||
aBarrier->NotifyAll();
|
||||
}
|
||||
|
||||
void
|
||||
ImageBridgeChild::MarkShutDown()
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
mShuttingDown = true;
|
||||
}
|
||||
|
||||
// dispatched function
|
||||
static void DeleteImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone)
|
||||
{
|
||||
@ -271,7 +251,6 @@ static void ConnectImageBridge(ImageBridgeChild * child, ImageBridgeParent * par
|
||||
}
|
||||
|
||||
ImageBridgeChild::ImageBridgeChild()
|
||||
: mShuttingDown(false)
|
||||
{
|
||||
mTxn = new CompositableTransaction();
|
||||
}
|
||||
@ -284,7 +263,6 @@ void
|
||||
ImageBridgeChild::Connect(CompositableClient* aCompositable)
|
||||
{
|
||||
MOZ_ASSERT(aCompositable);
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
uint64_t id = 0;
|
||||
PCompositableChild* child =
|
||||
SendPCompositableConstructor(aCompositable->GetTextureInfo(), &id);
|
||||
@ -295,7 +273,6 @@ ImageBridgeChild::Connect(CompositableClient* aCompositable)
|
||||
PCompositableChild*
|
||||
ImageBridgeChild::AllocPCompositableChild(const TextureInfo& aInfo, uint64_t* aID)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
return CompositableClient::CreateIPDLActor();
|
||||
}
|
||||
|
||||
@ -359,10 +336,6 @@ static void ReleaseImageClientNow(ImageClient* aClient)
|
||||
// static
|
||||
void ImageBridgeChild::DispatchReleaseImageClient(ImageClient* aClient)
|
||||
{
|
||||
if (!IsCreated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(&ReleaseImageClientNow, aClient));
|
||||
@ -377,10 +350,6 @@ static void ReleaseTextureClientNow(TextureClient* aClient)
|
||||
// static
|
||||
void ImageBridgeChild::DispatchReleaseTextureClient(TextureClient* aClient)
|
||||
{
|
||||
if (!IsCreated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(&ReleaseTextureClientNow, aClient));
|
||||
@ -400,10 +369,6 @@ static void UpdateImageClientNow(ImageClient* aClient, ImageContainer* aContaine
|
||||
void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient,
|
||||
ImageContainer* aContainer)
|
||||
{
|
||||
if (!IsCreated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (InImageBridgeChildThread()) {
|
||||
UpdateImageClientNow(aClient, aContainer);
|
||||
return;
|
||||
@ -428,10 +393,6 @@ static void FlushAllImagesSync(ImageClient* aClient, ImageContainer* aContainer,
|
||||
//static
|
||||
void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront)
|
||||
{
|
||||
if (!IsCreated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (InImageBridgeChildThread()) {
|
||||
FlushAllImagesNow(aClient, aContainer, aExceptFront);
|
||||
return;
|
||||
@ -456,7 +417,6 @@ void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aCon
|
||||
void ImageBridgeChild::FlushAllImagesNow(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront)
|
||||
{
|
||||
MOZ_ASSERT(aClient);
|
||||
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
|
||||
sImageBridgeChildSingleton->BeginTransaction();
|
||||
if (aContainer && !aExceptFront) {
|
||||
aContainer->ClearCurrentImage();
|
||||
@ -469,7 +429,6 @@ void ImageBridgeChild::FlushAllImagesNow(ImageClient* aClient, ImageContainer* a
|
||||
void
|
||||
ImageBridgeChild::BeginTransaction()
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?");
|
||||
mTxn->Begin();
|
||||
}
|
||||
@ -491,7 +450,6 @@ private:
|
||||
void
|
||||
ImageBridgeChild::EndTransaction()
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?");
|
||||
|
||||
AutoEndTransaction _(mTxn);
|
||||
@ -587,7 +545,6 @@ void ImageBridgeChild::ShutDown()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on the main Thread!");
|
||||
if (ImageBridgeChild::IsCreated()) {
|
||||
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
|
||||
ImageBridgeChild::DestroyBridge();
|
||||
delete sImageBridgeChildThread;
|
||||
sImageBridgeChildThread = nullptr;
|
||||
@ -614,14 +571,15 @@ bool ImageBridgeChild::StartUpOnThread(Thread* aThread)
|
||||
|
||||
void ImageBridgeChild::DestroyBridge()
|
||||
{
|
||||
if (!IsCreated()) {
|
||||
return;
|
||||
}
|
||||
NS_ABORT_IF_FALSE(!InImageBridgeChildThread(),
|
||||
"This method must not be called in this thread.");
|
||||
// ...because we are about to dispatch synchronous messages to the
|
||||
// ImageBridgeChild thread.
|
||||
|
||||
if (!IsCreated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ReentrantMonitor barrier("ImageBridgeDestroyTask lock");
|
||||
ReentrantMonitorAutoEnter autoMon(barrier);
|
||||
|
||||
@ -643,8 +601,7 @@ void ImageBridgeChild::DestroyBridge()
|
||||
|
||||
bool InImageBridgeChildThread()
|
||||
{
|
||||
return ImageBridgeChild::IsCreated() &&
|
||||
sImageBridgeChildThread->thread_id() == PlatformThread::CurrentId();
|
||||
return sImageBridgeChildThread->thread_id() == PlatformThread::CurrentId();
|
||||
}
|
||||
|
||||
MessageLoop * ImageBridgeChild::GetMessageLoop() const
|
||||
@ -690,7 +647,6 @@ ImageBridgeChild::CreateImageClient(CompositableType aType)
|
||||
TemporaryRef<ImageClient>
|
||||
ImageBridgeChild::CreateImageClientNow(CompositableType aType)
|
||||
{
|
||||
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
|
||||
RefPtr<ImageClient> client
|
||||
= ImageClient::CreateImageClient(aType, this, 0);
|
||||
MOZ_ASSERT(client, "failed to create ImageClient");
|
||||
@ -704,7 +660,6 @@ PGrallocBufferChild*
|
||||
ImageBridgeChild::AllocPGrallocBufferChild(const IntSize&, const uint32_t&, const uint32_t&,
|
||||
MaybeMagicGrallocBufferHandle*)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
||||
return GrallocBufferActor::Create();
|
||||
#else
|
||||
@ -716,7 +671,6 @@ ImageBridgeChild::AllocPGrallocBufferChild(const IntSize&, const uint32_t&, cons
|
||||
bool
|
||||
ImageBridgeChild::DeallocPGrallocBufferChild(PGrallocBufferChild* actor)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
||||
delete actor;
|
||||
return true;
|
||||
@ -731,7 +685,6 @@ ImageBridgeChild::AllocUnsafeShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
if (InImageBridgeChildThread()) {
|
||||
return PImageBridgeChild::AllocUnsafeShmem(aSize, aType, aShmem);
|
||||
} else {
|
||||
@ -744,7 +697,6 @@ ImageBridgeChild::AllocShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
if (InImageBridgeChildThread()) {
|
||||
return PImageBridgeChild::AllocShmem(aSize, aType, aShmem);
|
||||
} else {
|
||||
@ -884,7 +836,6 @@ ImageBridgeChild::AllocGrallocBufferNow(const gfx::IntSize& aSize,
|
||||
MaybeMagicGrallocBufferHandle* aHandle,
|
||||
PGrallocBufferChild** aChild)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
*aChild = SendPGrallocBufferConstructor(aSize,
|
||||
aFormat,
|
||||
@ -947,7 +898,6 @@ PTextureChild*
|
||||
ImageBridgeChild::AllocPTextureChild(const SurfaceDescriptor&,
|
||||
const TextureFlags&)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
return TextureClient::CreateIPDLActor();
|
||||
}
|
||||
|
||||
@ -961,7 +911,6 @@ PTextureChild*
|
||||
ImageBridgeChild::CreateTexture(const SurfaceDescriptor& aSharedData,
|
||||
TextureFlags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
return SendPTextureConstructor(aSharedData, aFlags);
|
||||
}
|
||||
|
||||
@ -969,7 +918,6 @@ void
|
||||
ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable,
|
||||
TextureClient* aTexture)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
|
||||
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
||||
nullptr, aTexture->GetIPDLActor()));
|
||||
@ -993,7 +941,6 @@ static void RemoveTextureSync(TextureClient* aTexture, ReentrantMonitor* aBarrie
|
||||
void ImageBridgeChild::RemoveTexture(TextureClient* aTexture)
|
||||
{
|
||||
if (InImageBridgeChildThread()) {
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
aTexture->ForceRemove();
|
||||
return;
|
||||
}
|
||||
|
@ -314,7 +314,6 @@ public:
|
||||
uint32_t aFormat, uint32_t aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aHandle,
|
||||
PGrallocBufferChild** aChild);
|
||||
void MarkShutDown();
|
||||
protected:
|
||||
ImageBridgeChild();
|
||||
bool DispatchAllocShmemInternal(size_t aSize,
|
||||
@ -330,8 +329,6 @@ protected:
|
||||
MaybeMagicGrallocBufferHandle* aHandle) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DeallocGrallocBuffer(PGrallocBufferChild* aChild) MOZ_OVERRIDE;
|
||||
|
||||
bool mShuttingDown;
|
||||
};
|
||||
|
||||
} // layers
|
||||
|
@ -493,6 +493,12 @@ gfxPlatform::Shutdown()
|
||||
mozilla::gl::GLContextProviderEGL::Shutdown();
|
||||
#endif
|
||||
|
||||
// This will block this thread untill the ImageBridge protocol is completely
|
||||
// deleted.
|
||||
ImageBridgeChild::ShutDown();
|
||||
|
||||
CompositorParent::ShutDown();
|
||||
|
||||
delete gGfxPlatformPrefsLock;
|
||||
|
||||
gfxPrefs::DestroySingleton();
|
||||
|
@ -129,9 +129,6 @@ extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **)
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/SystemMemoryReporter.h"
|
||||
|
||||
#include "mozilla/layers/ImageBridgeChild.h"
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#endif
|
||||
@ -781,11 +778,6 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
|
||||
}
|
||||
}
|
||||
|
||||
// This must happen after the shutdown of media and widgets, which
|
||||
// are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
|
||||
mozilla::layers::ImageBridgeChild::ShutDown();
|
||||
mozilla::layers::CompositorParent::ShutDown();
|
||||
|
||||
NS_ProcessPendingEvents(thread);
|
||||
mozilla::scache::StartupCache::DeleteSingleton();
|
||||
if (observerService)
|
||||
|
Loading…
Reference in New Issue
Block a user