Bug 973869 - Make SharedPlanarYCbCrImage properly Lock its TextureClient. r=mattoodrow
authorNicolas Silva <nical@mozilla.com>
Wed, 19 Feb 2014 16:53:14 +0100
changeset 169868 3edf59b5ca9f6bd06889a92cf2a4f9511f0e7af3
parent 169867 92e944c9344d091a4495b97df33ed94faca74dcb
child 169869 f516f1a8f3069a9962a4742e63e2b6b1793e1b7b
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmattoodrow
bugs973869
milestone30.0a1
Bug 973869 - Make SharedPlanarYCbCrImage properly Lock its TextureClient. r=mattoodrow
gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
--- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
+++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
@@ -104,22 +104,25 @@ SharedPlanarYCbCrImage::SetData(const Pl
     Data data = aData;
     if (!Allocate(data)) {
       NS_WARNING("SharedPlanarYCbCrImage::SetData failed to allocate");
       return;
     }
   }
 
   MOZ_ASSERT(mTextureClient->AsTextureClientYCbCr());
-
+  if (!mTextureClient->Lock(OPEN_WRITE_ONLY)) {
+    MOZ_ASSERT(false, "Failed to lock the texture.");
+    return;
+  }
+  TextureClientAutoUnlock unlock(mTextureClient);
   if (!mTextureClient->AsTextureClientYCbCr()->UpdateYCbCr(aData)) {
     MOZ_ASSERT(false, "Failed to copy YCbCr data into the TextureClient");
     return;
   }
-
   // do not set mBuffer like in PlanarYCbCrImage because the later
   // will try to manage this memory without knowing it belongs to a
   // shmem.
   mBufferSize = YCbCrImageDataSerializer::ComputeMinBufferSize(mData.mYSize,
                                                                mData.mCbCrSize);
   mSize = mData.mPicSize;
 
   YCbCrImageDataSerializer serializer(mTextureClient->GetBuffer());