Fix canvas crashing when the GPU process aborts. (bug 1314427, r=nical)
authorDavid Anderson <danderson@mozilla.com>
Tue, 15 Nov 2016 13:04:59 -0800
changeset 322789 c99f95ab0b907d44feba3047045ae86fe606884d
parent 322788 e66c6309387c05577e0e698f69c8c70a8d16221d
child 322790 dd21f10a7d6eb49adf92e452cd43e023ff5127fa
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersnical
bugs1314427
milestone53.0a1
Fix canvas crashing when the GPU process aborts. (bug 1314427, r=nical)
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/TextureClient.cpp
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -495,17 +495,19 @@ CanvasClientSharedSurface::Updated()
   }
 
   auto forwarder = GetForwarder();
 
   mFront = mNewFront;
   mNewFront = nullptr;
 
   // Add the new TexClient.
-  MOZ_ALWAYS_TRUE( AddTextureClient(mFront) );
+  if (!AddTextureClient(mFront)) {
+    return;
+  }
 
   AutoTArray<CompositableForwarder::TimedTextureClient,1> textures;
   CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
   t->mTextureClient = mFront;
   t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize());
   t->mFrameID = mFrameID;
   forwarder->UseTextures(this, textures);
 }
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -846,16 +846,21 @@ TextureClient::SetRecycleAllocator(IText
     ClearRecycleCallback();
   }
 }
 
 bool
 TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
 {
   MOZ_ASSERT(aForwarder && aForwarder->GetTextureForwarder()->GetMessageLoop() == mAllocator->GetMessageLoop());
+
+  if (mActor && !mActor->IPCOpen()) {
+    return false;
+  }
+
   if (mActor && !mActor->mDestroyed) {
     CompositableForwarder* currentFwd = mActor->mCompositableForwarder;
     TextureForwarder* currentTexFwd = mActor->mTextureForwarder;
     if (currentFwd != aForwarder) {
       // It's a bit iffy but right now ShadowLayerForwarder inherits TextureForwarder
       // even though it should not. ShadowLayerForwarder::GetTextureForwarder actually
       // returns a pointer to the CompositorBridgeChild.
       // It's Ok for a texture to move from a ShadowLayerForwarder to another, but