Bug 1019877 - fix deadlock at AsyncTransactionTrackersHolder r=nical
authorSotaro Ikeda <sikeda@mozilla.com>
Thu, 05 Jun 2014 07:24:05 -0700
changeset 186844 6febca7ac4383cb1be64ad50bc926d1da4ca9b0b
parent 186843 189492a9a1151073e187dd62440011c8fee2b5fe
child 186845 8593b6da302c7e300b61bd47bbc08cede0b4135d
push idunknown
push userunknown
push dateunknown
reviewersnical
bugs1019877
milestone32.0a1
Bug 1019877 - fix deadlock at AsyncTransactionTrackersHolder r=nical
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ImageClient.cpp
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -171,17 +171,17 @@ CanvasClientSurfaceStream::Update(gfx::I
     }
 
     if (grallocTextureClient->GetIPDLActor()) {
       GetForwarder()->UseTexture(this, grallocTextureClient);
     }
 
     if (mBuffer && CompositorChild::ChildProcessHasCompositor()) {
       // remove old buffer from CompositableHost
-      RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker(this);
+      RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker();
       // Hold TextureClient until transaction complete.
       tracker->SetTextureClient(mBuffer);
       mBuffer->SetRemoveFromCompositableTracker(tracker);
       // RemoveTextureFromCompositableAsync() expects CompositorChild's presence.
       GetForwarder()->RemoveTextureFromCompositableAsync(tracker, this, mBuffer);
     }
     mBuffer = grallocTextureClient;
 #else
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -29,55 +29,51 @@ class CompositableChild;
 class SurfaceDescriptor;
 class PCompositableChild;
 
 /**
  * Handle RemoveTextureFromCompositableAsync() transaction.
  */
 class RemoveTextureFromCompositableTracker : public AsyncTransactionTracker {
 public:
-  RemoveTextureFromCompositableTracker(CompositableClient* aCompositableClient)
-    : mCompositableClient(aCompositableClient)
+  RemoveTextureFromCompositableTracker()
   {
     MOZ_COUNT_CTOR(RemoveTextureFromCompositableTracker);
   }
 
   ~RemoveTextureFromCompositableTracker()
   {
     MOZ_COUNT_DTOR(RemoveTextureFromCompositableTracker);
   }
 
   virtual void Complete() MOZ_OVERRIDE
   {
     // The TextureClient's recycling is postponed until the transaction
     // complete.
     mTextureClient = nullptr;
-    mCompositableClient = nullptr;
   }
 
   virtual void Cancel() MOZ_OVERRIDE
   {
     mTextureClient = nullptr;
-    mCompositableClient = nullptr;
   }
 
   virtual void SetTextureClient(TextureClient* aTextureClient) MOZ_OVERRIDE
   {
     mTextureClient = aTextureClient;
   }
 
   virtual void SetReleaseFenceHandle(FenceHandle& aReleaseFenceHandle) MOZ_OVERRIDE
   {
     if (mTextureClient) {
       mTextureClient->SetReleaseFenceHandle(aReleaseFenceHandle);
     }
   }
 
 private:
-  RefPtr<CompositableClient> mCompositableClient;
   RefPtr<TextureClient> mTextureClient;
 };
 
 /**
  * CompositableClient manages the texture-specific logic for composite layers,
  * independently of the layer. It is the content side of a CompositableClient/
  * CompositableHost pair.
  *
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -363,27 +363,27 @@ ContentClientDoubleBuffered::Updated(con
                                      const nsIntRegion& aVisibleRegion,
                                      bool aDidSelfCopy)
 {
   ContentClientRemoteBuffer::Updated(aRegionToDraw, aVisibleRegion, aDidSelfCopy);
 
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
   if (mFrontClient && CompositorChild::ChildProcessHasCompositor()) {
     // remove old buffer from CompositableHost
-    RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker(this);
+    RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker();
     // Hold TextureClient until transaction complete.
     tracker->SetTextureClient(mFrontClient);
     mFrontClient->SetRemoveFromCompositableTracker(tracker);
     // RemoveTextureFromCompositableAsync() expects CompositorChild's presence.
     GetForwarder()->RemoveTextureFromCompositableAsync(tracker, this, mFrontClient);
   }
 
   if (mFrontClientOnWhite && CompositorChild::ChildProcessHasCompositor()) {
     // remove old buffer from CompositableHost
-    RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker(this);
+    RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker();
     // Hold TextureClient until transaction complete.
     tracker->SetTextureClient(mFrontClientOnWhite);
     mFrontClientOnWhite->SetRemoveFromCompositableTracker(tracker);
     // RemoveTextureFromCompositableAsync() expects CompositorChild's presence.
     GetForwarder()->RemoveTextureFromCompositableAsync(tracker, this, mFrontClientOnWhite);
   }
 #endif
 }
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -83,17 +83,17 @@ ImageClient::RemoveTextureWithTracker(Te
 #ifdef MOZ_WIDGET_GONK
   // AsyncTransactionTracker is supported only on ImageBridge.
   // Use AsyncTransactionTracker only when TextureClient is recyeled.
   if (aAsyncTransactionTracker ||
       (GetForwarder()->IsImageBridgeChild() && aTexture->HasRecycleCallback())) {
     RefPtr<AsyncTransactionTracker> request = aAsyncTransactionTracker;
     if (!request) {
       // Create AsyncTransactionTracker if it is not provided as argument.
-      request = new RemoveTextureFromCompositableTracker(this);
+      request = new RemoveTextureFromCompositableTracker();
     }
     // Hold TextureClient until the transaction complete to postpone
     // the TextureClient recycle.
     request->SetTextureClient(aTexture);
     GetForwarder()->RemoveTextureFromCompositableAsync(request, this, aTexture);
     return;
   }
 #endif
@@ -123,17 +123,17 @@ ImageClientBuffered::ImageClientBuffered
 TextureInfo ImageClientSingle::GetTextureInfo() const
 {
   return TextureInfo(CompositableType::IMAGE);
 }
 
 TemporaryRef<AsyncTransactionTracker>
 ImageClientSingle::PrepareFlushAllImages()
 {
-  RefPtr<AsyncTransactionTracker> status = new RemoveTextureFromCompositableTracker(this);
+  RefPtr<AsyncTransactionTracker> status = new RemoveTextureFromCompositableTracker();
   return status;
 }
 
 void
 ImageClientSingle::FlushAllImages(bool aExceptFront,
                                   AsyncTransactionTracker* aAsyncTransactionTracker)
 {
   if (!aExceptFront && mFrontBuffer) {