Bug 924622 - Backout because of e10s mochitest regression on linux on a CLOSED TREE

This commit is contained in:
Nicolas Silva 2014-04-28 19:32:32 +02:00
parent a5e3e709e3
commit e654487c2a
5 changed files with 9 additions and 79 deletions

View File

@ -179,6 +179,5 @@ CompositableClient::OnTransaction()
{ {
} }
} // namespace layers } // namespace layers
} // namespace mozilla } // namespace mozilla

View File

@ -173,33 +173,12 @@ static void StopImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone)
NS_ABORT_IF_FALSE(InImageBridgeChildThread(), NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
"Should be in ImageBridgeChild thread."); "Should be in ImageBridgeChild thread.");
if (sImageBridgeChildSingleton) { 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->SendStop();
sImageBridgeChildSingleton->MarkShutDown();
// From now on, no message can be sent through the image bridge from the
// client side.
} }
*aDone = true; *aDone = true;
aBarrier->NotifyAll(); aBarrier->NotifyAll();
} }
void
ImageBridgeChild::MarkShutDown()
{
MOZ_ASSERT(!mShuttingDown);
mShuttingDown = true;
}
// dispatched function // dispatched function
static void DeleteImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone) static void DeleteImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone)
{ {
@ -271,7 +250,6 @@ static void ConnectImageBridge(ImageBridgeChild * child, ImageBridgeParent * par
} }
ImageBridgeChild::ImageBridgeChild() ImageBridgeChild::ImageBridgeChild()
: mShuttingDown(false)
{ {
mTxn = new CompositableTransaction(); mTxn = new CompositableTransaction();
} }
@ -284,7 +262,6 @@ void
ImageBridgeChild::Connect(CompositableClient* aCompositable) ImageBridgeChild::Connect(CompositableClient* aCompositable)
{ {
MOZ_ASSERT(aCompositable); MOZ_ASSERT(aCompositable);
MOZ_ASSERT(!mShuttingDown);
uint64_t id = 0; uint64_t id = 0;
PCompositableChild* child = PCompositableChild* child =
SendPCompositableConstructor(aCompositable->GetTextureInfo(), &id); SendPCompositableConstructor(aCompositable->GetTextureInfo(), &id);
@ -295,7 +272,6 @@ ImageBridgeChild::Connect(CompositableClient* aCompositable)
PCompositableChild* PCompositableChild*
ImageBridgeChild::AllocPCompositableChild(const TextureInfo& aInfo, uint64_t* aID) ImageBridgeChild::AllocPCompositableChild(const TextureInfo& aInfo, uint64_t* aID)
{ {
MOZ_ASSERT(!mShuttingDown);
return CompositableClient::CreateIPDLActor(); return CompositableClient::CreateIPDLActor();
} }
@ -359,17 +335,6 @@ static void ReleaseImageClientNow(ImageClient* aClient)
// static // static
void ImageBridgeChild::DispatchReleaseImageClient(ImageClient* aClient) void ImageBridgeChild::DispatchReleaseImageClient(ImageClient* aClient)
{ {
if (!IsCreated()) {
// CompositableClient::Release should normally happen in the ImageBridgeChild
// thread because it usually generate some IPDL messages.
// However, if we take this branch it means that the ImageBridgeChild
// has already shut down, along with the CompositableChild, which means no
// message will be sent and it is safe to run this code from any thread.
MOZ_ASSERT(aClient->GetIPDLActor() == nullptr);
aClient->Release();
return;
}
sImageBridgeChildSingleton->GetMessageLoop()->PostTask( sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableFunction(&ReleaseImageClientNow, aClient)); NewRunnableFunction(&ReleaseImageClientNow, aClient));
@ -384,17 +349,6 @@ static void ReleaseTextureClientNow(TextureClient* aClient)
// static // static
void ImageBridgeChild::DispatchReleaseTextureClient(TextureClient* aClient) void ImageBridgeChild::DispatchReleaseTextureClient(TextureClient* aClient)
{ {
if (!IsCreated()) {
// TextureClient::Release should normally happen in the ImageBridgeChild
// thread because it usually generate some IPDL messages.
// However, if we take this branch it means that the ImageBridgeChild
// has already shut down, along with the TextureChild, which means no
// message will be sent and it is safe to run this code from any thread.
MOZ_ASSERT(aClient->GetIPDLActor() == nullptr);
aClient->Release();
return;
}
sImageBridgeChildSingleton->GetMessageLoop()->PostTask( sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableFunction(&ReleaseTextureClientNow, aClient)); NewRunnableFunction(&ReleaseTextureClientNow, aClient));
@ -414,10 +368,6 @@ static void UpdateImageClientNow(ImageClient* aClient, ImageContainer* aContaine
void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient, void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient,
ImageContainer* aContainer) ImageContainer* aContainer)
{ {
if (!IsCreated()) {
return;
}
if (InImageBridgeChildThread()) { if (InImageBridgeChildThread()) {
UpdateImageClientNow(aClient, aContainer); UpdateImageClientNow(aClient, aContainer);
return; return;
@ -442,10 +392,6 @@ static void FlushAllImagesSync(ImageClient* aClient, ImageContainer* aContainer,
//static //static
void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront) void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront)
{ {
if (!IsCreated()) {
return;
}
if (InImageBridgeChildThread()) { if (InImageBridgeChildThread()) {
FlushAllImagesNow(aClient, aContainer, aExceptFront); FlushAllImagesNow(aClient, aContainer, aExceptFront);
return; return;
@ -470,7 +416,6 @@ void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aCon
void ImageBridgeChild::FlushAllImagesNow(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront) void ImageBridgeChild::FlushAllImagesNow(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront)
{ {
MOZ_ASSERT(aClient); MOZ_ASSERT(aClient);
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
sImageBridgeChildSingleton->BeginTransaction(); sImageBridgeChildSingleton->BeginTransaction();
if (aContainer && !aExceptFront) { if (aContainer && !aExceptFront) {
aContainer->ClearCurrentImage(); aContainer->ClearCurrentImage();
@ -483,7 +428,6 @@ void ImageBridgeChild::FlushAllImagesNow(ImageClient* aClient, ImageContainer* a
void void
ImageBridgeChild::BeginTransaction() ImageBridgeChild::BeginTransaction()
{ {
MOZ_ASSERT(!mShuttingDown);
MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?"); MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?");
mTxn->Begin(); mTxn->Begin();
} }
@ -505,7 +449,6 @@ private:
void void
ImageBridgeChild::EndTransaction() ImageBridgeChild::EndTransaction()
{ {
MOZ_ASSERT(!mShuttingDown);
MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?"); MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?");
AutoEndTransaction _(mTxn); AutoEndTransaction _(mTxn);
@ -601,7 +544,6 @@ void ImageBridgeChild::ShutDown()
{ {
NS_ASSERTION(NS_IsMainThread(), "Should be on the main Thread!"); NS_ASSERTION(NS_IsMainThread(), "Should be on the main Thread!");
if (ImageBridgeChild::IsCreated()) { if (ImageBridgeChild::IsCreated()) {
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
ImageBridgeChild::DestroyBridge(); ImageBridgeChild::DestroyBridge();
delete sImageBridgeChildThread; delete sImageBridgeChildThread;
sImageBridgeChildThread = nullptr; sImageBridgeChildThread = nullptr;
@ -704,7 +646,6 @@ ImageBridgeChild::CreateImageClient(CompositableType aType)
TemporaryRef<ImageClient> TemporaryRef<ImageClient>
ImageBridgeChild::CreateImageClientNow(CompositableType aType) ImageBridgeChild::CreateImageClientNow(CompositableType aType)
{ {
MOZ_ASSERT(!sImageBridgeChildSingleton->mShuttingDown);
RefPtr<ImageClient> client RefPtr<ImageClient> client
= ImageClient::CreateImageClient(aType, this, TextureFlags::NO_FLAGS); = ImageClient::CreateImageClient(aType, this, TextureFlags::NO_FLAGS);
MOZ_ASSERT(client, "failed to create ImageClient"); MOZ_ASSERT(client, "failed to create ImageClient");
@ -718,7 +659,6 @@ PGrallocBufferChild*
ImageBridgeChild::AllocPGrallocBufferChild(const IntSize&, const uint32_t&, const uint32_t&, ImageBridgeChild::AllocPGrallocBufferChild(const IntSize&, const uint32_t&, const uint32_t&,
MaybeMagicGrallocBufferHandle*) MaybeMagicGrallocBufferHandle*)
{ {
MOZ_ASSERT(!mShuttingDown);
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
return GrallocBufferActor::Create(); return GrallocBufferActor::Create();
#else #else
@ -730,7 +670,6 @@ ImageBridgeChild::AllocPGrallocBufferChild(const IntSize&, const uint32_t&, cons
bool bool
ImageBridgeChild::DeallocPGrallocBufferChild(PGrallocBufferChild* actor) ImageBridgeChild::DeallocPGrallocBufferChild(PGrallocBufferChild* actor)
{ {
MOZ_ASSERT(!mShuttingDown);
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
delete actor; delete actor;
return true; return true;
@ -745,7 +684,6 @@ ImageBridgeChild::AllocUnsafeShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType, ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) ipc::Shmem* aShmem)
{ {
MOZ_ASSERT(!mShuttingDown);
if (InImageBridgeChildThread()) { if (InImageBridgeChildThread()) {
return PImageBridgeChild::AllocUnsafeShmem(aSize, aType, aShmem); return PImageBridgeChild::AllocUnsafeShmem(aSize, aType, aShmem);
} else { } else {
@ -758,7 +696,6 @@ ImageBridgeChild::AllocShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType, ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) ipc::Shmem* aShmem)
{ {
MOZ_ASSERT(!mShuttingDown);
if (InImageBridgeChildThread()) { if (InImageBridgeChildThread()) {
return PImageBridgeChild::AllocShmem(aSize, aType, aShmem); return PImageBridgeChild::AllocShmem(aSize, aType, aShmem);
} else { } else {
@ -961,7 +898,6 @@ PTextureChild*
ImageBridgeChild::AllocPTextureChild(const SurfaceDescriptor&, ImageBridgeChild::AllocPTextureChild(const SurfaceDescriptor&,
const TextureFlags&) const TextureFlags&)
{ {
MOZ_ASSERT(!mShuttingDown);
return TextureClient::CreateIPDLActor(); return TextureClient::CreateIPDLActor();
} }
@ -975,7 +911,6 @@ PTextureChild*
ImageBridgeChild::CreateTexture(const SurfaceDescriptor& aSharedData, ImageBridgeChild::CreateTexture(const SurfaceDescriptor& aSharedData,
TextureFlags aFlags) TextureFlags aFlags)
{ {
MOZ_ASSERT(!mShuttingDown);
return SendPTextureConstructor(aSharedData, aFlags); return SendPTextureConstructor(aSharedData, aFlags);
} }
@ -983,7 +918,6 @@ void
ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable, ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) TextureClient* aTexture)
{ {
MOZ_ASSERT(!mShuttingDown);
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) { if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(), mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor())); nullptr, aTexture->GetIPDLActor()));
@ -1007,7 +941,6 @@ static void RemoveTextureSync(TextureClient* aTexture, ReentrantMonitor* aBarrie
void ImageBridgeChild::RemoveTexture(TextureClient* aTexture) void ImageBridgeChild::RemoveTexture(TextureClient* aTexture)
{ {
if (InImageBridgeChildThread()) { if (InImageBridgeChildThread()) {
MOZ_ASSERT(!mShuttingDown);
aTexture->ForceRemove(); aTexture->ForceRemove();
return; return;
} }

View File

@ -314,7 +314,6 @@ public:
uint32_t aFormat, uint32_t aUsage, uint32_t aFormat, uint32_t aUsage,
MaybeMagicGrallocBufferHandle* aHandle, MaybeMagicGrallocBufferHandle* aHandle,
PGrallocBufferChild** aChild); PGrallocBufferChild** aChild);
void MarkShutDown();
protected: protected:
ImageBridgeChild(); ImageBridgeChild();
bool DispatchAllocShmemInternal(size_t aSize, bool DispatchAllocShmemInternal(size_t aSize,
@ -330,8 +329,6 @@ protected:
MaybeMagicGrallocBufferHandle* aHandle) MOZ_OVERRIDE; MaybeMagicGrallocBufferHandle* aHandle) MOZ_OVERRIDE;
virtual void DeallocGrallocBuffer(PGrallocBufferChild* aChild) MOZ_OVERRIDE; virtual void DeallocGrallocBuffer(PGrallocBufferChild* aChild) MOZ_OVERRIDE;
bool mShuttingDown;
}; };
} // layers } // layers

View File

@ -493,6 +493,12 @@ gfxPlatform::Shutdown()
mozilla::gl::GLContextProviderEGL::Shutdown(); mozilla::gl::GLContextProviderEGL::Shutdown();
#endif #endif
// This will block this thread untill the ImageBridge protocol is completely
// deleted.
ImageBridgeChild::ShutDown();
CompositorParent::ShutDown();
delete gGfxPlatformPrefsLock; delete gGfxPlatformPrefsLock;
gfxPrefs::DestroySingleton(); gfxPrefs::DestroySingleton();

View File

@ -6,9 +6,6 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/Atomics.h" #include "mozilla/Atomics.h"
#include "mozilla/Poison.h" #include "mozilla/Poison.h"
#include "mozilla/XPCOM.h" #include "mozilla/XPCOM.h"
@ -19,6 +16,9 @@
#include "prlink.h" #include "prlink.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/CompositorParent.h"
#include "nsCycleCollector.h" #include "nsCycleCollector.h"
#include "nsObserverList.h" #include "nsObserverList.h"
#include "nsObserverService.h" #include "nsObserverService.h"
@ -789,11 +789,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); NS_ProcessPendingEvents(thread);
mozilla::scache::StartupCache::DeleteSingleton(); mozilla::scache::StartupCache::DeleteSingleton();
if (observerService) if (observerService)