Backout bug 893301 for b2g bustage r=me
authorNicholas Cameron <ncameron@mozilla.com>
Thu, 28 Nov 2013 12:31:31 +1300
changeset 157882 d49f9fd30c027f9e044c7677c4330c250106b54c
parent 157866 c444703cff15b8b9fd951a91203aaecf273aa207
child 157883 c00e4acb093ee657a1277f089a29f62e1f318de9
push id25726
push usercbook@mozilla.com
push dateThu, 28 Nov 2013 10:47:25 +0000
treeherdermozilla-central@cdca43b7657d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs893301
milestone28.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
Backout bug 893301 for b2g bustage r=me
gfx/layers/CompositorTypes.h
gfx/layers/RotatedBuffer.cpp
gfx/layers/RotatedBuffer.h
gfx/layers/client/ClientThebesLayer.cpp
gfx/layers/client/CompositableClient.cpp
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ContentClient.h
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/composite/CompositableHost.cpp
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/ContentHost.cpp
gfx/layers/composite/ContentHost.h
gfx/layers/composite/ImageHost.cpp
gfx/layers/composite/ImageHost.h
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/ipc/CompositableTransactionParent.cpp
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -59,37 +59,28 @@ const TextureFlags TEXTURE_TILE         
 // from the previous texture.
 const TextureFlags TEXTURE_COPY_PREVIOUS      = 1 << 24;
 // Who is responsible for deallocating the shared data.
 // if TEXTURE_DEALLOCATE_CLIENT is set, the shared data is deallocated on the
 // client side and requires some extra synchronizaion to ensure race-free
 // deallocation.
 // The default behaviour is to deallocate on the host side.
 const TextureFlags TEXTURE_DEALLOCATE_CLIENT  = 1 << 25;
-// The host side is responsible for deallocation, but that may not happen
-// immediately after the client side requests it. Exactly when the texture is
-// deallocated is up to the compositable. The texture must be deallocated by
-// the time the compositable or texture host is destroyed. A texture may not
-// have both TEXTURE_DEALLOCATE_CLIENT and TEXTURE_DEALLOCATE_DEFERRED flags.
-const TextureFlags TEXTURE_DEALLOCATE_DEFERRED  = 1 << 26;
 // After being shared ith the compositor side, an immutable texture is never
 // modified, it can only be read. It is safe to not Lock/Unlock immutable
 // textures.
 const TextureFlags TEXTURE_IMMUTABLE          = 1 << 27;
 // The contents of the texture must be uploaded or copied immediately
 // during the transaction, because the producer may want to write
 // to it again.
 const TextureFlags TEXTURE_IMMEDIATE_UPLOAD   = 1 << 28;
 // The texture is going to be used as part of a double
 // buffered pair, and so we can guarantee that the producer/consumer
 // won't be racing to access its contents.
 const TextureFlags TEXTURE_DOUBLE_BUFFERED    = 1 << 29;
-// We've previously tried a texture and it didn't work for some reason. If there
-// is a fallback available, try that.
-const TextureFlags TEXTURE_ALLOC_FALLBACK     = 1 << 31;
 
 // the default flags
 const TextureFlags TEXTURE_FLAGS_DEFAULT = TEXTURE_FRONT;
 
 static inline bool
 TextureRequiresLocking(TextureFlags aFlags)
 {
   // If we're not double buffered, or uploading
@@ -171,18 +162,16 @@ enum CompositableType
   BUFFER_BRIDGE,          // image bridge protocol
   BUFFER_CONTENT,         // thebes layer interface, single buffering
   BUFFER_CONTENT_DIRECT,  // thebes layer interface, double buffering
   BUFFER_CONTENT_INC,     // thebes layer interface, only sends incremental
                           // updates to a texture on the compositor side.
   BUFFER_TILED,           // tiled thebes layer
   // the new compositable types
   COMPOSITABLE_IMAGE,     // image with single buffering
-  COMPOSITABLE_CONTENT_SINGLE,  // thebes layer interface, single buffering
-  COMPOSITABLE_CONTENT_DOUBLE,  // thebes layer interface, double buffering
   BUFFER_COUNT
 };
 
 /**
  * How the texture host is used for composition,
  */
 enum DeprecatedTextureHostFlags
 {
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -276,82 +276,73 @@ RotatedContentBuffer::GetContextForQuadr
   }
 
   return ctx.forget();
 }
 
 gfxContentType
 RotatedContentBuffer::BufferContentType()
 {
-  if (mDeprecatedBufferProvider) {
-    return mDeprecatedBufferProvider->GetContentType();
+  if (mBufferProvider) {
+    return mBufferProvider->GetContentType();
   }
-  if (mBufferProvider || mDTBuffer) {
-    SurfaceFormat format;
-
-    if (mBufferProvider) {
-      format = mBufferProvider->AsTextureClientDrawTarget()->GetFormat();
-    } else if (mDTBuffer) {
-      format = mDTBuffer->GetFormat();
+  if (mDTBuffer) {
+    switch (mDTBuffer->GetFormat()) {
+    case FORMAT_A8:
+      return GFX_CONTENT_ALPHA;
+    case FORMAT_B8G8R8A8:
+    case FORMAT_R8G8B8A8:
+      return GFX_CONTENT_COLOR_ALPHA;
+    default:
+      return GFX_CONTENT_COLOR;
     }
-
-    return ContentForFormat(format);
   }
   return GFX_CONTENT_SENTINEL;
 }
 
 bool
 RotatedContentBuffer::BufferSizeOkFor(const nsIntSize& aSize)
 {
   return (aSize == mBufferRect.Size() ||
           (SizedToVisibleBounds != mBufferSizePolicy &&
            aSize < mBufferRect.Size()));
 }
 
 bool
 RotatedContentBuffer::EnsureBuffer()
 {
-  if (!mDTBuffer) {
-    if (mDeprecatedBufferProvider) {
-      mDTBuffer = mDeprecatedBufferProvider->LockDrawTarget();
-    } else if (mBufferProvider) {
-      mDTBuffer = mBufferProvider->AsTextureClientDrawTarget()->GetAsDrawTarget();
-    }
+  if (!mDTBuffer && mBufferProvider) {
+    mDTBuffer = mBufferProvider->LockDrawTarget();
   }
 
   NS_WARN_IF_FALSE(mDTBuffer, "no buffer");
   return !!mDTBuffer;
 }
 
 bool
 RotatedContentBuffer::EnsureBufferOnWhite()
 {
-  if (!mDTBufferOnWhite) {
-    if (mDeprecatedBufferProviderOnWhite) {
-      mDTBufferOnWhite = mDeprecatedBufferProviderOnWhite->LockDrawTarget();
-    } else if (mBufferProviderOnWhite) {
-      mDTBufferOnWhite =
-        mBufferProviderOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget();
-    }
+  if (!mDTBufferOnWhite && mBufferProviderOnWhite) {
+    mDTBufferOnWhite = mBufferProviderOnWhite->LockDrawTarget();
   }
 
   NS_WARN_IF_FALSE(mDTBufferOnWhite, "no buffer");
   return mDTBufferOnWhite;
 }
 
 bool
 RotatedContentBuffer::HaveBuffer() const
 {
-  return mDTBuffer || mDeprecatedBufferProvider || mBufferProvider;
+  return mDTBuffer || mBufferProvider;
 }
 
 bool
 RotatedContentBuffer::HaveBufferOnWhite() const
 {
-  return mDTBufferOnWhite || mDeprecatedBufferProviderOnWhite || mBufferProviderOnWhite;
+  return mDTBufferOnWhite || mBufferProviderOnWhite;
 }
 
 static void
 WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
 {
   if (*aRotationPoint < 0) {
     *aRotationPoint += aSize;
   } else if (*aRotationPoint >= aSize) {
--- a/gfx/layers/RotatedBuffer.h
+++ b/gfx/layers/RotatedBuffer.h
@@ -28,17 +28,16 @@ struct nsIntSize;
 namespace mozilla {
 namespace gfx {
 class Matrix;
 }
 
 namespace layers {
 
 class DeprecatedTextureClient;
-class TextureClient;
 class ThebesLayer;
 
 /**
  * This is a cairo/Thebes surface, but with a literal twist. Scrolling
  * causes the layer's visible region to move. We want to keep
  * reusing the same surface if the region size hasn't changed, but we don't
  * want to keep moving the contents of the surface around in memory. So
  * we use a trick.
@@ -153,19 +152,17 @@ public:
    *   fit visible bounds.  May be larger.
    */
   enum BufferSizePolicy {
     SizedToVisibleBounds,
     ContainsVisibleBounds
   };
 
   RotatedContentBuffer(BufferSizePolicy aBufferSizePolicy)
-    : mDeprecatedBufferProvider(nullptr)
-    , mDeprecatedBufferProviderOnWhite(nullptr)
-    , mBufferProvider(nullptr)
+    : mBufferProvider(nullptr)
     , mBufferProviderOnWhite(nullptr)
     , mBufferSizePolicy(aBufferSizePolicy)
   {
     MOZ_COUNT_CTOR(RotatedContentBuffer);
   }
   virtual ~RotatedContentBuffer()
   {
     MOZ_COUNT_DTOR(RotatedContentBuffer);
@@ -174,18 +171,16 @@ public:
   /**
    * Wipe out all retained contents. Call this when the entire
    * buffer becomes invalid.
    */
   void Clear()
   {
     mDTBuffer = nullptr;
     mDTBufferOnWhite = nullptr;
-    mDeprecatedBufferProvider = nullptr;
-    mDeprecatedBufferProviderOnWhite = nullptr;
     mBufferProvider = nullptr;
     mBufferProviderOnWhite = nullptr;
     mBufferRect.SetEmpty();
   }
 
   /**
    * This is returned by BeginPaint. The caller should draw into mContext.
    * mRegionToDraw must be drawn. mRegionToInvalidate has been invalidated
@@ -290,58 +285,33 @@ protected:
    * demand in this code.
    *
    * It's the caller's responsibility to ensure |aClient| is valid
    * for the duration of operations it requests of this
    * RotatedContentBuffer.  It's also the caller's responsibility to
    * unset the provider when inactive, by calling
    * SetBufferProvider(nullptr).
    */
-  void SetDeprecatedBufferProvider(DeprecatedTextureClient* aClient)
+  void SetBufferProvider(DeprecatedTextureClient* aClient)
   {
     // Only this buffer provider can give us a buffer.  If we
     // already have one, something has gone wrong.
-    MOZ_ASSERT((!aClient || !mDTBuffer) && !mBufferProvider);
+    MOZ_ASSERT(!aClient || !mDTBuffer);
 
-    mDeprecatedBufferProvider = aClient;
-    if (!mDeprecatedBufferProvider) {
+    mBufferProvider = aClient;
+    if (!mBufferProvider) {
       mDTBuffer = nullptr;
     } 
   }
   
-  void SetDeprecatedBufferProviderOnWhite(DeprecatedTextureClient* aClient)
+  void SetBufferProviderOnWhite(DeprecatedTextureClient* aClient)
   {
     // Only this buffer provider can give us a buffer.  If we
     // already have one, something has gone wrong.
-    MOZ_ASSERT((!aClient || !mDTBufferOnWhite) && !mBufferProviderOnWhite);
-
-    mDeprecatedBufferProviderOnWhite = aClient;
-    if (!mDeprecatedBufferProviderOnWhite) {
-      mDTBufferOnWhite = nullptr;
-    }
-  }
-
-  // new texture client versions
-  void SetBufferProvider(TextureClient* aClient)
-  {
-    // Only this buffer provider can give us a buffer.  If we
-    // already have one, something has gone wrong.
-    MOZ_ASSERT((!aClient || !mDTBuffer) && !mDeprecatedBufferProvider);
-
-    mBufferProvider = aClient;
-    if (!mBufferProvider) {
-      mDTBuffer = nullptr;
-    }
-  }
-
-  void SetBufferProviderOnWhite(TextureClient* aClient)
-  {
-    // Only this buffer provider can give us a buffer.  If we
-    // already have one, something has gone wrong.
-    MOZ_ASSERT((!aClient || !mDTBufferOnWhite) && !mDeprecatedBufferProviderOnWhite);
+    MOZ_ASSERT(!aClient || !mDTBufferOnWhite);
 
     mBufferProviderOnWhite = aClient;
     if (!mBufferProviderOnWhite) {
       mDTBufferOnWhite = nullptr;
     } 
   }
 
   /**
@@ -374,20 +344,18 @@ protected:
   virtual bool HaveBuffer() const;
   virtual bool HaveBufferOnWhite() const;
 
   /**
    * These members are only set transiently.  They're used to map mDTBuffer
    * when we're using surfaces that require explicit map/unmap. Only one
    * may be used at a time.
    */
-  DeprecatedTextureClient* mDeprecatedBufferProvider;
-  DeprecatedTextureClient* mDeprecatedBufferProviderOnWhite;
-  TextureClient* mBufferProvider;
-  TextureClient* mBufferProviderOnWhite;
+  DeprecatedTextureClient* mBufferProvider;
+  DeprecatedTextureClient* mBufferProviderOnWhite;
 
   BufferSizePolicy      mBufferSizePolicy;
 };
 
 }
 }
 
 #endif /* ROTATEDBUFFER_H_ */
--- a/gfx/layers/client/ClientThebesLayer.cpp
+++ b/gfx/layers/client/ClientThebesLayer.cpp
@@ -101,28 +101,16 @@ ClientThebesLayer::RenderLayer()
     mContentClient->Connect();
     ClientManager()->AsShadowForwarder()->Attach(mContentClient, this);
     MOZ_ASSERT(mContentClient->GetForwarder());
   }
 
   mContentClient->BeginPaint();
   PaintThebes();
   mContentClient->EndPaint();
-  // It is very important that this is called after EndPaint, because destroying
-  // textures is a three stage process:
-  // 1. We are done with the buffer and move it to ContentClient::mOldTextures,
-  // that happens in DestroyBuffers which is may be called indirectly from
-  // PaintThebes.
-  // 2. The content client calls RemoveTextureClient on the texture clients in
-  // mOldTextures and forgets them. They then become invalid. The compositable
-  // client keeps a record of IDs. This happens in EndPaint.
-  // 3. An IPC message is sent to destroy the corresponding texture host. That
-  // happens from OnTransaction.
-  // It is important that these steps happen in order.
-  mContentClient->OnTransaction();
 }
 
 void
 ClientThebesLayer::PaintBuffer(gfxContext* aContext,
                                const nsIntRegion& aRegionToDraw,
                                const nsIntRegion& aExtendedRegionToDraw,
                                const nsIntRegion& aRegionToInvalidate,
                                bool aDidSelfCopy, DrawRegionClip aClip)
--- a/gfx/layers/client/CompositableClient.cpp
+++ b/gfx/layers/client/CompositableClient.cpp
@@ -10,21 +10,18 @@
 #include "mozilla/layers/TextureClient.h"  // for DeprecatedTextureClient, etc
 #include "mozilla/layers/TextureClientOGL.h"
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "gfxASurface.h"                // for gfxContentType
 #ifdef XP_WIN
 #include "mozilla/layers/TextureD3D9.h"
 #include "mozilla/layers/TextureD3D11.h"
 #include "gfxWindowsPlatform.h"
-#include "gfx2DGlue.h"
 #endif
 
-using namespace mozilla::gfx;
-
 namespace mozilla {
 namespace layers {
 
 CompositableClient::CompositableClient(CompositableForwarder* aForwarder)
 : mNextTextureID(1)
 , mCompositableChild(nullptr)
 , mForwarder(aForwarder)
 {
@@ -191,18 +188,18 @@ CompositableClient::CreateDeprecatedText
   MOZ_ASSERT(result->SupportsType(aDeprecatedTextureClientType),
              "Created the wrong texture client?");
   result->SetFlags(GetTextureInfo().mTextureFlags);
 
   return result.forget();
 }
 
 TemporaryRef<BufferTextureClient>
-CompositableClient::CreateBufferTextureClient(SurfaceFormat aFormat,
-                                              TextureFlags aTextureFlags)
+CompositableClient::CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
+                                              uint32_t aTextureFlags)
 {
 // XXX - Once bug 908196 is fixed, we can use gralloc textures here which will
 // improve performances of videos using SharedPlanarYCbCrImage on b2g.
 //#ifdef MOZ_WIDGET_GONK
 //  {
 //    RefPtr<BufferTextureClient> result = new GrallocTextureClientOGL(this,
 //                                                                     aFormat,
 //                                                                     aTextureFlags);
@@ -212,66 +209,25 @@ CompositableClient::CreateBufferTextureC
   if (gfxPlatform::GetPlatform()->PreferMemoryOverShmem()) {
     RefPtr<BufferTextureClient> result = new MemoryTextureClient(this, aFormat, aTextureFlags);
     return result.forget();
   }
   RefPtr<BufferTextureClient> result = new ShmemTextureClient(this, aFormat, aTextureFlags);
   return result.forget();
 }
 
-TemporaryRef<TextureClient>
-CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
-                                                  TextureFlags aTextureFlags)
-{
-  RefPtr<TextureClient> result;
-
-#ifdef XP_WIN
-  LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
-  // XXX[nrc] uncomment once we have new texture clients for windows
-  if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
-      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
-    //result = new TextureClientD3D11(GetForwarder(), GetTextureInfo());
-  }
-  if (parentBackend == LAYERS_D3D9 &&
-      !GetForwarder()->ForwardsToDifferentProcess() &&
-      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
-    // non-DIB textures don't work with alpha, see notes in TextureD3D9.
-    if (ContentForFormat(aFormat) == GFX_CONTENT_COLOR_ALPHA) {
-      //result = new TextureClientDIB(GetForwarder(), GetTextureInfo());
-    } else {
-      //result = new TextureClientD3D9(GetForwarder(), GetTextureInfo());
-    }
-  }
-#endif
-  // Can't do any better than a buffer texture client.
-  if (!result) {
-    result = CreateBufferTextureClient(aFormat, aTextureFlags);
-  }
-
-  MOZ_ASSERT(!result || result->AsTextureClientDrawTarget(),
-             "Not a TextureClientDrawTarget?");
-  return result;
-}
-
-uint64_t
-CompositableClient::NextTextureID()
+bool
+CompositableClient::AddTextureClient(TextureClient* aClient)
 {
   ++mNextTextureID;
   // 0 is always an invalid ID
   if (mNextTextureID == 0) {
     ++mNextTextureID;
   }
-
-  return mNextTextureID;
-}
-
-bool
-CompositableClient::AddTextureClient(TextureClient* aClient)
-{
-  aClient->SetID(NextTextureID());
+  aClient->SetID(mNextTextureID);
   return mForwarder->AddTexture(this, aClient);
 }
 
 void
 CompositableClient::RemoveTextureClient(TextureClient* aClient)
 {
   MOZ_ASSERT(aClient);
   mTexturesToRemove.AppendElement(TextureIDAndFlags(aClient->GetID(),
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -83,22 +83,16 @@ public:
   TemporaryRef<DeprecatedTextureClient>
   CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType,
                                 gfxContentType aContentType = GFX_CONTENT_SENTINEL);
 
   virtual TemporaryRef<BufferTextureClient>
   CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
                             TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
 
-  // If we return a non-null TextureClient, then AsTextureClientDrawTarget will
-  // always be non-null.
-  TemporaryRef<TextureClient>
-  CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
-                                TextureFlags aTextureFlags);
-
   virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
                                       const SurfaceDescriptor& aDescriptor)
   {
     MOZ_CRASH("If you want to call this, you should have implemented it");
   }
 
   /**
    * Establishes the connection with compositor side through IPDL
@@ -169,19 +163,16 @@ public:
   void FlushTexturesToRemoveCallbacks();
 
   /**
    * Our IPDL actor is being destroyed, get rid of any shmem resources now.
    */
   virtual void OnActorDestroy() = 0;
 
 protected:
-  // return the next texture ID
-  uint64_t NextTextureID();
-
   struct TextureIDAndFlags {
     TextureIDAndFlags(uint64_t aID, TextureFlags aFlags)
     : mID(aID), mFlags(aFlags) {}
     uint64_t mID;
     TextureFlags mFlags;
   };
   // The textures to destroy in the next transaction;
   nsTArray<TextureIDAndFlags> mTexturesToRemove;
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -57,32 +57,25 @@ ContentClient::CreateContentClient(Compo
   } else
 #endif
   {
     useDoubleBuffering = LayerManagerComposite::SupportsDirectTexturing() ||
                          backend == LAYERS_BASIC;
   }
 
   if (useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
-    if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
-      return new DeprecatedContentClientDoubleBuffered(aForwarder);
-    } else {
-      return new ContentClientDoubleBuffered(aForwarder);
-    }
+    return new ContentClientDoubleBuffered(aForwarder);
   }
 #ifdef XP_MACOSX
   if (backend == LAYERS_OPENGL) {
     return new ContentClientIncremental(aForwarder);
   }
 #endif
-  if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
-    return new DeprecatedContentClientSingleBuffered(aForwarder);
-  } else {
-    return new ContentClientSingleBuffered(aForwarder);
-  }
+  return new ContentClientSingleBuffered(aForwarder);
+
 }
 
 ContentClientBasic::ContentClientBasic(CompositableForwarder* aForwarder,
                                        BasicLayerManager* aManager)
   : ContentClient(aForwarder)
   , RotatedContentBuffer(ContainsVisibleBounds)
   , mManager(aManager)
 {}
@@ -102,261 +95,61 @@ ContentClientBasic::CreateBuffer(Content
   *aBlackDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
     IntSize(aRect.width, aRect.height),
     ImageFormatToSurfaceFormat(format));
 }
 
 void
 ContentClientRemoteBuffer::DestroyBuffers()
 {
-  if (!mTextureClient) {
+  if (!mDeprecatedTextureClient) {
     return;
   }
 
-  mOldTextures.AppendElement(mTextureClient);
-  mTextureClient = nullptr;
-  if (mTextureClientOnWhite) {
-    mOldTextures.AppendElement(mTextureClientOnWhite);
-    mTextureClientOnWhite = nullptr;
-  }
+  MOZ_ASSERT(mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_READ_WRITE);
+  mDeprecatedTextureClient = nullptr;
+  mDeprecatedTextureClientOnWhite = nullptr;
 
   DestroyFrontBuffer();
+
+  mForwarder->DestroyThebesBuffer(this);
 }
 
 void
 ContentClientRemoteBuffer::BeginPaint()
 {
   // XXX: So we might not have a DeprecatedTextureClient yet.. because it will
   // only be created by CreateBuffer.. which will deliver a locked surface!.
-  if (mTextureClient) {
-    SetBufferProvider(mTextureClient);
+  if (mDeprecatedTextureClient) {
+    SetBufferProvider(mDeprecatedTextureClient);
   }
-  if (mTextureClientOnWhite) {
-    SetBufferProviderOnWhite(mTextureClientOnWhite);
+  if (mDeprecatedTextureClientOnWhite) {
+    SetBufferProviderOnWhite(mDeprecatedTextureClientOnWhite);
   }
 }
 
 void
 ContentClientRemoteBuffer::EndPaint()
 {
   // XXX: We might still not have a texture client if PaintThebes
   // decided we didn't need one yet because the region to draw was empty.
   SetBufferProvider(nullptr);
   SetBufferProviderOnWhite(nullptr);
-  for (size_t i = 0; i < mOldTextures.Length(); ++i) {
-    RemoveTextureClient(mOldTextures[i]);
-  }
-  mOldTextures.Clear();
-
-  if (mTextureClient) {
-    mTextureClient->Unlock();
-  }
-  if (mTextureClientOnWhite) {
-    mTextureClientOnWhite->Unlock();
-  }
-}
-
-bool
-ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr<TextureClient>& aClient,
-                                                          TextureFlags aFlags)
-{
-  aClient = CreateTextureClientForDrawing(mSurfaceFormat,
-                                          mTextureInfo.mTextureFlags | aFlags);
-  if (!aClient) {
-    return false;
-  }
-
-  if (!aClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize)) {
-    aClient = CreateTextureClientForDrawing(mSurfaceFormat,
-                mTextureInfo.mTextureFlags | TEXTURE_ALLOC_FALLBACK | aFlags);
-    if (!aClient) {
-      return false;
-    }
-    if (!aClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize)) {
-      NS_WARNING("Could not allocate texture client");
-      aClient = nullptr;
-      return false;
-    }
-  }
-
-  NS_WARN_IF_FALSE(aClient->IsValid(), "Created an invalid texture client");
-  return true;
-}
-
-void
-ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
-                                               const nsIntRect& aRect,
-                                               uint32_t aFlags)
-{
-  // If we hit this assertion, then it might be due to an empty transaction
-  // followed by a real transaction. Our buffers should be created (but not
-  // painted in the empty transaction) and then painted (but not created) in the
-  // real transaction. That is kind of fragile, and this assert will catch
-  // circumstances where we screw that up, e.g., by unnecessarily recreating our
-  // buffers.
-  NS_ABORT_IF_FALSE(!mIsNewBuffer,
-                    "Bad! Did we create a buffer twice without painting?");
-
-  mIsNewBuffer = true;
-
-  DestroyBuffers();
-
-  mSurfaceFormat = aFormat;
-  mSize = gfx::IntSize(aRect.width, aRect.height);
-  mTextureInfo.mTextureFlags = (aFlags & ~TEXTURE_DEALLOCATE_CLIENT) |
-                               TEXTURE_DEALLOCATE_DEFERRED;
-
-  if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) ||
-      !AddTextureClient(mTextureClient)) {
-    AbortTextureClientCreation();
-    return;
-  }
-
-  if (aFlags & BUFFER_COMPONENT_ALPHA) {
-    if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TEXTURE_ON_WHITE) ||
-        !AddTextureClient(mTextureClientOnWhite)) {
-      AbortTextureClientCreation();
-      return;
-    }
-    mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
-  }
-
-  CreateFrontBuffer(aRect);
-}
-
-void
-ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
-                                        const nsIntRect& aRect,
-                                        uint32_t aFlags,
-                                        RefPtr<gfx::DrawTarget>* aBlackDT,
-                                        RefPtr<gfx::DrawTarget>* aWhiteDT)
-{
-  BuildTextureClients(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType), aRect, aFlags);
-  if (!mTextureClient) {
-    return;
-  }
-
-  *aBlackDT = mTextureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
-  if (aFlags & BUFFER_COMPONENT_ALPHA) {
-    *aWhiteDT = mTextureClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget();
-  }
-}
-
-nsIntRegion
-ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
-                                            const nsIntRegion& aVisibleRegion,
-                                            bool aDidSelfCopy)
-{
-  nsIntRegion updatedRegion;
-  if (mIsNewBuffer || aDidSelfCopy) {
-    // A buffer reallocation clears both buffers. The front buffer has all the
-    // content by now, but the back buffer is still clear. Here, in effect, we
-    // are saying to copy all of the pixels of the front buffer to the back.
-    // Also when we self-copied in the buffer, the buffer space
-    // changes and some changed buffer content isn't reflected in the
-    // draw or invalidate region (on purpose!).  When this happens, we
-    // need to read back the entire buffer too.
-    updatedRegion = aVisibleRegion;
-    mIsNewBuffer = false;
-  } else {
-    updatedRegion = aRegionToDraw;
-  }
-
-  NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()),
-               "Update outside of buffer rect!");
-  NS_ABORT_IF_FALSE(mTextureClient, "should have a back buffer by now");
-
-  return updatedRegion;
-}
-
-void
-ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
-                                   const nsIntRegion& aVisibleRegion,
-                                   bool aDidSelfCopy)
-{
-  nsIntRegion updatedRegion = GetUpdatedRegion(aRegionToDraw,
-                                               aVisibleRegion,
-                                               aDidSelfCopy);
-
-  MOZ_ASSERT(mTextureClient);
-  mForwarder->UseTexture(this, mTextureClient);
-  mForwarder->UpdateTextureRegion(this,
-                                  ThebesBufferData(BufferRect(),
-                                                   BufferRotation()),
-                                  updatedRegion);
-}
-
-void
-ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
-{
-  MOZ_ASSERT(mTextureClient);
-  mFrontAndBackBufferDiffer = true;
-}
-
-void
-ContentClientRemoteBuffer::OnActorDestroy()
-{
-  if (mTextureClient) {
-    mTextureClient->OnActorDestroy();
-  }
-  if (mTextureClientOnWhite) {
-    mTextureClientOnWhite->OnActorDestroy();
-  }
-  for (size_t i = 0; i < mOldTextures.Length(); ++i) {
-    mOldTextures[i]->OnActorDestroy();
-  }
-}
-
-void
-DeprecatedContentClientRemoteBuffer::DestroyBuffers()
-{
-  if (!mDeprecatedTextureClient) {
-    return;
-  }
-
-  mDeprecatedTextureClient = nullptr;
-  mDeprecatedTextureClientOnWhite = nullptr;
-
-  DestroyFrontBuffer();
-
-  mForwarder->DestroyThebesBuffer(this);
-}
-
-void
-DeprecatedContentClientRemoteBuffer::BeginPaint()
-{
-  // XXX: So we might not have a DeprecatedTextureClient yet.. because it will
-  // only be created by CreateBuffer.. which will deliver a locked surface!.
-  if (mDeprecatedTextureClient) {
-    SetDeprecatedBufferProvider(mDeprecatedTextureClient);
-  }
-  if (mDeprecatedTextureClientOnWhite) {
-    SetDeprecatedBufferProviderOnWhite(mDeprecatedTextureClientOnWhite);
-  }
-}
-
-void
-DeprecatedContentClientRemoteBuffer::EndPaint()
-{
-  // XXX: We might still not have a texture client if PaintThebes
-  // decided we didn't need one yet because the region to draw was empty.
-  SetDeprecatedBufferProvider(nullptr);
-  SetDeprecatedBufferProviderOnWhite(nullptr);
   mOldTextures.Clear();
 
   if (mDeprecatedTextureClient) {
     mDeprecatedTextureClient->Unlock();
   }
   if (mDeprecatedTextureClientOnWhite) {
     mDeprecatedTextureClientOnWhite->Unlock();
   }
 }
 
 bool
-DeprecatedContentClientRemoteBuffer::CreateAndAllocateDeprecatedTextureClient(RefPtr<DeprecatedTextureClient>& aClient)
+ContentClientRemoteBuffer::CreateAndAllocateDeprecatedTextureClient(RefPtr<DeprecatedTextureClient>& aClient)
 {
   aClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT, mContentType);
   MOZ_ASSERT(aClient, "Failed to create texture client");
 
   if (!aClient->EnsureAllocated(mSize, mContentType)) {
     aClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, mContentType);
     MOZ_ASSERT(aClient, "Failed to create texture client");
     if (!aClient->EnsureAllocated(mSize, mContentType)) {
@@ -367,17 +160,17 @@ DeprecatedContentClientRemoteBuffer::Cre
     }
   }
 
   MOZ_ASSERT(IsSurfaceDescriptorValid(*aClient->GetDescriptor()));
   return true;
 }
 
 void
-DeprecatedContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType,
+ContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType,
                                                const nsIntRect& aRect,
                                                uint32_t aFlags)
 {
   NS_ABORT_IF_FALSE(!mIsNewBuffer,
                     "Bad! Did we create a buffer twice without painting?");
 
   if (mDeprecatedTextureClient) {
     mOldTextures.AppendElement(mDeprecatedTextureClient);
@@ -404,17 +197,17 @@ DeprecatedContentClientRemoteBuffer::Bui
     mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
   }
 
   CreateFrontBufferAndNotify(aRect);
   mIsNewBuffer = true;
 }
 
 void
-DeprecatedContentClientRemoteBuffer::CreateBuffer(ContentType aType,
+ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
                                         const nsIntRect& aRect,
                                         uint32_t aFlags,
                                         RefPtr<gfx::DrawTarget>* aBlackDT,
                                         RefPtr<gfx::DrawTarget>* aWhiteDT)
 {
   BuildDeprecatedTextureClients(aType, aRect, aFlags);
   if (!mDeprecatedTextureClient) {
     return;
@@ -424,17 +217,17 @@ DeprecatedContentClientRemoteBuffer::Cre
         mDeprecatedTextureClient->BackendType()));
   *aBlackDT = mDeprecatedTextureClient->LockDrawTarget();
   if (aFlags & BUFFER_COMPONENT_ALPHA) {
     *aWhiteDT = mDeprecatedTextureClientOnWhite->LockDrawTarget();
   }
 }
 
 nsIntRegion
-DeprecatedContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
+ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
                                             const nsIntRegion& aVisibleRegion,
                                             bool aDidSelfCopy)
 {
   nsIntRegion updatedRegion;
   if (mIsNewBuffer || aDidSelfCopy) {
     // A buffer reallocation clears both buffers. The front buffer has all the
     // content by now, but the back buffer is still clear. Here, in effect, we
     // are saying to copy all of the pixels of the front buffer to the back.
@@ -451,17 +244,17 @@ DeprecatedContentClientRemoteBuffer::Get
   NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()),
                "Update outside of buffer rect!");
   NS_ABORT_IF_FALSE(mDeprecatedTextureClient, "should have a back buffer by now");
 
   return updatedRegion;
 }
 
 void
-DeprecatedContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
+ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
                                    const nsIntRegion& aVisibleRegion,
                                    bool aDidSelfCopy)
 {
   nsIntRegion updatedRegion = GetUpdatedRegion(aRegionToDraw,
                                                aVisibleRegion,
                                                aDidSelfCopy);
 
   MOZ_ASSERT(mDeprecatedTextureClient);
@@ -472,234 +265,60 @@ DeprecatedContentClientRemoteBuffer::Upd
   LockFrontBuffer();
   mForwarder->UpdateTextureRegion(this,
                                   ThebesBufferData(BufferRect(),
                                                    BufferRotation()),
                                   updatedRegion);
 }
 
 void
-DeprecatedContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
+ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
 {
   MOZ_ASSERT(mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
   MOZ_ASSERT(!mDeprecatedTextureClientOnWhite || mDeprecatedTextureClientOnWhite->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
   MOZ_ASSERT(mDeprecatedTextureClient);
 
   mFrontAndBackBufferDiffer = true;
   mDeprecatedTextureClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
   if (mDeprecatedTextureClientOnWhite) {
     mDeprecatedTextureClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
   }
 }
 
 
 void
-DeprecatedContentClientRemoteBuffer::OnActorDestroy()
+ContentClientRemoteBuffer::OnActorDestroy()
 {
   if (mDeprecatedTextureClient) {
     mDeprecatedTextureClient->OnActorDestroy();
   }
   if (mDeprecatedTextureClientOnWhite) {
     mDeprecatedTextureClientOnWhite->OnActorDestroy();
   }
   for (size_t i = 0; i < mOldTextures.Length(); ++i) {
     mOldTextures[i]->OnActorDestroy();
   }
 }
- 
-void
-ContentClientDoubleBuffered::CreateFrontBuffer(const nsIntRect& aBufferRect)
-{
-  if (!CreateAndAllocateTextureClient(mFrontClient, TEXTURE_ON_BLACK) ||
-      !AddTextureClient(mFrontClient)) {
-    AbortTextureClientCreation();
-    return;
-  }
-  if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
-    if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TEXTURE_ON_WHITE) ||
-        !AddTextureClient(mFrontClientOnWhite)) {
-      AbortTextureClientCreation();
-      return;
-    }
-  }
 
-  mFrontBufferRect = aBufferRect;
-  mFrontBufferRotation = nsIntPoint();
-}
-
-void
-ContentClientDoubleBuffered::DestroyFrontBuffer()
-{
-  MOZ_ASSERT(mFrontClient);
-
-  mOldTextures.AppendElement(mFrontClient);
-  mFrontClient = nullptr;
-  if (mFrontClientOnWhite) {
-    mOldTextures.AppendElement(mFrontClientOnWhite);
-    mFrontClientOnWhite = nullptr;
-  }
-}
-
-void
-ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
-{
-  mFrontUpdatedRegion = aFrontUpdatedRegion;
-
-  RefPtr<TextureClient> oldBack = mTextureClient;
-  mTextureClient = mFrontClient;
-  mFrontClient = oldBack;
-
-  oldBack = mTextureClientOnWhite;
-  mTextureClientOnWhite = mFrontClientOnWhite;
-  mFrontClientOnWhite = oldBack;
-
-  nsIntRect oldBufferRect = mBufferRect;
-  mBufferRect = mFrontBufferRect;
-  mFrontBufferRect = oldBufferRect;
-
-  nsIntPoint oldBufferRotation = mBufferRotation;
-  mBufferRotation = mFrontBufferRotation;
-  mFrontBufferRotation = oldBufferRotation;
-
-  MOZ_ASSERT(mFrontClient);
-
-  ContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
-}
-
-void
-ContentClientDoubleBuffered::SyncFrontBufferToBackBuffer()
-{
-  if (!mFrontAndBackBufferDiffer) {
-    return;
-  }
-  MOZ_ASSERT(mFrontClient);
-
-  MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
-                  this,
-                  mFrontUpdatedRegion.GetBounds().x,
-                  mFrontUpdatedRegion.GetBounds().y,
-                  mFrontUpdatedRegion.GetBounds().width,
-                  mFrontUpdatedRegion.GetBounds().height));
-
-  nsIntRegion updateRegion = mFrontUpdatedRegion;
-
-  // This is a tricky trade off, we're going to get stuff out of our
-  // frontbuffer now, but the next PaintThebes might throw it all (or mostly)
-  // away if the visible region has changed. This is why in reality we want
-  // this code integrated with PaintThebes to always do the optimal thing.
-
-  if (mDidSelfCopy) {
-    mDidSelfCopy = false;
-    // We can't easily draw our front buffer into us, since we're going to be
-    // copying stuff around anyway it's easiest if we just move our situation
-    // to non-rotated while we're at it. If this situation occurs we'll have
-    // hit a self-copy path in PaintThebes before as well anyway.
-    mBufferRect.MoveTo(mFrontBufferRect.TopLeft());
-    mBufferRotation = nsIntPoint();
-    updateRegion = mBufferRect;
-  } else {
-    mBufferRect = mFrontBufferRect;
-    mBufferRotation = mFrontBufferRotation;
-  }
-
-  mIsNewBuffer = false;
-  mFrontAndBackBufferDiffer = false;
-
-  // We need to ensure that we lock these two buffers in the same
-  // order as the compositor to prevent deadlocks.
-  if (!mFrontClient->Lock(OPEN_READ_ONLY)) {
-    return;
-  }
-  if (mFrontClientOnWhite &&
-      !mFrontClientOnWhite->Lock(OPEN_READ_ONLY)) {
-    mFrontClient->Unlock();
-    return;
-  }
-  RefPtr<DrawTarget> dt =
-    mFrontClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
-  RefPtr<DrawTarget> dtOnWhite = mFrontClientOnWhite
-    ? mFrontClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget()
-    : nullptr;
-  RotatedBuffer frontBuffer(dt,
-                            dtOnWhite,
-                            mFrontBufferRect,
-                            mFrontBufferRotation);
-  UpdateDestinationFrom(frontBuffer, updateRegion);
-  mFrontClient->Unlock();
-  if (mFrontClientOnWhite) {
-    mFrontClientOnWhite->Unlock();
-  }
-}
-
-void
-ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
-                                                   const nsIntRegion& aUpdateRegion)
-{
-  nsRefPtr<gfxContext> destCtx =
-    GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK);
-  destCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
-
-  bool isClippingCheap = IsClippingCheap(destCtx, aUpdateRegion);
-  if (isClippingCheap) {
-    gfxUtils::ClipToRegion(destCtx, aUpdateRegion);
-  }
-
-  aSource.DrawBufferWithRotation(destCtx->GetDrawTarget(), BUFFER_BLACK, 1.0, OP_SOURCE);
-
-  if (aSource.HaveBufferOnWhite()) {
-    MOZ_ASSERT(HaveBufferOnWhite());
-    nsRefPtr<gfxContext> destCtx =
-      GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE);
-    destCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
-
-    bool isClippingCheap = IsClippingCheap(destCtx, aUpdateRegion);
-    if (isClippingCheap) {
-      gfxUtils::ClipToRegion(destCtx, aUpdateRegion);
-    }
-
-    aSource.DrawBufferWithRotation(destCtx->GetDrawTarget(), BUFFER_WHITE, 1.0, OP_SOURCE);
-  }
-}
-
-void
-ContentClientDoubleBuffered::OnActorDestroy()
-{
-  if (mTextureClient) {
-    mTextureClient->OnActorDestroy();
-  }
-  if (mTextureClientOnWhite) {
-    mTextureClientOnWhite->OnActorDestroy();
-  }
-  for (size_t i = 0; i < mOldTextures.Length(); ++i) {
-    mOldTextures[i]->OnActorDestroy();
-  }
-  if (mFrontClient) {
-    mFrontClient->OnActorDestroy();
-  }
-  if (mFrontClientOnWhite) {
-    mFrontClientOnWhite->OnActorDestroy();
-  }
-}
-
-DeprecatedContentClientDoubleBuffered::~DeprecatedContentClientDoubleBuffered()
+ContentClientDoubleBuffered::~ContentClientDoubleBuffered()
 {
   if (mDeprecatedTextureClient) {
     MOZ_ASSERT(mFrontClient);
     mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
     mFrontClient->SetDescriptor(SurfaceDescriptor());
   }
   if (mDeprecatedTextureClientOnWhite) {
     MOZ_ASSERT(mFrontClientOnWhite);
     mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
     mFrontClientOnWhite->SetDescriptor(SurfaceDescriptor());
   }
 }
 
 void
-DeprecatedContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
+ContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
 {
   if (!CreateAndAllocateDeprecatedTextureClient(mFrontClient)) {
     mDeprecatedTextureClient->SetFlags(0);
     mDeprecatedTextureClient = nullptr;
     if (mDeprecatedTextureClientOnWhite) {
       mDeprecatedTextureClientOnWhite->SetFlags(0);
       mDeprecatedTextureClientOnWhite = nullptr;
     }
@@ -725,37 +344,37 @@ DeprecatedContentClientDoubleBuffered::C
                                   *mFrontClient->LockSurfaceDescriptor(),
                                   *mDeprecatedTextureClient->LockSurfaceDescriptor(),
                                   mTextureInfo,
                                   mFrontClientOnWhite ? mFrontClientOnWhite->LockSurfaceDescriptor() : nullptr,
                                   mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->LockSurfaceDescriptor() : nullptr);
 }
 
 void
-DeprecatedContentClientDoubleBuffered::DestroyFrontBuffer()
+ContentClientDoubleBuffered::DestroyFrontBuffer()
 {
   MOZ_ASSERT(mFrontClient);
   MOZ_ASSERT(mFrontClient->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
 
   mFrontClient = nullptr;
   mFrontClientOnWhite = nullptr;
 }
 
 void
-DeprecatedContentClientDoubleBuffered::LockFrontBuffer()
+ContentClientDoubleBuffered::LockFrontBuffer()
 {
   MOZ_ASSERT(mFrontClient);
   mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
   if (mFrontClientOnWhite) {
     mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
   }
 }
 
 void
-DeprecatedContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
+ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
 {
   mFrontUpdatedRegion = aFrontUpdatedRegion;
 
   RefPtr<DeprecatedTextureClient> oldBack = mDeprecatedTextureClient;
   mDeprecatedTextureClient = mFrontClient;
   mFrontClient = oldBack;
 
   oldBack = mDeprecatedTextureClientOnWhite;
@@ -771,21 +390,21 @@ DeprecatedContentClientDoubleBuffered::S
   mFrontBufferRotation = oldBufferRotation;
 
   MOZ_ASSERT(mFrontClient);
   mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
   if (mFrontClientOnWhite) {
     mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
   }
 
-  DeprecatedContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
+  ContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
 }
 
 void
-DeprecatedContentClientDoubleBuffered::OnActorDestroy()
+ContentClientDoubleBuffered::OnActorDestroy()
 {
   if (mDeprecatedTextureClient) {
     mDeprecatedTextureClient->OnActorDestroy();
   }
   if (mDeprecatedTextureClientOnWhite) {
     mDeprecatedTextureClientOnWhite->OnActorDestroy();
   }
   for (size_t i = 0; i < mOldTextures.Length(); ++i) {
@@ -818,17 +437,17 @@ struct AutoDeprecatedTextureClient {
     }
     return nullptr;
   }
 private:
   DeprecatedTextureClient* mTexture;
 };
 
 void
-DeprecatedContentClientDoubleBuffered::SyncFrontBufferToBackBuffer()
+ContentClientDoubleBuffered::SyncFrontBufferToBackBuffer()
 {
   mIsNewBuffer = false;
 
   if (!mFrontAndBackBufferDiffer) {
     return;
   }
   MOZ_ASSERT(mFrontClient);
   MOZ_ASSERT(mFrontClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_READ_ONLY);
@@ -874,17 +493,17 @@ DeprecatedContentClientDoubleBuffered::S
                             mFrontBufferRect,
                             mFrontBufferRotation);
   UpdateDestinationFrom(frontBuffer, updateRegion);
 
   mFrontAndBackBufferDiffer = false;
 }
 
 void
-DeprecatedContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
+ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
                                                    const nsIntRegion& aUpdateRegion)
 {
   nsRefPtr<gfxContext> destCtx =
     GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK);
   if (!destCtx) {
     return;
   }
   destCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
@@ -906,65 +525,37 @@ DeprecatedContentClientDoubleBuffered::U
     if (isClippingCheap) {
       gfxUtils::ClipToRegion(destCtx, aUpdateRegion);
     }
 
     aSource.DrawBufferWithRotation(destCtx->GetDrawTarget(), BUFFER_WHITE, 1.0, OP_SOURCE);
   }
 }
 
-void
-ContentClientSingleBuffered::SyncFrontBufferToBackBuffer()
-{
-  if (!mFrontAndBackBufferDiffer) {
-    return;
-  }
-
-  RefPtr<DrawTarget> backBuffer = GetDTBuffer();
-  if (!backBuffer && mTextureClient) {
-    backBuffer = mTextureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
-  }
-
-  RefPtr<DrawTarget> oldBuffer;
-  oldBuffer = SetDTBuffer(backBuffer,
-                          mBufferRect,
-                          mBufferRotation);
-
-  backBuffer = GetDTBufferOnWhite();
-  if (!backBuffer && mTextureClientOnWhite) {
-    backBuffer = mTextureClientOnWhite->AsTextureClientDrawTarget()->GetAsDrawTarget();
-  }
-
-  oldBuffer = SetDTBufferOnWhite(backBuffer);
-
-  mIsNewBuffer = false;
-  mFrontAndBackBufferDiffer = false;
-}
-
-DeprecatedContentClientSingleBuffered::~DeprecatedContentClientSingleBuffered()
+ContentClientSingleBuffered::~ContentClientSingleBuffered()
 {
   if (mDeprecatedTextureClient) {
     mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
   }
   if (mDeprecatedTextureClientOnWhite) {
     mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
   }
 }
 
 void
-DeprecatedContentClientSingleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
+ContentClientSingleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
 {
   mForwarder->CreatedSingleBuffer(this,
                                   *mDeprecatedTextureClient->LockSurfaceDescriptor(),
                                   mTextureInfo,
                                   mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->LockSurfaceDescriptor() : nullptr);
 }
 
 void
-DeprecatedContentClientSingleBuffered::SyncFrontBufferToBackBuffer()
+ContentClientSingleBuffered::SyncFrontBufferToBackBuffer()
 {
   mIsNewBuffer = false;
   if (!mFrontAndBackBufferDiffer) {
     return;
   }
   mFrontAndBackBufferDiffer = false;
 
   DrawTarget* backBuffer = GetDTBuffer();
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -177,127 +177,25 @@ private:
  * compositing side with the create message (send from CreateBuffer) which
  * tells the compositor that TextureClients have been created and that the
  * compositor should assign the corresponding TextureHosts to our corresponding
  * ContentHost.
  *
  * If the size or type of our buffer(s) change(s), then we simply destroy and
  * create them.
  */
-// Version using new texture clients
 class ContentClientRemoteBuffer : public ContentClientRemote
                                 , protected RotatedContentBuffer
 {
   using RotatedContentBuffer::BufferRect;
   using RotatedContentBuffer::BufferRotation;
 public:
   ContentClientRemoteBuffer(CompositableForwarder* aForwarder)
     : ContentClientRemote(aForwarder)
     , RotatedContentBuffer(ContainsVisibleBounds)
-    , mIsNewBuffer(false)
-    , mFrontAndBackBufferDiffer(false)
-    , mSurfaceFormat(gfx::FORMAT_B8G8R8A8)
-  {}
-
-  typedef RotatedContentBuffer::PaintState PaintState;
-  typedef RotatedContentBuffer::ContentType ContentType;
-
-  virtual void Clear() { RotatedContentBuffer::Clear(); }
-  PaintState BeginPaintBuffer(ThebesLayer* aLayer, ContentType aContentType,
-                              uint32_t aFlags)
-  {
-    return RotatedContentBuffer::BeginPaint(aLayer, aContentType, aFlags);
-  }
-
-  /**
-   * Begin/End Paint map a gfxASurface from the texture client
-   * into the buffer of RotatedBuffer. The surface is only
-   * valid when the texture client is locked, so is mapped out
-   * of RotatedContentBuffer when we are done painting.
-   * None of the underlying buffer attributes (rect, rotation)
-   * are affected by mapping/unmapping.
-   */
-  virtual void BeginPaint() MOZ_OVERRIDE;
-  virtual void EndPaint() MOZ_OVERRIDE;
-
-  virtual void Updated(const nsIntRegion& aRegionToDraw,
-                       const nsIntRegion& aVisibleRegion,
-                       bool aDidSelfCopy);
-
-  virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
-
-  // Expose these protected methods from the superclass.
-  virtual const nsIntRect& BufferRect() const
-  {
-    return RotatedContentBuffer::BufferRect();
-  }
-  virtual const nsIntPoint& BufferRotation() const
-  {
-    return RotatedContentBuffer::BufferRotation();
-  }
-
-  virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
-                            RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) MOZ_OVERRIDE;
-
-  virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
-  {
-    return mTextureInfo;
-  }
-
-  virtual void OnActorDestroy() MOZ_OVERRIDE;
-
-protected:
-  void DestroyBuffers();
-
-  virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
-                                       const nsIntRegion& aVisibleRegion,
-                                       bool aDidSelfCopy);
-
-  void BuildTextureClients(gfx::SurfaceFormat aFormat,
-                           const nsIntRect& aRect,
-                           uint32_t aFlags);
-
-  // Create the front buffer for the ContentClient/Host pair if necessary
-  // and notify the compositor that we have created the buffer(s).
-  virtual void CreateFrontBuffer(const nsIntRect& aBufferRect) = 0;
-  virtual void DestroyFrontBuffer() {}
-
-  bool CreateAndAllocateTextureClient(RefPtr<TextureClient>& aClient,
-                                      TextureFlags aFlags = 0);
-
-  virtual void AbortTextureClientCreation()
-  {
-    mTextureClient = nullptr;
-    mTextureClientOnWhite = nullptr;
-    mIsNewBuffer = false;
-  }
-
-  RefPtr<TextureClient> mTextureClient;
-  RefPtr<TextureClient> mTextureClientOnWhite;
-  // keep a record of texture clients we have created and need to keep around
-  // (for RotatedBuffer to access), then unlock and remove them when we are done
-  // painting.
-  nsTArray<RefPtr<TextureClient> > mOldTextures;
-
-  TextureInfo mTextureInfo;
-  bool mIsNewBuffer;
-  bool mFrontAndBackBufferDiffer;
-  gfx::IntSize mSize;
-  gfx::SurfaceFormat mSurfaceFormat;
-};
-
-class DeprecatedContentClientRemoteBuffer : public ContentClientRemote
-                                          , protected RotatedContentBuffer
-{
-  using RotatedContentBuffer::BufferRect;
-  using RotatedContentBuffer::BufferRotation;
-public:
-  DeprecatedContentClientRemoteBuffer(CompositableForwarder* aForwarder)
-    : ContentClientRemote(aForwarder)
-    , RotatedContentBuffer(ContainsVisibleBounds)
     , mDeprecatedTextureClient(nullptr)
     , mIsNewBuffer(false)
     , mFrontAndBackBufferDiffer(false)
     , mContentType(GFX_CONTENT_COLOR_ALPHA)
   {}
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
@@ -334,26 +232,26 @@ public:
   virtual const nsIntPoint& BufferRotation() const
   {
     return RotatedContentBuffer::BufferRotation();
   }
 
   virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
                             RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) MOZ_OVERRIDE;
 
+  void DestroyBuffers();
+
   virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
     return mTextureInfo;
   }
 
   virtual void OnActorDestroy() MOZ_OVERRIDE;
 
 protected:
-  void DestroyBuffers();
-
   virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
                                        const nsIntRegion& aVisibleRegion,
                                        bool aDidSelfCopy);
 
   // create and configure mDeprecatedTextureClient
   void BuildDeprecatedTextureClients(ContentType aType,
                                      const nsIntRect& aRect,
                                      uint32_t aFlags);
@@ -393,70 +291,31 @@ protected:
  * (in SwapBuffers).
  */
 class ContentClientDoubleBuffered : public ContentClientRemoteBuffer
 {
 public:
   ContentClientDoubleBuffered(CompositableForwarder* aFwd)
     : ContentClientRemoteBuffer(aFwd)
   {
-    mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_DOUBLE;
+    mTextureInfo.mCompositableType = BUFFER_CONTENT_DIRECT;
   }
-  virtual ~ContentClientDoubleBuffered() {}
+  ~ContentClientDoubleBuffered();
 
   virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
 
   virtual void SyncFrontBufferToBackBuffer() MOZ_OVERRIDE;
 
-  virtual void OnActorDestroy() MOZ_OVERRIDE;
-
-protected:
-  virtual void CreateFrontBuffer(const nsIntRect& aBufferRect) MOZ_OVERRIDE;
-  virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
-
-private:
-  void UpdateDestinationFrom(const RotatedBuffer& aSource,
-                             const nsIntRegion& aUpdateRegion);
-
-  virtual void AbortTextureClientCreation() MOZ_OVERRIDE
-  {
-    mTextureClient = nullptr;
-    mTextureClientOnWhite = nullptr;
-    mFrontClient = nullptr;
-    mFrontClientOnWhite = nullptr;
-  }
-
-  RefPtr<TextureClient> mFrontClient;
-  RefPtr<TextureClient> mFrontClientOnWhite;
-  nsIntRegion mFrontUpdatedRegion;
-  nsIntRect mFrontBufferRect;
-  nsIntPoint mFrontBufferRotation;
-};
-
-class DeprecatedContentClientDoubleBuffered : public DeprecatedContentClientRemoteBuffer
-{
-public:
-  DeprecatedContentClientDoubleBuffered(CompositableForwarder* aFwd)
-    : DeprecatedContentClientRemoteBuffer(aFwd)
-  {
-    mTextureInfo.mCompositableType = BUFFER_CONTENT_DIRECT;
-  }
-  ~DeprecatedContentClientDoubleBuffered();
-
-  virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
-
-  virtual void SyncFrontBufferToBackBuffer() MOZ_OVERRIDE;
-
-  virtual void OnActorDestroy() MOZ_OVERRIDE;
-
 protected:
   virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) MOZ_OVERRIDE;
   virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
   virtual void LockFrontBuffer() MOZ_OVERRIDE;
 
+  virtual void OnActorDestroy() MOZ_OVERRIDE;
+
 private:
   void UpdateDestinationFrom(const RotatedBuffer& aSource,
                              const nsIntRegion& aUpdateRegion);
 
   RefPtr<DeprecatedTextureClient> mFrontClient;
   RefPtr<DeprecatedTextureClient> mFrontClientOnWhite;
   nsIntRegion mFrontUpdatedRegion;
   nsIntRect mFrontBufferRect;
@@ -472,35 +331,19 @@ private:
  * the compositor.
  */
 class ContentClientSingleBuffered : public ContentClientRemoteBuffer
 {
 public:
   ContentClientSingleBuffered(CompositableForwarder* aFwd)
     : ContentClientRemoteBuffer(aFwd)
   {
-    mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_SINGLE;
-  }
-  virtual ~ContentClientSingleBuffered() {}
-
-  virtual void SyncFrontBufferToBackBuffer() MOZ_OVERRIDE;
-
-protected:
-  virtual void CreateFrontBuffer(const nsIntRect& aBufferRect) MOZ_OVERRIDE {}
-};
-
-class DeprecatedContentClientSingleBuffered : public DeprecatedContentClientRemoteBuffer
-{
-public:
-  DeprecatedContentClientSingleBuffered(CompositableForwarder* aFwd)
-    : DeprecatedContentClientRemoteBuffer(aFwd)
-  {
     mTextureInfo.mCompositableType = BUFFER_CONTENT;    
   }
-  ~DeprecatedContentClientSingleBuffered();
+  ~ContentClientSingleBuffered();
 
   virtual void SyncFrontBufferToBackBuffer() MOZ_OVERRIDE;
 
 protected:
   virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) MOZ_OVERRIDE;
 };
 
 /**
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -316,29 +316,16 @@ BufferTextureClient::AllocateForSurface(
     return false;
   }
   ImageDataSerializer serializer(GetBuffer());
   serializer.InitializeBufferInfo(aSize, mFormat);
   mSize = aSize;
   return true;
 }
 
-TemporaryRef<gfx::DrawTarget>
-BufferTextureClient::GetAsDrawTarget()
-{
-  MOZ_ASSERT(IsValid());
-
-  ImageDataSerializer serializer(GetBuffer());
-  if (!serializer.IsValid()) {
-    return nullptr;
-  }
-
-  return serializer.GetAsDrawTarget();
-}
-
 bool
 BufferTextureClient::UpdateYCbCr(const PlanarYCbCrData& aData)
 {
   MOZ_ASSERT(mFormat == gfx::FORMAT_YUV, "This textureClient can only use YCbCr data");
   MOZ_ASSERT(!IsImmutable());
   MOZ_ASSERT(IsValid());
   MOZ_ASSERT(aData.mCbSkip == aData.mCrSkip);
 
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -55,27 +55,16 @@ class TextureClientSurface
 {
 public:
   virtual bool UpdateSurface(gfxASurface* aSurface) = 0;
   virtual already_AddRefed<gfxASurface> GetAsSurface() = 0;
   virtual bool AllocateForSurface(gfx::IntSize aSize) = 0;
 };
 
 /**
- * Interface for TextureClients that can be updated using a DrawTarget.
- */
-class TextureClientDrawTarget
-{
-public:
-  virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() = 0;
-  virtual gfx::SurfaceFormat GetFormat() const = 0;
-  virtual bool AllocateForSurface(gfx::IntSize aSize) = 0;
-};
-
-/**
  * Interface for TextureClients that can be updated using YCbCr data.
  */
 class TextureClientYCbCr
 {
 public:
   virtual bool UpdateYCbCr(const PlanarYCbCrData& aData) = 0;
   virtual bool AllocateForYCbCr(gfx::IntSize aYSize,
                                 gfx::IntSize aCbCrSize,
@@ -130,17 +119,16 @@ public:
  */
 class TextureClient : public AtomicRefCounted<TextureClient>
 {
 public:
   TextureClient(TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
   virtual ~TextureClient();
 
   virtual TextureClientSurface* AsTextureClientSurface() { return nullptr; }
-  virtual TextureClientDrawTarget* AsTextureClientDrawTarget() { return nullptr; }
   virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; }
 
   /**
    * 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.
    */
@@ -247,18 +235,17 @@ protected:
 
 /**
  * TextureClient that wraps a random access buffer such as a Shmem or raw memory.
  * This class must be inherited to implement the memory allocation and access bits.
  * (see ShmemTextureClient and MemoryTextureClient)
  */
 class BufferTextureClient : public TextureClient
                           , public TextureClientSurface
-                          , public TextureClientYCbCr
-                          , public TextureClientDrawTarget
+                          , TextureClientYCbCr
 {
 public:
   BufferTextureClient(CompositableClient* aCompositable, gfx::SurfaceFormat aFormat,
                       TextureFlags aFlags);
 
   virtual ~BufferTextureClient();
 
   virtual bool IsAllocated() const = 0;
@@ -274,33 +261,27 @@ public:
   virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
 
   virtual bool UpdateSurface(gfxASurface* aSurface) MOZ_OVERRIDE;
 
   virtual already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE;
 
   virtual bool AllocateForSurface(gfx::IntSize aSize) MOZ_OVERRIDE;
 
-  // TextureClientDrawTarget
-
-  virtual TextureClientDrawTarget* AsTextureClientDrawTarget() MOZ_OVERRIDE { return this; }
-
-  virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
-
   // TextureClientYCbCr
 
   virtual TextureClientYCbCr* AsTextureClientYCbCr() MOZ_OVERRIDE { return this; }
 
   virtual bool UpdateYCbCr(const PlanarYCbCrData& aData) MOZ_OVERRIDE;
 
   virtual bool AllocateForYCbCr(gfx::IntSize aYSize,
                                 gfx::IntSize aCbCrSize,
                                 StereoMode aStereoMode) MOZ_OVERRIDE;
 
-  virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
+  gfx::SurfaceFormat GetFormat() const { return mFormat; }
 
   // XXX - Bug 908196 - Make Allocate(uint32_t) and GetBufferSize() protected.
   // these two methods should only be called by methods of BufferTextureClient
   // that are overridden in GrallocTextureClient (which does not implement the
   // two methods below)
   virtual bool Allocate(uint32_t aSize) = 0;
 
   virtual size_t GetBufferSize() const = 0;
--- a/gfx/layers/composite/CompositableHost.cpp
+++ b/gfx/layers/composite/CompositableHost.cpp
@@ -54,29 +54,30 @@ CompositableHost::AddTextureHost(Texture
              "A texture is already present with this ID");
   RefPtr<TextureHost> second = mFirstTexture;
   mFirstTexture = aTexture;
   aTexture->SetNextSibling(second);
   aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
 }
 
 void
-CompositableHost::RemoveTextureHost(TextureHost* aTexture)
+CompositableHost::RemoveTextureHost(uint64_t aTextureID)
 {
-  uint64_t textureID = aTexture->GetID();
-  if (mFirstTexture && mFirstTexture->GetID() == textureID) {
+  if (mFirstTexture && mFirstTexture->GetID() == aTextureID) {
+    RefPtr<TextureHost> toRemove = mFirstTexture;
     mFirstTexture = mFirstTexture->GetNextSibling();
-    aTexture->SetNextSibling(nullptr);
+    toRemove->SetNextSibling(nullptr);
   }
   RefPtr<TextureHost> it = mFirstTexture;
   while (it) {
     if (it->GetNextSibling() &&
-        it->GetNextSibling()->GetID() == textureID) {
+        it->GetNextSibling()->GetID() == aTextureID) {
+      RefPtr<TextureHost> toRemove = it->GetNextSibling();
       it->SetNextSibling(it->GetNextSibling()->GetNextSibling());
-      aTexture->SetNextSibling(nullptr);
+      toRemove->SetNextSibling(nullptr);
     }
     it = it->GetNextSibling();
   }
   if (!mFirstTexture && mBackendData) {
     mBackendData->ClearData();
   }
 }
 
@@ -88,25 +89,16 @@ CompositableHost::GetTextureHost(uint64_
     if (it->GetID() == aTextureID) {
       return it;
     }
     it = it->GetNextSibling();
   }
   return nullptr;
 }
 
-void
-CompositableHost::OnActorDestroy()
-{
-  TextureHost* it = mFirstTexture;
-  while (it) {
-    it->OnActorDestroy();
-    it = it->GetNextSibling();
-  }
-}
 
 void
 CompositableHost::SetCompositor(Compositor* aCompositor)
 {
   mCompositor = aCompositor;
   RefPtr<TextureHost> it = mFirstTexture;
   while (!!it) {
     it->SetCompositor(aCompositor);
@@ -135,17 +127,17 @@ CompositableHost::AddMaskEffect(EffectCh
                                 bool aIs3D)
 {
   RefPtr<TextureSource> source;
   RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
   if (oldHost) {
     oldHost->Lock();
     source = oldHost;
   } else {
-    RefPtr<TextureHost> host = GetAsTextureHost();
+    RefPtr<TextureHost> host = GetTextureHost();
     if (host) {
       host->Lock();
       source = host->GetTextureSources();
     }
   }
 
   if (!source) {
     NS_WARNING("Using compositable with no texture host as mask layer");
@@ -162,61 +154,52 @@ CompositableHost::AddMaskEffect(EffectCh
 
 void
 CompositableHost::RemoveMaskEffect()
 {
   RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
   if (oldHost) {
     oldHost->Unlock();
   } else {
-    RefPtr<TextureHost> host = GetAsTextureHost();
+    RefPtr<TextureHost> host = GetTextureHost();
     if (host) {
       host->Unlock();
     }
   }
 }
 
 // implemented in TextureHostOGL.cpp
 TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
 
 /* static */ TemporaryRef<CompositableHost>
 CompositableHost::Create(const TextureInfo& aTextureInfo)
 {
   RefPtr<CompositableHost> result;
   switch (aTextureInfo.mCompositableType) {
-  case BUFFER_IMAGE_SINGLE:
-    result = new DeprecatedImageHostSingle(aTextureInfo);
+  case COMPOSITABLE_IMAGE:
+    result = new ImageHost(aTextureInfo);
     break;
   case BUFFER_IMAGE_BUFFERED:
     result = new DeprecatedImageHostBuffered(aTextureInfo);
     break;
-  case BUFFER_BRIDGE:
-    MOZ_CRASH("Cannot create an image bridge compositable this way");
-    break;
-  case BUFFER_CONTENT:
-    result = new DeprecatedContentHostSingleBuffered(aTextureInfo);
-    break;
-  case BUFFER_CONTENT_DIRECT:
-    result = new DeprecatedContentHostDoubleBuffered(aTextureInfo);
-    break;
-  case BUFFER_CONTENT_INC:
-    result = new ContentHostIncremental(aTextureInfo);
+  case BUFFER_IMAGE_SINGLE:
+    result = new DeprecatedImageHostSingle(aTextureInfo);
     break;
   case BUFFER_TILED:
     result = new TiledContentHost(aTextureInfo);
     break;
-  case COMPOSITABLE_IMAGE:
-    result = new ImageHost(aTextureInfo);
-    break;
-  case COMPOSITABLE_CONTENT_SINGLE:
+  case BUFFER_CONTENT:
     result = new ContentHostSingleBuffered(aTextureInfo);
     break;
-  case COMPOSITABLE_CONTENT_DOUBLE:
+  case BUFFER_CONTENT_DIRECT:
     result = new ContentHostDoubleBuffered(aTextureInfo);
     break;
+  case BUFFER_CONTENT_INC:
+    result = new ContentHostIncremental(aTextureInfo);
+    break;
   default:
     MOZ_CRASH("Unknown CompositableType");
   }
   if (result) {
     RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
     result->SetCompositableBackendSpecificData(data);
   }
   return result;
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -107,17 +107,17 @@ public:
   {
     mBackendData = aBackendData;
   }
 
   /**
    * Our IPDL actor is being destroyed, get rid of any shmem resources now and
    * don't worry about compositing anymore.
    */
-  virtual void OnActorDestroy();
+  virtual void OnActorDestroy() = 0;
 
   // If base class overrides, it should still call the parent implementation
   virtual void SetCompositor(Compositor* aCompositor);
 
   // composite the contents of this buffer host to the compositor's surface
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
@@ -206,17 +206,17 @@ public:
     MOZ_ASSERT(false, "should be implemented or not used");
   }
 
   virtual DeprecatedTextureHost* GetDeprecatedTextureHost() { return nullptr; }
 
   /**
    * Returns the front buffer.
    */
-  virtual TextureHost* GetAsTextureHost() { return nullptr; }
+  virtual TextureHost* GetTextureHost() { return nullptr; }
 
   virtual LayerRenderState GetRenderState() = 0;
 
   virtual void SetPictureRect(const nsIntRect& aPictureRect)
   {
     MOZ_ASSERT(false, "Should have been overridden");
   }
 
@@ -291,23 +291,17 @@ public:
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() { return nullptr; }
 #endif
 
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix) { }
 
   void AddTextureHost(TextureHost* aTexture);
   virtual void UseTextureHost(TextureHost* aTexture) {}
-  // If a texture host is flagged for deferred removal, the compositable will
-  // get an option to run any cleanup code early, that is when it would have
-  // been run if the texture host was not marked deferred.
-  // If the compositable does not cleanup the texture host now, it is the
-  // compositable's responsibility to cleanup the texture host before the
-  // texture host dies.
-  virtual void RemoveTextureHost(TextureHost* aTexture);
+  virtual void RemoveTextureHost(uint64_t aTextureID);
   TextureHost* GetTextureHost(uint64_t aTextureID);
 
 protected:
   TextureInfo mTextureInfo;
   Compositor* mCompositor;
   Layer* mLayer;
   RefPtr<CompositableBackendSpecificData> mBackendData;
   RefPtr<TextureHost> mFirstTexture;
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -28,377 +28,54 @@ namespace layers {
 
 ContentHostBase::ContentHostBase(const TextureInfo& aTextureInfo)
   : ContentHost(aTextureInfo)
   , mPaintWillResample(false)
   , mInitialised(false)
 {}
 
 ContentHostBase::~ContentHostBase()
-{
-  DestroyTextureHost();
-  DestroyTextureHostOnWhite();
-}
-
-TextureHost*
-ContentHostBase::GetAsTextureHost()
-{
-  return mTextureHost;
-}
-
-void
-ContentHostBase::DestroyTextureHost()
-{
-  // The third clause in the if statement checks that we are in fact done with
-  // this texture. We don't want to prematurely deallocate a texture we might
-  // use again or double deallocate. Deallocation will happen in
-  // RemoveTextureHost.
-  // Note that GetTextureHost is linear in the number of texture hosts, but as
-  // long as that number is small (I expect a maximum of 6 for now) then it
-  // should be ok.
-  if (mTextureHost &&
-      mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED &&
-      !GetTextureHost(mTextureHost->GetID())) {
-    MOZ_ASSERT(!(mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
-    mTextureHost->DeallocateSharedData();
-  }
-  mTextureHost = nullptr;
-}
-
-void
-ContentHostBase::DestroyTextureHostOnWhite()
-{
-  if (mTextureHostOnWhite &&
-      mTextureHostOnWhite->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED &&
-      !GetTextureHost(mTextureHostOnWhite->GetID())) {
-    MOZ_ASSERT(!(mTextureHostOnWhite->GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
-    mTextureHostOnWhite->DeallocateSharedData();
-  }
-  mTextureHostOnWhite = nullptr;
-}
-
-void
-ContentHostBase::RemoveTextureHost(TextureHost* aTexture)
-{
-  if ((aTexture->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED) &&
-      !(mTextureHost && mTextureHost == aTexture) &&
-      !(mTextureHostOnWhite && mTextureHostOnWhite == aTexture)) {
-    MOZ_ASSERT(!(aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
-    aTexture->DeallocateSharedData();
-  }
-
-  CompositableHost::RemoveTextureHost(aTexture);
-}
-
-class MOZ_STACK_CLASS AutoLockTextureHost
-{
-public:
-  AutoLockTextureHost(TextureHost* aHost)
-    : mHost(aHost)
-  {
-    mLockSuccess = mHost ? mHost->Lock() : true;
-  }
-
-  ~AutoLockTextureHost()
-  {
-    if (mHost) {
-      mHost->Unlock();
-    }
-  }
-
-  bool IsValid()
-  {
-    return mLockSuccess;
-  }
-
-private:
-  TextureHost* mHost;
-  bool mLockSuccess;
-};
-
-void
-ContentHostBase::Composite(EffectChain& aEffectChain,
-                           float aOpacity,
-                           const gfx::Matrix4x4& aTransform,
-                           const Filter& aFilter,
-                           const Rect& aClipRect,
-                           const nsIntRegion* aVisibleRegion,
-                           TiledLayerProperties* aLayerProperties)
-{
-  NS_ASSERTION(aVisibleRegion, "Requires a visible region");
-
-  AutoLockTextureHost lock(mTextureHost);
-  AutoLockTextureHost lockOnWhite(mTextureHostOnWhite);
-
-  if (!mTextureHost ||
-      !lock.IsValid() ||
-      !lockOnWhite.IsValid()) {
-    return;
-  }
-
-  RefPtr<NewTextureSource> source = mTextureHost->GetTextureSources();
-  RefPtr<NewTextureSource> sourceOnWhite = mTextureHostOnWhite
-                                             ? mTextureHostOnWhite->GetTextureSources()
-                                             : nullptr;
-  if (!source) {
-    return;
-  }
-  RefPtr<TexturedEffect> effect =
-    CreateTexturedEffect(source, sourceOnWhite, aFilter);
-
-  aEffectChain.mPrimaryEffect = effect;
-
-  nsIntRegion tmpRegion;
-  const nsIntRegion* renderRegion;
-  if (PaintWillResample()) {
-    // If we're resampling, then the texture image will contain exactly the
-    // entire visible region's bounds, and we should draw it all in one quad
-    // to avoid unexpected aliasing.
-    tmpRegion = aVisibleRegion->GetBounds();
-    renderRegion = &tmpRegion;
-  } else {
-    renderRegion = aVisibleRegion;
-  }
-
-  nsIntRegion region(*renderRegion);
-  nsIntPoint origin = GetOriginOffset();
-  // translate into TexImage space, buffer origin might not be at texture (0,0)
-  region.MoveBy(-origin);
-
-  // Figure out the intersecting draw region
-  gfx::IntSize texSize = source->GetSize();
-  nsIntRect textureRect = nsIntRect(0, 0, texSize.width, texSize.height);
-  textureRect.MoveBy(region.GetBounds().TopLeft());
-  nsIntRegion subregion;
-  subregion.And(region, textureRect);
-  if (subregion.IsEmpty()) {
-    // Region is empty, nothing to draw
-    return;
-  }
-
-  nsIntRegion screenRects;
-  nsIntRegion regionRects;
-
-  // Collect texture/screen coordinates for drawing
-  nsIntRegionRectIterator iter(subregion);
-  while (const nsIntRect* iterRect = iter.Next()) {
-    nsIntRect regionRect = *iterRect;
-    nsIntRect screenRect = regionRect;
-    screenRect.MoveBy(origin);
-
-    screenRects.Or(screenRects, screenRect);
-    regionRects.Or(regionRects, regionRect);
-  }
-
-  TileIterator* tileIter = source->AsTileIterator();
-  TileIterator* iterOnWhite = nullptr;
-  if (tileIter) {
-    tileIter->BeginTileIteration();
-  }
-
-  if (mTextureHostOnWhite) {
-    iterOnWhite = sourceOnWhite->AsTileIterator();
-    MOZ_ASSERT(!tileIter || tileIter->GetTileCount() == iterOnWhite->GetTileCount(),
-               "Tile count mismatch on component alpha texture");
-    if (iterOnWhite) {
-      iterOnWhite->BeginTileIteration();
-    }
-  }
-
-  bool usingTiles = (tileIter && tileIter->GetTileCount() > 1);
-  do {
-    if (iterOnWhite) {
-      MOZ_ASSERT(iterOnWhite->GetTileRect() == tileIter->GetTileRect(),
-                 "component alpha textures should be the same size.");
-    }
-
-    nsIntRect texRect = tileIter ? tileIter->GetTileRect()
-                                 : nsIntRect(0, 0,
-                                             texSize.width,
-                                             texSize.height);
-
-    // Draw texture. If we're using tiles, we do repeating manually, as texture
-    // repeat would cause each individual tile to repeat instead of the
-    // compound texture as a whole. This involves drawing at most 4 sections,
-    // 2 for each axis that has texture repeat.
-    for (int y = 0; y < (usingTiles ? 2 : 1); y++) {
-      for (int x = 0; x < (usingTiles ? 2 : 1); x++) {
-        nsIntRect currentTileRect(texRect);
-        currentTileRect.MoveBy(x * texSize.width, y * texSize.height);
-
-        nsIntRegionRectIterator screenIter(screenRects);
-        nsIntRegionRectIterator regionIter(regionRects);
-
-        const nsIntRect* screenRect;
-        const nsIntRect* regionRect;
-        while ((screenRect = screenIter.Next()) &&
-               (regionRect = regionIter.Next())) {
-          nsIntRect tileScreenRect(*screenRect);
-          nsIntRect tileRegionRect(*regionRect);
-
-          // When we're using tiles, find the intersection between the tile
-          // rect and this region rect. Tiling is then handled by the
-          // outer for-loops and modifying the tile rect.
-          if (usingTiles) {
-            tileScreenRect.MoveBy(-origin);
-            tileScreenRect = tileScreenRect.Intersect(currentTileRect);
-            tileScreenRect.MoveBy(origin);
-
-            if (tileScreenRect.IsEmpty())
-              continue;
-
-            tileRegionRect = regionRect->Intersect(currentTileRect);
-            tileRegionRect.MoveBy(-currentTileRect.TopLeft());
-          }
-          gfx::Rect rect(tileScreenRect.x, tileScreenRect.y,
-                         tileScreenRect.width, tileScreenRect.height);
-
-          effect->mTextureCoords = Rect(Float(tileRegionRect.x) / texRect.width,
-                                        Float(tileRegionRect.y) / texRect.height,
-                                        Float(tileRegionRect.width) / texRect.width,
-                                        Float(tileRegionRect.height) / texRect.height);
-          GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
-          if (usingTiles) {
-            DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT | DIAGNOSTIC_BIGIMAGE;
-            diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
-            GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
-                                             aTransform);
-          }
-        }
-      }
-    }
-
-    if (iterOnWhite) {
-      iterOnWhite->NextTile();
-    }
-  } while (usingTiles && tileIter->NextTile());
-
-  if (tileIter) {
-    tileIter->EndTileIteration();
-  }
-  if (iterOnWhite) {
-    iterOnWhite->EndTileIteration();
-  }
-
-  DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT;
-  diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
-  GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect, aTransform);
-}
-
-
-void
-ContentHostBase::UseTextureHost(TextureHost* aTexture)
-{
-  if (aTexture->GetFlags() & TEXTURE_ON_WHITE) {
-    DestroyTextureHost();
-    mTextureHostOnWhite = aTexture;
-  } else {
-    DestroyTextureHostOnWhite();
-    mTextureHost = aTexture;
-  }
-}
-
-void
-ContentHostBase::SetCompositor(Compositor* aCompositor)
-{
-  CompositableHost::SetCompositor(aCompositor);
-  if (mTextureHost) {
-    mTextureHost->SetCompositor(aCompositor);
-  }
-  if (mTextureHostOnWhite) {
-    mTextureHostOnWhite->SetCompositor(aCompositor);
-  }
-}
-
-#ifdef MOZ_DUMP_PAINTING
-void
-ContentHostBase::Dump(FILE* aFile,
-                      const char* aPrefix,
-                      bool aDumpHtml)
-{
-  if (!aDumpHtml) {
-    return;
-  }
-  if (!aFile) {
-    aFile = stderr;
-  }
-  fprintf(aFile, "<ul>");
-  if (mTextureHost) {
-    fprintf(aFile, "%s", aPrefix);
-    fprintf(aFile, "<li> <a href=");
-    DumpTextureHost(aFile, mTextureHost);
-    fprintf(aFile, "> Front buffer </a></li> ");
-  }
-  if (mTextureHostOnWhite) {
-    fprintf(aFile, "%s", aPrefix);
-    fprintf(aFile, "<li> <a href=");
-    DumpTextureHost(aFile, mTextureHostOnWhite);
-    fprintf(aFile, "> Front buffer on white </a> </li> ");
-  }
-  fprintf(aFile, "</ul>");
-}
-#endif
-
-void
-ContentHostBase::OnActorDestroy()
-{
-  if (mTextureHost) {
-    mTextureHost->OnActorDestroy();
-  }
-  if (mTextureHostOnWhite) {
-    mTextureHostOnWhite->OnActorDestroy();
-  }
-  CompositableHost::OnActorDestroy();
-}
-
-DeprecatedContentHostBase::DeprecatedContentHostBase(const TextureInfo& aTextureInfo)
-  : ContentHost(aTextureInfo)
-  , mPaintWillResample(false)
-  , mInitialised(false)
-{}
-
-DeprecatedContentHostBase::~DeprecatedContentHostBase()
 {}
 
 DeprecatedTextureHost*
-DeprecatedContentHostBase::GetDeprecatedTextureHost()
+ContentHostBase::GetDeprecatedTextureHost()
 {
   return mDeprecatedTextureHost;
 }
 
 void
-DeprecatedContentHostBase::DestroyFrontHost()
+ContentHostBase::DestroyFrontHost()
 {
   MOZ_ASSERT(!mDeprecatedTextureHost || mDeprecatedTextureHost->GetDeAllocator(),
              "We won't be able to destroy our SurfaceDescriptor");
   MOZ_ASSERT(!mDeprecatedTextureHostOnWhite || mDeprecatedTextureHostOnWhite->GetDeAllocator(),
              "We won't be able to destroy our SurfaceDescriptor");
   mDeprecatedTextureHost = nullptr;
   mDeprecatedTextureHostOnWhite = nullptr;
 }
 
 void
-DeprecatedContentHostBase::OnActorDestroy()
+ContentHostBase::OnActorDestroy()
 {
   if (mDeprecatedTextureHost) {
     mDeprecatedTextureHost->OnActorDestroy();
   }
   if (mDeprecatedTextureHostOnWhite) {
     mDeprecatedTextureHostOnWhite->OnActorDestroy();
   }
   if (mNewFrontHost) {
     mNewFrontHost->OnActorDestroy();
   }
   if (mNewFrontHostOnWhite) {
     mNewFrontHostOnWhite->OnActorDestroy();
   }
 }
 
 void
-DeprecatedContentHostBase::Composite(EffectChain& aEffectChain,
+ContentHostBase::Composite(EffectChain& aEffectChain,
                            float aOpacity,
                            const gfx::Matrix4x4& aTransform,
                            const Filter& aFilter,
                            const Rect& aClipRect,
                            const nsIntRegion* aVisibleRegion,
                            TiledLayerProperties* aLayerProperties)
 {
   NS_ASSERTION(aVisibleRegion, "Requires a visible region");
@@ -554,31 +231,31 @@ DeprecatedContentHostBase::Composite(Eff
   }
 
   DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT;
   diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
   GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect, aTransform);
 }
 
 void
-DeprecatedContentHostBase::SetCompositor(Compositor* aCompositor)
+ContentHostBase::SetCompositor(Compositor* aCompositor)
 {
   CompositableHost::SetCompositor(aCompositor);
   if (mDeprecatedTextureHost) {
     mDeprecatedTextureHost->SetCompositor(aCompositor);
   }
   if (mDeprecatedTextureHostOnWhite) {
     mDeprecatedTextureHostOnWhite->SetCompositor(aCompositor);
   }
 }
 
 #ifdef MOZ_DUMP_PAINTING
 
 void
-DeprecatedContentHostBase::Dump(FILE* aFile,
+ContentHostBase::Dump(FILE* aFile,
                       const char* aPrefix,
                       bool aDumpHtml)
 {
   if (!aDumpHtml) {
     return;
   }
   if (!aFile) {
     aFile = stderr;
@@ -596,66 +273,24 @@ DeprecatedContentHostBase::Dump(FILE* aF
     DumpDeprecatedTextureHost(aFile, mDeprecatedTextureHostOnWhite);
     fprintf_stderr(aFile, "> Front buffer on white </a> </li> ");
   }
   fprintf_stderr(aFile, "</ul>");
 }
 
 #endif
 
-void
-ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
-                                        const nsIntRegion& aUpdated,
-                                        const nsIntRegion& aOldValidRegionBack,
-                                        nsIntRegion* aUpdatedRegionBack)
-{
-  aUpdatedRegionBack->SetEmpty();
-
-  if (!mTextureHost) {
-    mInitialised = false;
-    return;
-  }
-
-  // updated is in screen coordinates. Convert it to buffer coordinates.
-  nsIntRegion destRegion(aUpdated);
-  destRegion.MoveBy(-aData.rect().TopLeft());
-
-  // Correct for rotation
-  destRegion.MoveBy(aData.rotation());
-
-  gfxIntSize size = aData.rect().Size();
-  nsIntRect destBounds = destRegion.GetBounds();
-  destRegion.MoveBy((destBounds.x >= size.width) ? -size.width : 0,
-                    (destBounds.y >= size.height) ? -size.height : 0);
-
-  // There's code to make sure that updated regions don't cross rotation
-  // boundaries, so assert here that this is the case
-  MOZ_ASSERT((destBounds.x % size.width) + destBounds.width <= size.width,
-               "updated region lies across rotation boundaries!");
-  MOZ_ASSERT((destBounds.y % size.height) + destBounds.height <= size.height,
-               "updated region lies across rotation boundaries!");
-
-  mTextureHost->Updated(&destRegion);
-  if (mTextureHostOnWhite) {
-    mTextureHostOnWhite->Updated(&destRegion);
-  }
-  mInitialised = true;
-
-  mBufferRect = aData.rect();
-  mBufferRotation = aData.rotation();
-}
-
-DeprecatedContentHostSingleBuffered::~DeprecatedContentHostSingleBuffered()
+ContentHostSingleBuffered::~ContentHostSingleBuffered()
 {
   DestroyTextures();
   DestroyFrontHost();
 }
 
 void
-DeprecatedContentHostSingleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
+ContentHostSingleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
                                              const SurfaceDescriptor& aSurface,
                                              ISurfaceAllocator* aAllocator,
                                              const TextureInfo& aTextureInfo)
 {
   MOZ_ASSERT(aTextureId == TextureFront ||
              aTextureId == TextureOnWhiteFront);
   RefPtr<DeprecatedTextureHost> *newHost =
     (aTextureId == TextureFront) ? &mNewFrontHost : &mNewFrontHostOnWhite;
@@ -668,30 +303,30 @@ DeprecatedContentHostSingleBuffered::Ens
   (*newHost)->SetBuffer(new SurfaceDescriptor(aSurface), aAllocator);
   Compositor* compositor = GetCompositor();
   if (compositor) {
     (*newHost)->SetCompositor(compositor);
   }
 }
 
 void
-DeprecatedContentHostSingleBuffered::DestroyTextures()
+ContentHostSingleBuffered::DestroyTextures()
 {
   MOZ_ASSERT(!mNewFrontHost || mNewFrontHost->GetDeAllocator(),
              "We won't be able to destroy our SurfaceDescriptor");
   MOZ_ASSERT(!mNewFrontHostOnWhite || mNewFrontHostOnWhite->GetDeAllocator(),
              "We won't be able to destroy our SurfaceDescriptor");
   mNewFrontHost = nullptr;
   mNewFrontHostOnWhite = nullptr;
 
   // don't touch mDeprecatedTextureHost, we might need it for compositing
 }
 
 void
-DeprecatedContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
+ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
                                         const nsIntRegion& aUpdated,
                                         const nsIntRegion& aOldValidRegionBack,
                                         nsIntRegion* aUpdatedRegionBack)
 {
   aUpdatedRegionBack->SetEmpty();
 
   if (!mDeprecatedTextureHost && !mNewFrontHost) {
     mInitialised = false;
@@ -735,61 +370,24 @@ DeprecatedContentHostSingleBuffered::Upd
     mDeprecatedTextureHostOnWhite->Update(*mDeprecatedTextureHostOnWhite->LockSurfaceDescriptor(), &destRegion);
   }
   mInitialised = true;
 
   mBufferRect = aData.rect();
   mBufferRotation = aData.rotation();
 }
 
-void
-ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
-                                        const nsIntRegion& aUpdated,
-                                        const nsIntRegion& aOldValidRegionBack,
-                                        nsIntRegion* aUpdatedRegionBack)
-{
-  if (!mTextureHost) {
-    mInitialised = false;
-
-    *aUpdatedRegionBack = aUpdated;
-    return;
-  }
-
-  // We don't need to calculate an update region because we assume that if we
-  // are using double buffering then we have render-to-texture and thus no
-  // upload to do.
-  mTextureHost->Updated();
-  if (mTextureHostOnWhite) {
-    mTextureHostOnWhite->Updated();
-  }
-  mInitialised = true;
-
-  mBufferRect = aData.rect();
-  mBufferRotation = aData.rotation();
-
-  *aUpdatedRegionBack = aUpdated;
-
-  // Save the current valid region of our front buffer, because if
-  // we're double buffering, it's going to be the valid region for the
-  // next back buffer sent back to the renderer.
-  //
-  // NB: we rely here on the fact that mValidRegion is initialized to
-  // empty, and that the first time Swap() is called we don't have a
-  // valid front buffer that we're going to return to content.
-  mValidRegionForNextBackBuffer = aOldValidRegionBack;
-}
-
-DeprecatedContentHostDoubleBuffered::~DeprecatedContentHostDoubleBuffered()
+ContentHostDoubleBuffered::~ContentHostDoubleBuffered()
 {
   DestroyTextures();
   DestroyFrontHost();
 }
 
 void
-DeprecatedContentHostDoubleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
+ContentHostDoubleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
                                              const SurfaceDescriptor& aSurface,
                                              ISurfaceAllocator* aAllocator,
                                              const TextureInfo& aTextureInfo)
 {
   RefPtr<DeprecatedTextureHost> newHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(aSurface.type(),
                                                                aTextureInfo.mDeprecatedTextureHostFlags,
                                                                aTextureInfo.mTextureFlags,
                                                                this);
@@ -819,17 +417,17 @@ DeprecatedContentHostDoubleBuffered::Ens
     mBackHostOnWhite = newHost;
     return;
   }
 
   NS_ERROR("Bad texture identifier");
 }
 
 void
-DeprecatedContentHostDoubleBuffered::DestroyTextures()
+ContentHostDoubleBuffered::DestroyTextures()
 {
   if (mNewFrontHost) {
     MOZ_ASSERT(mNewFrontHost->GetDeAllocator(),
                "We won't be able to destroy our SurfaceDescriptor");
     mNewFrontHost = nullptr;
   }
   if (mNewFrontHostOnWhite) {
     MOZ_ASSERT(mNewFrontHostOnWhite->GetDeAllocator(),
@@ -846,17 +444,17 @@ DeprecatedContentHostDoubleBuffered::Des
                "We won't be able to destroy our SurfaceDescriptor");
     mBackHostOnWhite = nullptr;
   }
 
   // don't touch mDeprecatedTextureHost, we might need it for compositing
 }
 
 void
-DeprecatedContentHostDoubleBuffered::OnActorDestroy()
+ContentHostDoubleBuffered::OnActorDestroy()
 {
   if (mDeprecatedTextureHost) {
     mDeprecatedTextureHost->OnActorDestroy();
   }
   if (mDeprecatedTextureHostOnWhite) {
     mDeprecatedTextureHostOnWhite->OnActorDestroy();
   }
   if (mNewFrontHost) {
@@ -869,17 +467,17 @@ DeprecatedContentHostDoubleBuffered::OnA
     mBackHost->OnActorDestroy();
   }
   if (mBackHostOnWhite) {
     mBackHostOnWhite->OnActorDestroy();
   }
 }
 
 void
-DeprecatedContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
+ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
                                         const nsIntRegion& aUpdated,
                                         const nsIntRegion& aOldValidRegionBack,
                                         nsIntRegion* aUpdatedRegionBack)
 {
   if (!mDeprecatedTextureHost && !mNewFrontHost) {
     mInitialised = false;
 
     *aUpdatedRegionBack = aUpdated;
@@ -1154,41 +752,20 @@ ContentHostIncremental::TextureUpdateReq
   if (mTextureId == TextureFront) {
     aHost->mDeprecatedTextureHost->Update(mDescriptor, &mUpdated, &offset);
   } else {
     aHost->mDeprecatedTextureHostOnWhite->Update(mDescriptor, &mUpdated, &offset);
   }
 }
 
 void
-ContentHostBase::PrintInfo(nsACString& aTo, const char* aPrefix)
+ContentHostSingleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
-  aTo += nsPrintfCString("ContentHost (0x%p)", this);
-
-  AppendToString(aTo, mBufferRect, " [buffer-rect=", "]");
-  AppendToString(aTo, mBufferRotation, " [buffer-rotation=", "]");
-  if (PaintWillResample()) {
-    aTo += " [paint-will-resample]";
-  }
-
-  nsAutoCString pfx(aPrefix);
-  pfx += "  ";
-
-  if (mTextureHost) {
-    aTo += "\n";
-    mTextureHost->PrintInfo(aTo, pfx.get());
-  }
-}
-
-void
-DeprecatedContentHostSingleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
-{
-  aTo += aPrefix;
-  aTo += nsPrintfCString("DeprecatedContentHostSingleBuffered (0x%p)", this);
+  aTo += nsPrintfCString("ContentHostSingleBuffered (0x%p)", this);
 
   AppendToString(aTo, mBufferRect, " [buffer-rect=", "]");
   AppendToString(aTo, mBufferRotation, " [buffer-rotation=", "]");
   if (PaintWillResample()) {
     aTo += " [paint-will-resample]";
   }
 
   nsAutoCString pfx(aPrefix);
@@ -1196,20 +773,20 @@ DeprecatedContentHostSingleBuffered::Pri
 
   if (mDeprecatedTextureHost) {
     aTo += "\n";
     mDeprecatedTextureHost->PrintInfo(aTo, pfx.get());
   }
 }
 
 void
-DeprecatedContentHostDoubleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
+ContentHostDoubleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
-  aTo += nsPrintfCString("DeprecatedContentHostDoubleBuffered (0x%p)", this);
+  aTo += nsPrintfCString("ContentHostDoubleBuffered (0x%p)", this);
 
   AppendToString(aTo, mBufferRect, " [buffer-rect=", "]");
   AppendToString(aTo, mBufferRotation, " [buffer-rotation=", "]");
   if (PaintWillResample()) {
     aTo += " [paint-will-resample]";
   }
 
   nsAutoCString prefix(aPrefix);
@@ -1223,21 +800,21 @@ DeprecatedContentHostDoubleBuffered::Pri
   if (mBackHost) {
     aTo += "\n";
     mBackHost->PrintInfo(aTo, prefix.get());
   }
 }
 
 #ifdef MOZ_DUMP_PAINTING
 void
-DeprecatedContentHostDoubleBuffered::Dump(FILE* aFile,
+ContentHostDoubleBuffered::Dump(FILE* aFile,
                                 const char* aPrefix,
                                 bool aDumpHtml)
 {
-  DeprecatedContentHostBase::Dump(aFile, aPrefix, aDumpHtml);
+  ContentHostBase::Dump(aFile, aPrefix, aDumpHtml);
   if (!aDumpHtml) {
     return;
   }
   if (!aFile) {
     aFile = stderr;
   }
   fprintf_stderr(aFile, "<ul>");
   if (mBackHost) {
@@ -1254,54 +831,28 @@ DeprecatedContentHostDoubleBuffered::Dum
   }
   fprintf_stderr(aFile, "</ul>");
 }
 #endif
 
 LayerRenderState
 ContentHostBase::GetRenderState()
 {
-  if (!mTextureHost) {
-    return LayerRenderState();
-  }
-
-  LayerRenderState result = mTextureHost->GetRenderState();
-
-  if (mBufferRotation != nsIntPoint()) {
-    result.mFlags |= LAYER_RENDER_STATE_BUFFER_ROTATION;
-  }
-  result.SetOffset(GetOriginOffset());
-  return result;
-}
-
-LayerRenderState
-DeprecatedContentHostBase::GetRenderState()
-{
   LayerRenderState result = mDeprecatedTextureHost->GetRenderState();
 
   if (mBufferRotation != nsIntPoint()) {
     result.mFlags |= LAYER_RENDER_STATE_BUFFER_ROTATION;
   }
   result.SetOffset(GetOriginOffset());
   return result;
 }
 
 #ifdef MOZ_DUMP_PAINTING
 already_AddRefed<gfxImageSurface>
 ContentHostBase::GetAsSurface()
 {
-  if (!mTextureHost) {
-    return nullptr;
-  }
-
-  return mTextureHost->GetAsSurface();
-}
-
-already_AddRefed<gfxImageSurface>
-DeprecatedContentHostBase::GetAsSurface()
-{
   return mDeprecatedTextureHost->GetAsSurface();
 }
 #endif
 
 
 } // namespace
 } // namespace
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -86,77 +86,17 @@ protected:
  */
 class ContentHostBase : public ContentHost
 {
 public:
   typedef RotatedContentBuffer::ContentType ContentType;
   typedef RotatedContentBuffer::PaintState PaintState;
 
   ContentHostBase(const TextureInfo& aTextureInfo);
-  virtual ~ContentHostBase();
-
-  virtual void Composite(EffectChain& aEffectChain,
-                         float aOpacity,
-                         const gfx::Matrix4x4& aTransform,
-                         const gfx::Filter& aFilter,
-                         const gfx::Rect& aClipRect,
-                         const nsIntRegion* aVisibleRegion = nullptr,
-                         TiledLayerProperties* aLayerProperties = nullptr);
-
-  virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
-
-  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
-
-#ifdef MOZ_DUMP_PAINTING
-  virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
-
-  virtual void Dump(FILE* aFile=nullptr,
-                    const char* aPrefix="",
-                    bool aDumpHtml=false) MOZ_OVERRIDE;
-#endif
-
-  virtual void PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
-
-  virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE;
-
-  virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
-
-  virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
-
-  virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }
-
-  virtual void OnActorDestroy() MOZ_OVERRIDE;
-
-protected:
-  virtual nsIntPoint GetOriginOffset()
-  {
-    return mBufferRect.TopLeft() - mBufferRotation;
-  }
-
-  bool PaintWillResample() { return mPaintWillResample; }
-
-  // These must be called before forgetting mTextureHost or mTextureHostOnWhite
-  void DestroyTextureHost();
-  void DestroyTextureHostOnWhite();
-
-  nsIntRect mBufferRect;
-  nsIntPoint mBufferRotation;
-  RefPtr<TextureHost> mTextureHost;
-  RefPtr<TextureHost> mTextureHostOnWhite;
-  bool mPaintWillResample;
-  bool mInitialised;
-};
-class DeprecatedContentHostBase : public ContentHost
-{
-public:
-  typedef RotatedContentBuffer::ContentType ContentType;
-  typedef RotatedContentBuffer::PaintState PaintState;
-
-  DeprecatedContentHostBase(const TextureInfo& aTextureInfo);
-  ~DeprecatedContentHostBase();
+  ~ContentHostBase();
 
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Filter& aFilter,
                          const gfx::Rect& aClipRect,
                          const nsIntRegion* aVisibleRegion = nullptr,
                          TiledLayerProperties* aLayerProperties = nullptr);
@@ -210,48 +150,26 @@ protected:
   // here and move it to mDeprecatedTextureHost once we do the first buffer swap.
   RefPtr<DeprecatedTextureHost> mNewFrontHost;
   RefPtr<DeprecatedTextureHost> mNewFrontHostOnWhite;
   bool mPaintWillResample;
   bool mInitialised;
 };
 
 /**
- * Double buffering is implemented by swapping the front and back TextureHosts.
- * We assume that whenever we use double buffering, then we have
- * render-to-texture and thus no texture upload to do.
+ * Double buffering is implemented by swapping the front and back DeprecatedTextureHosts.
  */
 class ContentHostDoubleBuffered : public ContentHostBase
 {
 public:
   ContentHostDoubleBuffered(const TextureInfo& aTextureInfo)
     : ContentHostBase(aTextureInfo)
   {}
 
-  virtual ~ContentHostDoubleBuffered() {}
-
-  virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_DOUBLE; }
-
-  virtual void UpdateThebes(const ThebesBufferData& aData,
-                            const nsIntRegion& aUpdated,
-                            const nsIntRegion& aOldValidRegionBack,
-                            nsIntRegion* aUpdatedRegionBack);
-
-protected:
-  nsIntRegion mValidRegionForNextBackBuffer;
-};
-
-class DeprecatedContentHostDoubleBuffered : public DeprecatedContentHostBase
-{
-public:
-  DeprecatedContentHostDoubleBuffered(const TextureInfo& aTextureInfo)
-    : DeprecatedContentHostBase(aTextureInfo)
-  {}
-
-  ~DeprecatedContentHostDoubleBuffered();
+  ~ContentHostDoubleBuffered();
 
   virtual CompositableType GetType() { return BUFFER_CONTENT_DIRECT; }
 
   virtual void UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack);
 
@@ -284,33 +202,17 @@ protected:
  * DeprecatedTextureHost in the layers transaction (i.e., in UpdateThebes).
  */
 class ContentHostSingleBuffered : public ContentHostBase
 {
 public:
   ContentHostSingleBuffered(const TextureInfo& aTextureInfo)
     : ContentHostBase(aTextureInfo)
   {}
-  virtual ~ContentHostSingleBuffered() {}
-
-  virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_SINGLE; }
-
-  virtual void UpdateThebes(const ThebesBufferData& aData,
-                            const nsIntRegion& aUpdated,
-                            const nsIntRegion& aOldValidRegionBack,
-                            nsIntRegion* aUpdatedRegionBack);
-};
-
-class DeprecatedContentHostSingleBuffered : public DeprecatedContentHostBase
-{
-public:
-  DeprecatedContentHostSingleBuffered(const TextureInfo& aTextureInfo)
-    : DeprecatedContentHostBase(aTextureInfo)
-  {}
-  virtual ~DeprecatedContentHostSingleBuffered();
+  virtual ~ContentHostSingleBuffered();
 
   virtual CompositableType GetType() { return BUFFER_CONTENT; }
 
   virtual void UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack);
 
@@ -328,21 +230,21 @@ public:
  * surfaces that only cover the changed pixels during an update.
  *
  * Takes ownership of the passed in update surfaces, and must
  * free them once texture upload is complete.
  *
  * Delays texture uploads until the next composite to
  * avoid blocking the main thread.
  */
-class ContentHostIncremental : public DeprecatedContentHostBase
+class ContentHostIncremental : public ContentHostBase
 {
 public:
   ContentHostIncremental(const TextureInfo& aTextureInfo)
-    : DeprecatedContentHostBase(aTextureInfo)
+    : ContentHostBase(aTextureInfo)
     , mDeAllocator(nullptr)
   {}
 
   virtual CompositableType GetType() { return BUFFER_CONTENT; }
 
   virtual void EnsureDeprecatedTextureHostIncremental(ISurfaceAllocator* aAllocator,
                                             const TextureInfo& aTextureInfo,
                                             const nsIntRect& aBufferRect) MOZ_OVERRIDE;
@@ -374,17 +276,17 @@ public:
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Filter& aFilter,
                          const gfx::Rect& aClipRect,
                          const nsIntRegion* aVisibleRegion = nullptr,
                          TiledLayerProperties* aLayerProperties = nullptr)
   {
     ProcessTextureUpdates();
 
-    DeprecatedContentHostBase::Composite(aEffectChain, aOpacity,
+    ContentHostBase::Composite(aEffectChain, aOpacity,
                                aTransform, aFilter,
                                aClipRect, aVisibleRegion,
                                aLayerProperties);
   }
 
   virtual void DestroyTextures()
   {
     mDeprecatedTextureHost = nullptr;
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -38,26 +38,26 @@ ImageHost::~ImageHost() {}
 
 void
 ImageHost::UseTextureHost(TextureHost* aTexture)
 {
   mFrontBuffer = aTexture;
 }
 
 void
-ImageHost::RemoveTextureHost(TextureHost* aTexture)
+ImageHost::RemoveTextureHost(uint64_t aTextureID)
 {
-  CompositableHost::RemoveTextureHost(aTexture);
-  if (mFrontBuffer && mFrontBuffer->GetID() == aTexture->GetID()) {
+  CompositableHost::RemoveTextureHost(aTextureID);
+  if (mFrontBuffer && mFrontBuffer->GetID() == aTextureID) {
     mFrontBuffer = nullptr;
   }
 }
 
 TextureHost*
-ImageHost::GetAsTextureHost()
+ImageHost::GetTextureHost()
 {
   return mFrontBuffer;
 }
 
 void
 ImageHost::Composite(EffectChain& aEffectChain,
                      float aOpacity,
                      const gfx::Matrix4x4& aTransform,
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -51,19 +51,19 @@ public:
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Filter& aFilter,
                          const gfx::Rect& aClipRect,
                          const nsIntRegion* aVisibleRegion = nullptr,
                          TiledLayerProperties* aLayerProperties = nullptr) MOZ_OVERRIDE;
 
   virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
 
-  virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
+  virtual void RemoveTextureHost(uint64_t aTextureID) MOZ_OVERRIDE;
 
-  virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE;
+  virtual TextureHost* GetTextureHost() MOZ_OVERRIDE;
 
   virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE
   {
     mPictureRect = aPictureRect;
     mHasPictureRect = true;
   }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -111,20 +111,20 @@ void
 ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
 {
   gfx3DMatrix local = GetLocalTransform();
 
   // Snap image edges to pixel boundaries
   gfxRect sourceRect(0, 0, 0, 0);
   if (mImageHost &&
       mImageHost->IsAttached() &&
-      (mImageHost->GetDeprecatedTextureHost() || mImageHost->GetAsTextureHost())) {
+      (mImageHost->GetDeprecatedTextureHost() || mImageHost->GetTextureHost())) {
     IntSize size =
-      mImageHost->GetAsTextureHost() ? mImageHost->GetAsTextureHost()->GetSize()
-                                     : mImageHost->GetDeprecatedTextureHost()->GetSize();
+      mImageHost->GetTextureHost() ? mImageHost->GetTextureHost()->GetSize()
+                                   : mImageHost->GetDeprecatedTextureHost()->GetSize();
     sourceRect.SizeTo(size.width, size.height);
     if (mScaleMode != SCALE_NONE &&
         sourceRect.width != 0.0 && sourceRect.height != 0.0) {
       NS_ASSERTION(mScaleMode == SCALE_STRETCH,
                    "No other scalemodes than stretch and none supported yet.");
       local.Scale(mScaleToSize.width / sourceRect.width,
                   mScaleToSize.height / sourceRect.height, 1.0);
     }
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -507,17 +507,16 @@ ShmemTextureHost::~ShmemTextureHost()
 
 void
 ShmemTextureHost::DeallocateSharedData()
 {
   if (mShmem) {
     MOZ_ASSERT(mDeallocator,
                "Shared memory would leak without a ISurfaceAllocator");
     mDeallocator->DeallocShmem(*mShmem);
-    mShmem = nullptr;
   }
 }
 
 void
 ShmemTextureHost::OnActorDestroy()
 {
   delete mShmem;
   mShmem = nullptr;
@@ -546,17 +545,16 @@ MemoryTextureHost::~MemoryTextureHost()
 
 void
 MemoryTextureHost::DeallocateSharedData()
 {
   if (mBuffer) {
     GfxMemoryImageReporter::WillFree(mBuffer);
   }
   delete[] mBuffer;
-  mBuffer = nullptr;
 }
 
 uint8_t* MemoryTextureHost::GetBuffer()
 {
   return mBuffer;
 }
 
 } // namespace
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -303,17 +303,17 @@ public:
    * Is called before compositing if the shared data has changed since last
    * composition.
    * This method should be overload in cases like when we need to do a texture
    * upload for example.
    *
    * @param aRegion The region that has been changed, if nil, it means that the
    * entire surface should be updated.
    */
-  virtual void Updated(const nsIntRegion* aRegion = nullptr) {}
+  virtual void Updated(const nsIntRegion* aRegion) {}
 
   /**
    * Sets this TextureHost's compositor.
    * A TextureHost can change compositor on certain occasions, in particular if
    * it belongs to an async Compositable.
    * aCompositor can be null, in which case the TextureHost must cleanup  all
    * of it's device textures.
    */
@@ -417,17 +417,17 @@ public:
   BufferTextureHost(uint64_t aID,
                     gfx::SurfaceFormat aFormat,
                     TextureFlags aFlags);
 
   ~BufferTextureHost();
 
   virtual uint8_t* GetBuffer() = 0;
 
-  virtual void Updated(const nsIntRegion* aRegion = nullptr) MOZ_OVERRIDE;
+  virtual void Updated(const nsIntRegion* aRegion) MOZ_OVERRIDE;
 
   virtual bool Lock() MOZ_OVERRIDE;
 
   virtual void Unlock() MOZ_OVERRIDE;
 
   virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE;
 
   virtual void DeallocateDeviceData() MOZ_OVERRIDE;
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -93,17 +93,17 @@ CompositableParentManager::ReceiveCompos
                                                  op.textureInfo(),
                                                  op.bufferRect());
       break;
     }
     case CompositableOperation::TOpDestroyThebesBuffer: {
       MOZ_LAYERS_LOG(("[ParentSide] Created double buffer"));
       const OpDestroyThebesBuffer& op = aEdit.get_OpDestroyThebesBuffer();
       CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
-      DeprecatedContentHostBase* content = static_cast<DeprecatedContentHostBase*>(compositableParent->GetCompositableHost());
+      ContentHostBase* content = static_cast<ContentHostBase*>(compositableParent->GetCompositableHost());
       content->DestroyTextures();
 
       break;
     }
     case CompositableOperation::TOpPaintTexture: {
       MOZ_LAYERS_LOG(("[ParentSide] Paint Texture X"));
       const OpPaintTexture& op = aEdit.get_OpPaintTexture();
 
@@ -266,22 +266,21 @@ CompositableParentManager::ReceiveCompos
       }
       CompositableHost* compositable = AsCompositable(op);
 
       RefPtr<TextureHost> texture = compositable->GetTextureHost(op.textureID());
       MOZ_ASSERT(texture);
 
       TextureFlags flags = texture->GetFlags();
 
-      if (!(flags & TEXTURE_DEALLOCATE_CLIENT) &&
-          !(flags & TEXTURE_DEALLOCATE_DEFERRED)) {
+      if (!(flags & TEXTURE_DEALLOCATE_CLIENT)) {
         texture->DeallocateSharedData();
       }
 
-      compositable->RemoveTextureHost(texture);
+      compositable->RemoveTextureHost(op.textureID());
 
       // if it is not the host that deallocates the shared data, then we need
       // to notfy the client side to tell when it is safe to deallocate or
       // reuse it.
       if (flags & TEXTURE_DEALLOCATE_CLIENT) {
         replyv.push_back(ReplyTextureRemoved(op.compositableParent(), nullptr,
                                              op.textureID()));
       }