Bug 1339852 - Fix a content canvas crash caused by losing IPC during a GPU process restart. r=mattwoodrow, a=lizzard
authorDavid Anderson <danderson@mozilla.com>
Wed, 15 Feb 2017 19:09:18 -0800
changeset 359648 abc24cf07fc9aaf416f5efabb808d60363120816
parent 359647 9a08c0317d188d67b593a20e96da25b380b4f2fb
child 359649 3df2a420389bbeda6c16676068d1f452b2c6d340
push id10858
push userryanvm@gmail.com
push dateSun, 05 Mar 2017 19:22:37 +0000
treeherdermozilla-aurora@a94edff8355a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lizzard
bugs1339852
milestone53.0a2
Bug 1339852 - Fix a content canvas crash caused by losing IPC during a GPU process restart. r=mattwoodrow, a=lizzard
gfx/layers/client/TextureClient.cpp
gfx/layers/ipc/CompositorBridgeChild.cpp
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1580,20 +1580,20 @@ int32_t
 ShmemTextureReadLock::ReadUnlock() {
   if (!mAllocSuccess) {
     return 0;
   }
   ShmReadLockInfo* info = GetShmReadLockInfoPtr();
   int32_t readCount = PR_ATOMIC_DECREMENT(&info->readCount);
   MOZ_ASSERT(readCount >= 0);
   if (readCount <= 0) {
-    if (mClientAllocator) {
+    if (mClientAllocator && mClientAllocator->GetTileLockAllocator()) {
       mClientAllocator->GetTileLockAllocator()->DeallocShmemSection(mShmemSection);
     } else {
-      // we are on the compositor process
+      // we are on the compositor process, or IPC is down.
       FixedSizeSmallShmemSectionAllocator::FreeShmemSection(mShmemSection);
     }
   }
   return readCount;
 }
 
 int32_t
 ShmemTextureReadLock::GetReadCount() {
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -1023,17 +1023,16 @@ CompositorBridgeChild::ClearTexturePool(
   for (size_t i = 0; i < mTexturePools.Length(); i++) {
     mTexturePools[i]->Clear();
   }
 }
 
 FixedSizeSmallShmemSectionAllocator*
 CompositorBridgeChild::GetTileLockAllocator()
 {
-  MOZ_ASSERT(IPCOpen());
   if (!IPCOpen()) {
     return nullptr;
   }
 
   if (!mSectionAllocator) {
     mSectionAllocator = new FixedSizeSmallShmemSectionAllocator(this);
   }
   return mSectionAllocator;