Bug 1016538 - Fix unbalanced locking logic in tiling. r=Bas, a=sledru
authorNicolas Silva <nsilva@mozilla.com>
Wed, 27 Aug 2014 16:50:25 +0200
changeset 217726 527cd5e7a209325b68c28e51c0978faad0ec60b2
parent 217725 0756d338e9861c8d712057a790c721c6036ba410
child 217727 216944609df30b41e1d3d4598818d03ad2f3d657
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, sledru
bugs1016538
milestone33.0a2
Bug 1016538 - Fix unbalanced locking logic in tiling. r=Bas, a=sledru
gfx/layers/client/TiledContentClient.cpp
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -313,16 +313,17 @@ ClientTiledLayerBuffer::GetContentType()
 gfxMemorySharedReadLock::gfxMemorySharedReadLock()
   : mReadCount(1)
 {
   MOZ_COUNT_CTOR(gfxMemorySharedReadLock);
 }
 
 gfxMemorySharedReadLock::~gfxMemorySharedReadLock()
 {
+  MOZ_ASSERT(mReadCount == 0);
   MOZ_COUNT_DTOR(gfxMemorySharedReadLock);
 }
 
 int32_t
 gfxMemorySharedReadLock::ReadLock()
 {
   NS_ASSERT_OWNINGTHREAD(gfxMemorySharedReadLock);
 
@@ -603,16 +604,21 @@ TileClient::GetBackBuffer(const nsIntReg
       mBackLock->GetReadCount() > 1) {
     if (mBackBuffer) {
       // Our current back-buffer is still locked by the compositor. This can occur
       // when the client is producing faster than the compositor can consume. In
       // this case we just want to drop it and not return it to the pool.
       aPool->ReportClientLost();
     }
     mBackBuffer = aPool->GetTextureClient();
+
+    if (mBackLock) {
+      // Before we Replacing the lock by another one we need to unlock it!
+      mBackLock->ReadUnlock();
+    }
     // Create a lock for our newly created back-buffer.
     if (mManager->AsShadowForwarder()->IsSameProcess()) {
       // If our compositor is in the same process, we can save some cycles by not
       // using shared memory.
       mBackLock = new gfxMemorySharedReadLock();
     } else {
       mBackLock = new gfxShmSharedReadLock(mManager->AsShadowForwarder());
     }