Bug 1284051 - Handle ShadowLayers::GetCompositorBridgeChild returning null. r=sotaro
authorNicolas Silva <nsilva@mozilla.com>
Mon, 04 Jul 2016 15:10:22 +0200
changeset 303498 276344b0869770b6e322d96a10c55b3b1c6005f6
parent 303497 093656bb17027c8007048b440943672efe536215
child 303499 98f89b57943876e8dac433773378d1e879509f6c
push id79104
push usernsilva@mozilla.com
push dateMon, 04 Jul 2016 13:10:33 +0000
treeherdermozilla-inbound@276344b08697 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1284051
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1284051 - Handle ShadowLayers::GetCompositorBridgeChild returning null. r=sotaro
gfx/layers/ipc/ShadowLayers.cpp
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -1091,37 +1091,48 @@ ShadowLayerForwarder::DestroySurfaceDesc
       NS_RUNTIMEABORT("surface type not implemented!");
   }
   *aSurface = SurfaceDescriptor();
 }
 
 void
 ShadowLayerForwarder::UpdateFwdTransactionId()
 {
-  GetCompositorBridgeChild()->UpdateFwdTransactionId();
+  auto compositorBridge = GetCompositorBridgeChild();
+  if (compositorBridge) {
+    compositorBridge->UpdateFwdTransactionId();
+  }
 }
 
 uint64_t
 ShadowLayerForwarder::GetFwdTransactionId()
 {
-  return GetCompositorBridgeChild()->GetFwdTransactionId();
+  auto compositorBridge = GetCompositorBridgeChild();
+  MOZ_DIAGNOSTIC_ASSERT(compositorBridge);
+  return compositorBridge ? compositorBridge->GetFwdTransactionId() : 0;
 }
 
 void
 ShadowLayerForwarder::CancelWaitForRecycle(uint64_t aTextureId)
 {
-  GetCompositorBridgeChild()->CancelWaitForRecycle(aTextureId);
+  auto compositorBridge = GetCompositorBridgeChild();
+  if (compositorBridge) {
+    compositorBridge->CancelWaitForRecycle(aTextureId);
+  }
 }
 
 CompositorBridgeChild*
 ShadowLayerForwarder::GetCompositorBridgeChild()
 {
   if (mCompositorBridgeChild) {
     return mCompositorBridgeChild;
   }
+  if (!mShadowManager) {
+    return nullptr;
+  }
   mCompositorBridgeChild = static_cast<CompositorBridgeChild*>(mShadowManager->Manager());
   return mCompositorBridgeChild;
 }
 
 TextureForwarder*
 ShadowLayerForwarder::AsTextureForwarder()
 {
   return GetCompositorBridgeChild();