Bug 1200595 - Merge TextureClient and ClientTexture back into TextureClient. r=mattwoodrow
authorNicolas Silva <nsilva@mozilla.com>
Fri, 20 Nov 2015 14:25:00 +0100
changeset 308853 971189684dd5f3ec10f31f7b8ccd800ca3e7cad1
parent 308852 94e3e5bfbeb314fcdbb54dc89d04346014763898
child 308854 49e11078c53688e66ef586eecd341b3c5d00dd0b
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1200595
milestone45.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 1200595 - Merge TextureClient and ClientTexture back into TextureClient. r=mattwoodrow
gfx/gl/SharedSurfaceGralloc.cpp
gfx/layers/BufferTexture.h
gfx/layers/D3D9SurfaceImage.cpp
gfx/layers/GrallocImages.cpp
gfx/layers/basic/TextureClientX11.cpp
gfx/layers/client/CompositableClient.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/client/TextureClientSharedSurface.cpp
gfx/layers/client/TextureClientSharedSurface.h
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/opengl/GrallocTextureClient.cpp
gfx/layers/opengl/GrallocTextureClient.h
gfx/tests/gtest/TestTextures.cpp
widget/gonk/nativewindow/GonkBufferQueueJB.cpp
widget/gonk/nativewindow/GonkBufferQueueKK.cpp
widget/gonk/nativewindow/GonkNativeWindowICS.cpp
--- a/gfx/gl/SharedSurfaceGralloc.cpp
+++ b/gfx/gl/SharedSurfaceGralloc.cpp
@@ -66,17 +66,17 @@ SharedSurface_Gralloc::Create(GLContext*
     GrallocTextureData* texData = GrallocTextureData::CreateForGLRendering(
         size, gfxPlatform::GetPlatform()->Optimal2DFormatForContent(type), allocator
     );
 
     if (!texData) {
         return Move(ret);
     }
 
-    RefPtr<TextureClient> grallocTC = new ClientTexture(texData, flags, allocator);
+    RefPtr<TextureClient> grallocTC = new TextureClient(texData, flags, allocator);
 
     sp<GraphicBuffer> buffer = texData->GetGraphicBuffer();
 
     EGLDisplay display = egl->Display();
     EGLClientBuffer clientBuffer = buffer->getNativeBuffer();
     EGLint attrs[] = {
         LOCAL_EGL_NONE, LOCAL_EGL_NONE
     };
--- a/gfx/layers/BufferTexture.h
+++ b/gfx/layers/BufferTexture.h
@@ -51,17 +51,17 @@ public:
   virtual bool BorrowMappedData(MappedTextureData& aMap) override;
 
   virtual bool BorrowMappedYCbCrData(MappedYCbCrTextureData& aMap) override;
 
   virtual bool SupportsMoz2D() const override;
 
   virtual bool HasInternalBuffer() const override { return true; }
 
-  // use ClientTexture's default implementation
+  // use TextureClient's default implementation
   virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override;
 
 protected:
   virtual uint8_t* GetBuffer() = 0;
   virtual size_t GetBufferSize() = 0;
 
   BufferTextureData(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, gfx::BackendType aMoz2DBackend)
   : mSize(aSize)
--- a/gfx/layers/D3D9SurfaceImage.cpp
+++ b/gfx/layers/D3D9SurfaceImage.cpp
@@ -212,17 +212,17 @@ D3D9RecycleAllocator::Allocate(gfx::Surf
                                TextureFlags aTextureFlags,
                                TextureAllocationFlags aAllocFlags)
 {
   TextureData* data = DXGID3D9TextureData::Create(aSize, aFormat, aTextureFlags, mDevice);
   if (!data) {
     return nullptr;
   }
 
-  return MakeAndAddRef<ClientTexture>(data, aTextureFlags, mSurfaceAllocator);
+  return MakeAndAddRef<TextureClient>(data, aTextureFlags, mSurfaceAllocator);
 }
 
 already_AddRefed<TextureClient>
 D3D9RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat,
                                             const gfx::IntSize& aSize)
 {
   return CreateOrRecycle(aFormat, aSize, BackendSelector::Content,
                          TextureFlags::DEFAULT);
--- a/gfx/layers/GrallocImages.cpp
+++ b/gfx/layers/GrallocImages.cpp
@@ -81,17 +81,17 @@ GrallocImage::SetData(const Data& aData)
                                                              GraphicBuffer::USAGE_HW_TEXTURE,
                                                            allocator
   );
 
   if (!texData) {
     return false;
   }
 
-  mTextureClient = new ClientTexture(texData, TextureFlags::DEFAULT, allocator);
+  mTextureClient = new TextureClient(texData, TextureFlags::DEFAULT, allocator);
   sp<GraphicBuffer> graphicBuffer = texData->GetGraphicBuffer();
 
   void* vaddr;
   if (graphicBuffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN,
                           &vaddr) != OK) {
     return false;
   }
 
--- a/gfx/layers/basic/TextureClientX11.cpp
+++ b/gfx/layers/basic/TextureClientX11.cpp
@@ -24,17 +24,17 @@ namespace layers {
 already_AddRefed<TextureClient>
 CreateX11TextureClient(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                        TextureFlags aFlags, ISurfaceAllocator* aAllocator)
 {
   TextureData* data = X11TextureData::Create(aSize, aFormat, aFlags, aAllocator);
   if (!data) {
     return nullptr;
   }
-  return MakeAndAddRef<ClientTexture>(data, aFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(data, aFlags, aAllocator);
 }
 
 X11TextureData::X11TextureData(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                                bool aClientDeallocation, bool aIsCrossProcess,
                                gfxXlibSurface* aSurface)
 : mSize(aSize)
 , mFormat(aFormat)
 , mSurface(aSurface)
--- a/gfx/layers/client/CompositableClient.cpp
+++ b/gfx/layers/client/CompositableClient.cpp
@@ -220,17 +220,17 @@ CompositableClient::CreateTextureClientF
                                          aFormat, aSize, aSelector,
                                          aTextureFlags | mTextureFlags,
                                          aAllocFlags);
 }
 
 bool
 CompositableClient::AddTextureClient(TextureClient* aClient)
 {
-  if(!aClient || !aClient->IsAllocated()) {
+  if(!aClient) {
     return false;
   }
   aClient->SetAddedToCompositableClient();
   return aClient->InitIPDLActor(mForwarder);
 }
 
 void
 CompositableClient::ClearCachedResources()
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -188,43 +188,34 @@ TextureChild::ActorDestroy(ActorDestroyR
   if (mTextureClient) {
     mTextureClient->mActor = nullptr;
     mTextureClient->mAllocator = nullptr;
   }
   mWaitForRecycle = nullptr;
   mKeep = nullptr;
 }
 
-ClientTexture::ClientTexture(TextureData* aData, TextureFlags aFlags, ISurfaceAllocator* aAllocator)
-: TextureClient(aAllocator, aFlags)
-, mData(aData)
-, mOpenMode(OpenMode::OPEN_NONE)
-#ifdef DEBUG
-, mExpectedDtRefs(0)
-#endif
-, mIsLocked(false)
-{}
 
 bool
-ClientTexture::Lock(OpenMode aMode)
+TextureClient::Lock(OpenMode aMode)
 {
   MOZ_ASSERT(mValid);
   MOZ_ASSERT(!mIsLocked);
   if (mIsLocked) {
     return mOpenMode == aMode;
   }
 
   mIsLocked = mData->Lock(aMode, mReleaseFenceHandle.IsValid() ? &mReleaseFenceHandle : nullptr);
   mOpenMode = aMode;
 
   return mIsLocked;
 }
 
 void
-ClientTexture::Unlock()
+TextureClient::Unlock()
 {
   MOZ_ASSERT(mValid);
   MOZ_ASSERT(mIsLocked);
   if (!mIsLocked) {
     return;
   }
 
   if (mBorrowedDrawTarget) {
@@ -243,54 +234,54 @@ ClientTexture::Unlock()
   }
 
   mData->Unlock();
   mIsLocked = false;
   mOpenMode = OpenMode::OPEN_NONE;
 }
 
 bool
-ClientTexture::HasInternalBuffer() const
+TextureClient::HasInternalBuffer() const
 {
   MOZ_ASSERT(mValid);
   return mData->HasInternalBuffer();
 }
 
 gfx::IntSize
-ClientTexture::GetSize() const
+TextureClient::GetSize() const
 {
   MOZ_ASSERT(mValid);
   return mData->GetSize();
 }
 
 gfx::SurfaceFormat
-ClientTexture::GetFormat() const
+TextureClient::GetFormat() const
 {
   MOZ_ASSERT(mValid);
   return mData->GetFormat();
 }
 
-ClientTexture::~ClientTexture()
+TextureClient::~TextureClient()
 {
   if (ShouldDeallocateInDestructor()) {
     mData->Deallocate(mAllocator);
   } else {
     mData->Forget(mAllocator);
   }
   delete mData;
 }
 
 void
-ClientTexture::FinalizeOnIPDLThread()
+TextureClient::FinalizeOnIPDLThread()
 {
   mData->FinalizeOnIPDLThread(this);
 }
 
 void
-ClientTexture::UpdateFromSurface(gfx::SourceSurface* aSurface)
+TextureClient::UpdateFromSurface(gfx::SourceSurface* aSurface)
 {
   MOZ_ASSERT(mValid);
   MOZ_ASSERT(mIsLocked);
   MOZ_ASSERT(aSurface);
 
   // XXX - It would be better to first try the DrawTarget approach and fallback
   // to the backend-specific implementation because the latter will usually do
   // an expensive read-back + cpu-side copy if the texture is on the gpu.
@@ -305,34 +296,34 @@ ClientTexture::UpdateFromSurface(gfx::So
     MOZ_ASSERT(dt);
     if (dt) {
       dt->CopySurface(aSurface,
                       gfx::IntRect(gfx::IntPoint(0, 0), aSurface->GetSize()),
                       gfx::IntPoint(0, 0));
       return;
     }
   }
-  NS_WARNING("ClientTexture::UpdateFromSurface failed");
+  NS_WARNING("TextureClient::UpdateFromSurface failed");
 }
 
 
 already_AddRefed<TextureClient>
-ClientTexture::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const
+TextureClient::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const
 {
   MOZ_ASSERT(mValid);
   TextureData* data = mData->CreateSimilar(mAllocator, aFlags, aAllocFlags);
   if (!data) {
     return nullptr;
   }
 
-  return MakeAndAddRef<ClientTexture>(data, aFlags, mAllocator);
+  return MakeAndAddRef<TextureClient>(data, aFlags, mAllocator);
 }
 
 gfx::DrawTarget*
-ClientTexture::BorrowDrawTarget()
+TextureClient::BorrowDrawTarget()
 {
   MOZ_ASSERT(mValid);
   MOZ_ASSERT(mIsLocked);
   // TODO- We can't really assert that at the moment because there is code that Borrows
   // the DrawTarget, just to get a snapshot, which is legit in term of OpenMode
   // but we should have a way to get a SourceSurface directly instead.
   //MOZ_ASSERT(mOpenMode & OpenMode::OPEN_WRITE);
 
@@ -350,46 +341,46 @@ ClientTexture::BorrowDrawTarget()
     mExpectedDtRefs = mBorrowedDrawTarget ? mBorrowedDrawTarget->refCount() : 0;
 #endif
   }
 
   return mBorrowedDrawTarget;
 }
 
 bool
-ClientTexture::BorrowMappedData(MappedTextureData& aMap)
+TextureClient::BorrowMappedData(MappedTextureData& aMap)
 {
   MOZ_ASSERT(mValid);
 
   // TODO - SharedRGBImage just accesses the buffer without properly locking
   // the texture. It's bad.
   //MOZ_ASSERT(mIsLocked);
   //if (!mIsLocked) {
   //  return nullptr;
   //}
 
   return mData->BorrowMappedData(aMap);
 }
 
 bool
-ClientTexture::BorrowMappedYCbCrData(MappedYCbCrTextureData& aMap)
+TextureClient::BorrowMappedYCbCrData(MappedYCbCrTextureData& aMap)
 {
   MOZ_ASSERT(mValid);
   return mData->BorrowMappedYCbCrData(aMap);
 }
 
 bool
-ClientTexture::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
+TextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
 {
   MOZ_ASSERT(mValid);
   return mData->Serialize(aOutDescriptor);
 }
 
 void
-ClientTexture::WaitForBufferOwnership(bool aWaitReleaseFence)
+TextureClient::WaitForBufferOwnership(bool aWaitReleaseFence)
 {
   if (mRemoveFromCompositableWaiter) {
     mRemoveFromCompositableWaiter->WaitComplete();
     mRemoveFromCompositableWaiter = nullptr;
   }
 
   if (aWaitReleaseFence && mReleaseFenceHandle.IsValid()) {
     mData->WaitForFence(&mReleaseFenceHandle);
@@ -579,28 +570,28 @@ TextureClient::CreateForDrawing(Composit
       moz2DBackend == gfx::BackendType::CAIRO &&
       aAllocator->IsSameProcess() &&
       aSize.width <= maxTextureSize &&
       aSize.height <= maxTextureSize &&
       NS_IsMainThread()) {
     if (gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
       TextureData* data = D3D9TextureData::Create(aSize, aFormat, aAllocFlags);
       if (data) {
-        return MakeAndAddRef<ClientTexture>(data, aTextureFlags, aAllocator);
+        return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
       }
     }
   }
 
   if (!texture && aFormat == SurfaceFormat::B8G8R8X8 &&
       aAllocator->IsSameProcess() &&
       moz2DBackend == gfx::BackendType::CAIRO &&
       NS_IsMainThread()) {
     TextureData* data = DIBTextureData::Create(aSize, aFormat, aAllocator);
     if (data) {
-      return MakeAndAddRef<ClientTexture>(data, aTextureFlags, aAllocator);
+      return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
     }
   }
 #endif
 
 #ifdef MOZ_X11
   gfxSurfaceType type =
     gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
 
@@ -630,30 +621,16 @@ TextureClient::CreateForDrawing(Composit
 #ifdef MOZ_WIDGET_GONK
   texture = CreateGrallocTextureClientForDrawing(aSize, aFormat, moz2DBackend,
                                                  aTextureFlags, aAllocator);
   if (texture) {
     return texture.forget();
   }
 #endif
 
-  MOZ_ASSERT(!texture || texture->CanExposeDrawTarget(), "texture cannot expose a DrawTarget?");
-
-  if (texture && texture->AllocateForSurface(aSize, aAllocFlags)) {
-    return texture.forget();
-  }
-
-  if (aAllocFlags & ALLOC_DISALLOW_BUFFERTEXTURECLIENT) {
-    return nullptr;
-  }
-
-  if (texture) {
-    NS_WARNING("Failed to allocate a TextureClient, falling back to BufferTextureClient.");
-  }
-
   // Can't do any better than a buffer texture client.
   return TextureClient::CreateForRawBufferAccess(aAllocator, aFormat, aSize,
                                                  moz2DBackend, aTextureFlags, aAllocFlags);
 }
 
 // static
 already_AddRefed<TextureClient>
 TextureClient::CreateForRawBufferAccess(ISurfaceAllocator* aAllocator,
@@ -674,17 +651,17 @@ TextureClient::CreateForRawBufferAccess(
 
   TextureData* texData = BufferTextureData::Create(aSize, aFormat, aMoz2DBackend,
                                                    aTextureFlags, aAllocFlags,
                                                    aAllocator);
   if (!texData) {
     return nullptr;
   }
 
-  return MakeAndAddRef<ClientTexture>(texData, aTextureFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(texData, aTextureFlags, aAllocator);
 }
 
 // static
 already_AddRefed<TextureClient>
 TextureClient::CreateForYCbCr(ISurfaceAllocator* aAllocator,
                               gfx::IntSize aYSize,
                               gfx::IntSize aCbCrSize,
                               StereoMode aStereoMode,
@@ -701,17 +678,17 @@ TextureClient::CreateForYCbCr(ISurfaceAl
   }
 
   TextureData* data = BufferTextureData::CreateForYCbCr(aAllocator, aYSize, aCbCrSize,
                                                         aStereoMode, aTextureFlags);
   if (!data) {
     return nullptr;
   }
 
-  return MakeAndAddRef<ClientTexture>(data, aTextureFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
 }
 
 // static
 already_AddRefed<TextureClient>
 TextureClient::CreateWithBufferSize(ISurfaceAllocator* aAllocator,
                                     gfx::SurfaceFormat aFormat,
                                     size_t aSize,
                                     TextureFlags aTextureFlags)
@@ -722,36 +699,37 @@ TextureClient::CreateWithBufferSize(ISur
   }
 
   TextureData* data = BufferTextureData::CreateWithBufferSize(aAllocator, aFormat, aSize,
                                                               aTextureFlags);
   if (!data) {
     return nullptr;
   }
 
-  return MakeAndAddRef<ClientTexture>(data, aTextureFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
 }
 
-TextureClient::TextureClient(ISurfaceAllocator* aAllocator, TextureFlags aFlags)
-  : mAllocator(aAllocator)
-  , mFlags(aFlags)
-  , mShared(false)
-  , mValid(true)
-  , mAddedToCompositableClient(false)
+TextureClient::TextureClient(TextureData* aData, TextureFlags aFlags, ISurfaceAllocator* aAllocator)
+: mAllocator(aAllocator)
+, mActor(nullptr)
+, mData(aData)
+, mFlags(aFlags)
+, mOpenMode(OpenMode::OPEN_NONE)
+#ifdef DEBUG
+, mExpectedDtRefs(0)
+#endif
+, mIsLocked(false)
+, mShared(false)
+, mValid(true)
+, mAddedToCompositableClient(false)
 #ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
-  , mPoolTracker(nullptr)
+, mPoolTracker(nullptr)
 #endif
 {}
 
-TextureClient::~TextureClient()
-{
-  // All the destruction code that may lead to virtual method calls must
-  // be in Finalize() which is called just before the destructor.
-}
-
 void
 TextureClient::KeepUntilFullDeallocation(UniquePtr<KeepAlive> aKeep, bool aMainThreadOnly)
 {
   MOZ_ASSERT(mActor);
   MOZ_ASSERT(!mActor->mKeep);
   mActor->mKeep = Move(aKeep);
   mActor->mMainThreadOnly = aMainThreadOnly;
 }
@@ -831,20 +809,16 @@ TextureClient::Finalize()
       actor->GetForwarder()->RemoveTexture(this);
     }
   }
 }
 
 bool
 TextureClient::ShouldDeallocateInDestructor() const
 {
-  if (!IsAllocated()) {
-    return false;
-  }
-
   // If we're meant to be deallocated by the host,
   // but we haven't been shared yet or
   // TextureFlags::DEALLOCATE_CLIENT is set, then we should
   // deallocate on the client instead.
   return !mShared || (GetFlags() & TextureFlags::DEALLOCATE_CLIENT);
 }
 
 void
@@ -935,17 +909,17 @@ SyncObject::CreateSyncObject(SyncHandle 
 }
 
 already_AddRefed<TextureClient>
 TextureClient::CreateWithData(TextureData* aData, TextureFlags aFlags, ISurfaceAllocator* aAllocator)
 {
   if (!aData) {
     return nullptr;
   }
-  return MakeAndAddRef<ClientTexture>(aData, aFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(aData, aFlags, aAllocator);
 }
 
 bool
 MappedYCbCrChannelData::CopyInto(MappedYCbCrChannelData& aDst)
 {
   if (!data || !aDst.data || size != aDst.size) {
     return false;
   }
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -159,16 +159,70 @@ struct MappedYCbCrTextureData {
   bool CopyInto(MappedYCbCrTextureData& aDst)
   {
     return y.CopyInto(aDst.y)
         && cb.CopyInto(aDst.cb)
         && cr.CopyInto(aDst.cr);
   }
 };
 
+class TextureData {
+public:
+  TextureData() { MOZ_COUNT_CTOR(TextureData); }
+
+  virtual ~TextureData() { MOZ_COUNT_DTOR(TextureData); }
+
+  virtual gfx::IntSize GetSize() const = 0;
+
+  virtual gfx::SurfaceFormat GetFormat() const = 0;
+
+  virtual bool Lock(OpenMode aMode, FenceHandle* aFence) = 0;
+
+  virtual void Unlock() = 0;
+
+  virtual bool SupportsMoz2D() const { return false; }
+
+  virtual bool CanExposeMappedData() const { return false; }
+
+  virtual bool HasInternalBuffer() const = 0;
+
+  virtual bool HasSynchronization() const { return false; }
+
+  virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() { return nullptr; }
+
+  virtual bool BorrowMappedData(MappedTextureData&) { return false; }
+
+  virtual bool BorrowMappedYCbCrData(MappedYCbCrTextureData&) { return false; }
+
+  virtual void Deallocate(ISurfaceAllocator* aAllocator) = 0;
+
+  /// Depending on the texture's flags either Deallocate or Forget is called.
+  virtual void Forget(ISurfaceAllocator* aAllocator) {}
+
+  virtual bool Serialize(SurfaceDescriptor& aDescriptor) = 0;
+
+  virtual TextureData*
+  CreateSimilar(ISurfaceAllocator* aAllocator,
+                TextureFlags aFlags = TextureFlags::DEFAULT,
+                TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const { return nullptr; }
+
+  virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) { return false; };
+
+  virtual bool ReadBack(TextureReadbackSink* aReadbackSink) { return false; }
+
+  /// Ideally this should not be exposed and users of TextureClient would use Lock/Unlock
+  /// preoperly but that requires a few changes to SharedSurface and maybe gonk video.
+  virtual void WaitForFence(FenceHandle* aFence) {};
+
+  virtual void SyncWithObject(SyncObject* aFence) {};
+
+  /// Needed until the destruction sequence of TextureClient is revamped.
+  virtual void FinalizeOnIPDLThread(TextureClient*) {}
+};
+
 /**
  * TextureClient is a thin abstraction over texture data that need to be shared
  * between the content process and the compositor process. It is the
  * content-side half of a TextureClient/TextureHost pair. A corresponding
  * TextureHost lives on the compositor-side.
  *
  * TextureClient's primary purpose is to present texture data in a way that is
  * understood by the IPC system. There are two ways to use it:
@@ -186,18 +240,18 @@ struct MappedYCbCrTextureData {
  * responsibility of the compositable (which would use two Texture pairs).
  * In order to send several different buffers to the compositor side, use
  * several TextureClients.
  */
 class TextureClient
   : public AtomicRefCountedWithFinalize<TextureClient>
 {
 public:
-  explicit TextureClient(ISurfaceAllocator* aAllocator,
-                         TextureFlags aFlags = TextureFlags::DEFAULT);
+  explicit TextureClient(TextureData* aData, TextureFlags aFlags, ISurfaceAllocator* aAllocator);
+
   virtual ~TextureClient();
 
   static already_AddRefed<TextureClient>
   CreateWithData(TextureData* aData, TextureFlags aFlags, ISurfaceAllocator* aAllocator);
 
   // Creates and allocates a TextureClient usable with Moz2D.
   static already_AddRefed<TextureClient>
   CreateForDrawing(CompositableForwarder* aAllocator,
@@ -230,50 +284,35 @@ public:
   // providing format and sizes could let us do more optimization.
   static already_AddRefed<TextureClient>
   CreateWithBufferSize(ISurfaceAllocator* aAllocator,
                        gfx::SurfaceFormat aFormat,
                        size_t aSize,
                        TextureFlags aTextureFlags);
 
   // Creates and allocates a TextureClient of the same type.
-  virtual already_AddRefed<TextureClient>
+  already_AddRefed<TextureClient>
   CreateSimilar(TextureFlags aFlags = TextureFlags::DEFAULT,
-                TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const = 0;
-
-  /**
-   * Allocates for a given surface size, taking into account the pixel format
-   * which is part of the state of the TextureClient.
-   *
-   * Does not clear the surface by default, clearing the surface can be done
-   * by passing the CLEAR_BUFFER flag.
-   *
-   * TextureClients that can expose a DrawTarget should override this method.
-   */
-  virtual bool AllocateForSurface(gfx::IntSize aSize,
-                                  TextureAllocationFlags flags = ALLOC_DEFAULT)
-  {
-    return false;
-  }
+                TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const;
 
   /**
    * Locks the shared data, allowing the caller to get access to it.
    *
    * Please always lock/unlock when accessing the shared data.
    * If Lock() returns false, you should not attempt to access the shared data.
    */
-  virtual bool Lock(OpenMode aMode) { return IsValid(); }
+  bool Lock(OpenMode aMode);
 
-  virtual void Unlock() {}
+  void Unlock();
 
-  virtual bool IsLocked() const = 0;
+  bool IsLocked() const { return mIsLocked; }
 
-  virtual bool CanExposeDrawTarget() const { return false; }
+  bool CanExposeDrawTarget() const { return mData->SupportsMoz2D(); }
 
-  virtual bool CanExposeMappedData() const { return false; }
+  bool CanExposeMappedData() const { return mData->CanExposeMappedData(); }
 
   /**
    * Returns a DrawTarget to draw into the TextureClient.
    * This function should never be called when not on the main thread!
    *
    * This must never be called on a TextureClient that is not sucessfully locked.
    * When called several times within one Lock/Unlock pair, this method should
    * return the same DrawTarget.
@@ -291,75 +330,71 @@ public:
    *   // Restrict this code's scope to ensure all references to dt are gone
    *   // when Unlock is called.
    *   DrawTarget* dt = texture->BorrowDrawTarget();
    *   // use the draw target ...
    * }
    * texture->Unlock();
    *
    */
-  virtual gfx::DrawTarget* BorrowDrawTarget() { return nullptr; }
+  gfx::DrawTarget* BorrowDrawTarget();
 
   /**
    * Similar to BorrowDrawTarget but provides direct access to the texture's bits
    * instead of a DrawTarget.
    */
-  virtual bool BorrowMappedData(MappedTextureData&) { return false; }
-  virtual bool BorrowMappedYCbCrData(MappedYCbCrTextureData&) { return false; }
+  bool BorrowMappedData(MappedTextureData&);
+  bool BorrowMappedYCbCrData(MappedYCbCrTextureData&);
 
   /**
    * This function can be used to update the contents of the TextureClient
    * off the main thread.
    */
-  virtual void UpdateFromSurface(gfx::SourceSurface* aSurface) { MOZ_CRASH(); }
+  void UpdateFromSurface(gfx::SourceSurface* aSurface);
 
-  // TextureClients that can expose a DrawTarget should override this method.
-  virtual gfx::SurfaceFormat GetFormat() const
-  {
-    return gfx::SurfaceFormat::UNKNOWN;
-  }
+  virtual gfx::SurfaceFormat GetFormat() const;
 
   /**
    * This method is strictly for debugging. It causes locking and
    * needless copies.
    */
-  virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() {
+  already_AddRefed<gfx::DataSourceSurface> GetAsSurface() {
     Lock(OpenMode::OPEN_READ);
     RefPtr<gfx::SourceSurface> surf = BorrowDrawTarget()->Snapshot();
     RefPtr<gfx::DataSourceSurface> data = surf->GetDataSurface();
     Unlock();
     return data.forget();
   }
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
 
   /**
    * Copies a rectangle from this texture client to a position in aTarget.
    * It is assumed that the necessary locks are in place; so this should at
    * least have a read lock and aTarget should at least have a write lock.
    */
-  virtual bool CopyToTextureClient(TextureClient* aTarget,
-                                   const gfx::IntRect* aRect,
-                                   const gfx::IntPoint* aPoint);
+  bool CopyToTextureClient(TextureClient* aTarget,
+                           const gfx::IntRect* aRect,
+                           const gfx::IntPoint* aPoint);
 
   /**
    * Returns true if this texture has a synchronization mechanism (mutex, fence, etc.).
    * Textures that do not implement synchronization should be immutable or should
    * use immediate uploads (see TextureFlags in CompositorTypes.h)
    * Even if a texture does not implement synchronization, Lock and Unlock need
    * to be used appropriately since the latter are also there to map/numap data.
    */
-  virtual bool HasSynchronization() const { return false; }
+  bool HasSynchronization() const { return false; }
  
   /**
    * Indicates whether the TextureClient implementation is backed by an
    * in-memory buffer. The consequence of this is that locking the
    * TextureClient does not contend with locking the texture on the host side.
    */
-  virtual bool HasInternalBuffer() const = 0;
+  bool HasInternalBuffer() const;
 
   /**
    * Allocate and deallocate a TextureChild actor.
    *
    * TextureChild is an implementation detail of TextureClient that is not
    * exposed to the rest of the code base. CreateIPDLActor and DestroyIPDLActor
    * are for use with the managing IPDL protocols only (so that they can
    * implement AllocPextureChild and DeallocPTextureChild).
@@ -367,19 +402,17 @@ public:
   static PTextureChild* CreateIPDLActor();
   static bool DestroyIPDLActor(PTextureChild* actor);
 
   /**
    * Get the TextureClient corresponding to the actor passed in parameter.
    */
   static TextureClient* AsTextureClient(PTextureChild* actor);
 
-  virtual bool IsAllocated() const = 0;
-
-  virtual gfx::IntSize GetSize() const = 0;
+  gfx::IntSize GetSize() const;
 
   /**
    * TextureFlags contain important information about various aspects
    * of the texture, like how its liferime is managed, and how it
    * should be displayed.
    * See TextureFlags in CompositorTypes.h.
    */
   TextureFlags GetFlags() const { return mFlags; }
@@ -495,17 +528,17 @@ public:
   /**
    * Set AsyncTransactionTracker of RemoveTextureFromCompositableAsync() transaction.
    */
   virtual void SetRemoveFromCompositableWaiter(AsyncTransactionWaiter* aWaiter);
 
   /**
    * This function waits until the buffer is no longer being used.
    */
-  virtual void WaitForBufferOwnership(bool aWaitReleaseFence = true) {}
+  virtual void WaitForBufferOwnership(bool aWaitReleaseFence = true);
 
   /**
    * Track how much of this texture is wasted.
    * For example we might allocate a 256x256 tile but only use 10x10.
    */
    void SetWaste(int aWasteArea) {
      mWasteTracker.Update(aWasteArea, BytesPerPixel(GetFormat()));
    }
@@ -514,33 +547,28 @@ public:
    * This sets the readback sink that this texture is to use. This will
    * receive the data for this texture as soon as it becomes available after
    * texture unlock.
    */
   virtual void SetReadbackSink(TextureReadbackSink* aReadbackSink) {
     mReadbackSink = aReadbackSink;
   }
 
-  virtual void SyncWithObject(SyncObject* aSyncObject) { }
+  void SyncWithObject(SyncObject* aFence) { mData->SyncWithObject(aFence); }
 
-  void MarkShared() {
-    mShared = true;
-  }
+  void MarkShared() { mShared = true; }
 
-  ISurfaceAllocator* GetAllocator()
-  {
-    return mAllocator;
-  }
+  ISurfaceAllocator* GetAllocator() { return mAllocator; }
 
    TextureClientRecycleAllocator* GetRecycleAllocator() { return mRecycleAllocator; }
    void SetRecycleAllocator(TextureClientRecycleAllocator* aAllocator);
 
-  /// If you add new code that uses this funtion, you are probably doing something wrong.
-  virtual TextureData* GetInternalData() { return nullptr; }
-  virtual const TextureData* GetInternalData() const { return nullptr; }
+  /// If you add new code that uses this method, you are probably doing something wrong.
+  TextureData* GetInternalData() { return mData; }
+  const TextureData* GetInternalData() const { return mData; }
 
 private:
   static void TextureClientRecycleCallback(TextureClient* aClient, void* aClosure);
 
   /**
    * Called once, during the destruction of the Texture, on the thread in which
    * texture's reference count reaches 0 (could be any thread).
    *
@@ -548,17 +576,17 @@ private:
    * Must only be called by Release().
    */
   B2G_ACL_EXPORT void Finalize();
 
   /**
    * Called once during the destruction of the texture on the IPDL thread, if
    * the texture is shared on the compositor (otherwise it is not called at all).
    */
-  virtual void FinalizeOnIPDLThread() {}
+  void FinalizeOnIPDLThread();
 
   friend class AtomicRefCountedWithFinalize<TextureClient>;
   friend class gl::SharedSurface_Gralloc;
 protected:
   /**
    * An invalid TextureClient cannot provide access to its shared data
    * anymore. This usually means it will soon be destroyed.
    */
@@ -567,27 +595,36 @@ protected:
   /**
    * Should only be called *once* per texture, in TextureClient::InitIPDLActor.
    * Some texture implementations rely on the fact that the descriptor will be
    * deserialized.
    * Calling ToSurfaceDescriptor again after it has already returned true,
    * or never constructing a TextureHost with aDescriptor may result in a memory
    * leak (see TextureClientD3D9 for example).
    */
-  virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor) = 0;
+  bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor);
+
 
+  RefPtr<ISurfaceAllocator> mAllocator;
   RefPtr<TextureChild> mActor;
-  RefPtr<ISurfaceAllocator> mAllocator;
   RefPtr<TextureClientRecycleAllocator> mRecycleAllocator;
   RefPtr<AsyncTransactionWaiter> mRemoveFromCompositableWaiter;
 
+  TextureData* mData;
+  RefPtr<gfx::DrawTarget> mBorrowedDrawTarget;
+
   TextureFlags mFlags;
   FenceHandle mReleaseFenceHandle;
   FenceHandle mAcquireFenceHandle;
   gl::GfxTextureWasteTracker mWasteTracker;
+
+  OpenMode mOpenMode;
+  DebugOnly<uint32_t> mExpectedDtRefs;
+  bool mIsLocked;
+
   bool mShared;
   bool mValid;
   bool mAddedToCompositableClient;
 
   RefPtr<TextureReadbackSink> mReadbackSink;
 
   friend class TextureChild;
   friend class RemoveTextureFromCompositableTracker;
@@ -596,134 +633,16 @@ protected:
 
 #ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
 public:
   // Pointer to the pool this tile came from.
   TextureClientPool* mPoolTracker;
 #endif
 };
 
-class TextureData {
-public:
-  TextureData() { MOZ_COUNT_CTOR(TextureData); }
-
-  virtual ~TextureData() { MOZ_COUNT_DTOR(TextureData); }
-
-  virtual gfx::IntSize GetSize() const = 0;
-
-  virtual gfx::SurfaceFormat GetFormat() const = 0;
-
-  virtual bool Lock(OpenMode aMode, FenceHandle* aFence) = 0;
-
-  virtual void Unlock() = 0;
-
-  virtual bool SupportsMoz2D() const { return false; }
-
-  virtual bool CanExposeMappedData() const { return false; }
-
-  virtual bool HasInternalBuffer() const = 0;
-
-  virtual bool HasSynchronization() const { return false; }
-
-  virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() { return nullptr; }
-
-  virtual bool BorrowMappedData(MappedTextureData&) { return false; }
-
-  virtual bool BorrowMappedYCbCrData(MappedYCbCrTextureData&) { return false; }
-
-  virtual void Deallocate(ISurfaceAllocator* aAllocator) = 0;
-
-  /// Depending on the texture's flags either Deallocate or Forget is called.
-  virtual void Forget(ISurfaceAllocator* aAllocator) {}
-
-  virtual bool Serialize(SurfaceDescriptor& aDescriptor) = 0;
-
-  virtual TextureData*
-  CreateSimilar(ISurfaceAllocator* aAllocator,
-                TextureFlags aFlags = TextureFlags::DEFAULT,
-                TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const { return nullptr; }
-
-  virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) { return false; };
-
-  virtual bool ReadBack(TextureReadbackSink* aReadbackSink) { return false; }
-
-  /// Ideally this should not be exposed and users of TextureClient would use Lock/Unlock
-  /// preoperly but that requires a few changes to SharedSurface and maybe gonk video.
-  virtual void WaitForFence(FenceHandle* aFence) {};
-
-  virtual void SyncWithObject(SyncObject* aFence) {};
-
-  /// Needed until the destruction sequence of TextureClient is revamped.
-  virtual void FinalizeOnIPDLThread(TextureClient*) {}
-};
-
-/// temporary class that will be merged back into TextureClient when all texture implementations
-/// are based on TextureData.
-class ClientTexture : public TextureClient {
-public:
-  ClientTexture(TextureData* aData, TextureFlags aFlags, ISurfaceAllocator* aAllocator);
-
-  ~ClientTexture();
-
-  virtual bool CanExposeDrawTarget() const override { return mData->SupportsMoz2D(); }
-
-  virtual bool CanExposeMappedData() const override { return mData->CanExposeMappedData(); }
-
-  virtual bool HasInternalBuffer() const override;
-
-  virtual bool HasSynchronization() const { return mData->HasSynchronization(); }
-
-  virtual gfx::IntSize GetSize() const override;
-
-  virtual gfx::SurfaceFormat GetFormat() const override;
-
-  virtual bool Lock(OpenMode aMode) override;
-
-  virtual void Unlock() override;
-
-  virtual bool IsLocked() const override { return mIsLocked; }
-
-  virtual gfx::DrawTarget* BorrowDrawTarget() override;
-
-  virtual bool BorrowMappedData(MappedTextureData&) override;
-
-  virtual bool BorrowMappedYCbCrData(MappedYCbCrTextureData&) override;
-
-  virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) override;
-
-  virtual already_AddRefed<TextureClient>
-  CreateSimilar(TextureFlags aFlags = TextureFlags::DEFAULT,
-                TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
-
-  virtual void UpdateFromSurface(gfx::SourceSurface* aSurface) override;
-
-  // TODO - we should be able to make this implicit and not expose the method.
-  virtual void WaitForBufferOwnership(bool aWaitReleaseFence = true) override;
-
-  virtual void SyncWithObject(SyncObject* aFence) override { mData->SyncWithObject(aFence); }
-
-  // by construction, ClientTexture cannot be created without successful allocation.
-  virtual bool IsAllocated() const override { return true; }
-
-  /// If you add new code that uses this method, you are probably doing something wrong.
-  virtual TextureData* GetInternalData() override { return mData; }
-  virtual const TextureData* GetInternalData() const override { return mData; }
-
-  virtual void FinalizeOnIPDLThread() override;
-
-protected:
-  TextureData* mData;
-  RefPtr<gfx::DrawTarget> mBorrowedDrawTarget;
-  RefPtr<TextureReadbackSink> mReadbackSink;
-
-  OpenMode mOpenMode;
-  DebugOnly<uint32_t> mExpectedDtRefs;
-  bool mIsLocked;
-};
-
 /**
  * Task that releases TextureClient pointer on a specified thread.
  */
 class TextureClientReleaseTask : public Task
 {
 public:
     explicit TextureClientReleaseTask(TextureClient* aClient)
         : mTextureClient(aClient) {
--- a/gfx/layers/client/TextureClientSharedSurface.cpp
+++ b/gfx/layers/client/TextureClientSharedSurface.cpp
@@ -46,17 +46,17 @@ SharedSurfaceTextureData::Serialize(Surf
 {
   return mSurf->ToSurfaceDescriptor(&aOutDescriptor);
 }
 
 
 SharedSurfaceTextureClient::SharedSurfaceTextureClient(SharedSurfaceTextureData* aData,
                                                        TextureFlags aFlags,
                                                        ISurfaceAllocator* aAllocator)
-: ClientTexture(aData, aFlags, aAllocator)
+: TextureClient(aData, aFlags, aAllocator)
 {}
 
 already_AddRefed<SharedSurfaceTextureClient>
 SharedSurfaceTextureClient::Create(UniquePtr<gl::SharedSurface> surf, gl::SurfaceFactory* factory,
                                    ISurfaceAllocator* aAllocator, TextureFlags aFlags)
 {
   if (!surf) {
     return nullptr;
--- a/gfx/layers/client/TextureClientSharedSurface.h
+++ b/gfx/layers/client/TextureClientSharedSurface.h
@@ -54,17 +54,17 @@ public:
 
   virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
 
   virtual void Deallocate(ISurfaceAllocator*) override;
 
   gl::SharedSurface* Surf() const { return mSurf.get(); }
 };
 
-class SharedSurfaceTextureClient : public ClientTexture
+class SharedSurfaceTextureClient : public TextureClient
 {
 public:
   SharedSurfaceTextureClient(SharedSurfaceTextureData* aData,
                              TextureFlags aFlags,
                              ISurfaceAllocator* aAllocator);
 
   static already_AddRefed<SharedSurfaceTextureClient>
   Create(UniquePtr<gl::SharedSurface> surf, gl::SurfaceFactory* factory,
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -437,17 +437,17 @@ already_AddRefed<TextureClient>
 CreateDXGITextureClient(IntSize aSize, SurfaceFormat aFormat,
                         TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags,
                         ISurfaceAllocator* aAllocator)
 {
   TextureData* data = DXGITextureData::Create(aSize, aFormat, aAllocFlags);
   if (!data) {
     return nullptr;
   }
-  return MakeAndAddRef<ClientTexture>(data, aTextureFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
 }
 
 
 DXGITextureData*
 D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat, TextureAllocationFlags aFlags,
                          ID3D11Device* aDevice)
 {
   RefPtr<ID3D11Texture2D> texture11;
@@ -492,17 +492,17 @@ CreateD3D11TextureClientWithDevice(IntSi
                                    TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags,
                                    ID3D11Device* aDevice,
                                    ISurfaceAllocator* aAllocator)
 {
   TextureData* data = D3D11TextureData::Create(aSize, aFormat, aAllocFlags, aDevice);
   if (!data) {
     return nullptr;
   }
-  return MakeAndAddRef<ClientTexture>(data, aTextureFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
 }
 
 TextureData*
 D3D11TextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
                                 TextureFlags aFlags,
                                 TextureAllocationFlags aAllocFlags) const
 {
   return D3D11TextureData::Create(mSize, mFormat, aAllocFlags);
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -355,17 +355,17 @@ CreateGrallocTextureClientForDrawing(gfx
   TextureData* data = GrallocTextureData::CreateForDrawing(aSize, aFormat, aMoz2dBackend,
                                                            aAllocator);
   if (!data) {
     return nullptr;
   }
   if (IsGrallocRBSwapped(aFormat)) {
     aFlags |= TextureFlags::RB_SWAPPED;
   }
-  return MakeAndAddRef<ClientTexture>(data, aFlags, aAllocator);
+  return MakeAndAddRef<TextureClient>(data, aFlags, aAllocator);
 }
 
 // static
 GrallocTextureData*
 GrallocTextureData::CreateForYCbCr(gfx::IntSize aYSize, gfx::IntSize aCbCrSize,
                                    ISurfaceAllocator* aAllocator)
 {
   MOZ_ASSERT(aYSize.width == aCbCrSize.width * 2);
--- a/gfx/layers/opengl/GrallocTextureClient.h
+++ b/gfx/layers/opengl/GrallocTextureClient.h
@@ -84,17 +84,17 @@ public:
   static already_AddRefed<TextureClient>
   TextureClientFromSharedSurface(gl::SharedSurface* abstractSurf, TextureFlags flags);
 
   virtual TextureData*
   CreateSimilar(ISurfaceAllocator* aAllocator,
                 TextureFlags aFlags = TextureFlags::DEFAULT,
                 TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
 
-  // use ClientTexture's default implementation
+  // use TextureClient's default implementation
   virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override;
 
   /// Hold android::MediaBuffer.
   /// MediaBuffer needs to be add refed to keep MediaBuffer alive while the texture
   /// is in use.
   ///
   /// TODO - ideally we should be able to put the MediaBuffer in the texture's
   /// constructor and not expose these methods.
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -263,17 +263,17 @@ TEST(Layers, TextureSerialization) {
     AssertSurfacesEqual(surface, surface);
 
     auto texData = BufferTextureData::Create(surface->GetSize(),
       gfx::ImageFormatToSurfaceFormat(surface->Format()),
       gfx::BackendType::CAIRO, TextureFlags::DEALLOCATE_CLIENT, ALLOC_DEFAULT, nullptr
     );
     ASSERT_TRUE(!!texData);
 
-    RefPtr<TextureClient> client = new ClientTexture(
+    RefPtr<TextureClient> client = new TextureClient(
       texData, TextureFlags::DEALLOCATE_CLIENT, nullptr
     );
 
     TestTextureClientSurface(client, surface);
 
     // XXX - Test more texture client types.
   }
 }
--- a/widget/gonk/nativewindow/GonkBufferQueueJB.cpp
+++ b/widget/gonk/nativewindow/GonkBufferQueueJB.cpp
@@ -426,17 +426,17 @@ status_t GonkBufferQueue::dequeueBuffer(
         ISurfaceAllocator* allocator = ImageBridgeChild::GetSingleton();
         GrallocTextureData* texData = GrallocTextureData::Create(IntSize(w,h), format,
                                                                  gfx::BackendType::NONE, usage,
                                                                  allocator);
         if (!texData) {
             ST_LOGE("dequeueBuffer: failed to alloc gralloc buffer");
             return -ENOMEM;
         }
-        RefPtr<TextureClient> textureClient = new ClientTexture(texData, TextureFlags::DEALLOCATE_CLIENT, allocator);
+        RefPtr<TextureClient> textureClient = new TextureClient(texData, TextureFlags::DEALLOCATE_CLIENT, allocator);
         sp<GraphicBuffer> graphicBuffer = texData->GetGraphicBuffer();
 
         { // Scope for the lock
             Mutex::Autolock lock(mMutex);
 
             if (mAbandoned) {
                 ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
                 return NO_INIT;
--- a/widget/gonk/nativewindow/GonkBufferQueueKK.cpp
+++ b/widget/gonk/nativewindow/GonkBufferQueueKK.cpp
@@ -446,17 +446,17 @@ status_t GonkBufferQueue::dequeueBuffer(
         usage |= GraphicBuffer::USAGE_HW_TEXTURE;
         GrallocTextureData* texData = GrallocTextureData::Create(IntSize(w, h), format,
                                                                  gfx::BackendType::NONE, usage,
                                                                  allocator);
         if (!texData) {
             return -ENOMEM;
         }
 
-        RefPtr<TextureClient> textureClient = new ClientTexture(texData, TextureFlags::DEALLOCATE_CLIENT, allocator);
+        RefPtr<TextureClient> textureClient = new TextureClient(texData, TextureFlags::DEALLOCATE_CLIENT, allocator);
 
         { // Scope for the lock
             Mutex::Autolock lock(mMutex);
 
             if (mAbandoned) {
                 ALOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
                 return NO_INIT;
             }
--- a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
+++ b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
@@ -323,17 +323,17 @@ status_t GonkNativeWindow::dequeueBuffer
         usage |= GraphicBuffer::USAGE_HW_TEXTURE;
         GrallocTextureData* texData = GrallocTextureData::Create(IntSize(w, h), format,
                                                                  gfx::BackendType::NONE, usage,
                                                                  allocator);
         if (!texData) {
             return -ENOMEM;
         }
 
-        RefPtr<TextureClient> textureClient = new ClientTexture(texData, TextureFlags::DEALLOCATE_CLIENT, allocator);
+        RefPtr<TextureClient> textureClient = new TextureClient(texData, TextureFlags::DEALLOCATE_CLIENT, allocator);
 
         { // Scope for the lock
             Mutex::Autolock lock(mMutex);
 
             if (mAbandoned) {
                 CNW_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
                 return NO_INIT;
             }