Bug 844928, remove PTexture. r=nical
authorNicholas Cameron <ncameron@mozilla.com>
Fri, 12 Apr 2013 19:28:55 +1200
changeset 128567 f2ab8512592899cb144663965bd04749ef25b976
parent 128566 17f9958f5d990c65e4277899662357959164d0fe
child 128568 7bf4a91d224ffae667783838a04af4541d284f14
push id24532
push userryanvm@gmail.com
push dateFri, 12 Apr 2013 19:06:49 +0000
treeherdermozilla-central@2aff2d574a1e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs844928
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 844928, remove PTexture. r=nical
gfx/layers/Compositor.h
gfx/layers/CompositorTypes.h
gfx/layers/Layers.h
gfx/layers/Makefile.in
gfx/layers/basic/BasicLayerManager.cpp
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/CanvasClient.h
gfx/layers/client/CompositableClient.cpp
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ContentClient.h
gfx/layers/client/ImageClient.cpp
gfx/layers/client/ImageClient.h
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/client/TiledContentClient.cpp
gfx/layers/composite/CanvasLayerComposite.cpp
gfx/layers/composite/CanvasLayerComposite.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/LayerManagerComposite.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/composite/ThebesLayerComposite.cpp
gfx/layers/composite/ThebesLayerComposite.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/composite/TiledContentHost.h
gfx/layers/ipc/CompositableForwarder.h
gfx/layers/ipc/CompositableTransactionParent.cpp
gfx/layers/ipc/CompositorChild.cpp
gfx/layers/ipc/ImageBridgeChild.cpp
gfx/layers/ipc/ImageBridgeChild.h
gfx/layers/ipc/ImageBridgeParent.cpp
gfx/layers/ipc/ImageBridgeParent.h
gfx/layers/ipc/LayerTransaction.ipdlh
gfx/layers/ipc/PCompositable.ipdl
gfx/layers/ipc/PImageBridge.ipdl
gfx/layers/ipc/PLayers.ipdl
gfx/layers/ipc/PTexture.ipdl
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/ipc/ShadowLayersChild.cpp
gfx/layers/ipc/ShadowLayersChild.h
gfx/layers/ipc/ShadowLayersParent.cpp
gfx/layers/ipc/ShadowLayersParent.h
gfx/layers/ipc/TextureChild.cpp
gfx/layers/ipc/TextureChild.h
gfx/layers/ipc/TextureParent.cpp
gfx/layers/ipc/TextureParent.h
gfx/layers/ipc/ipdl.mk
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/CompositorOGL.h
gfx/layers/opengl/TextureClientOGL.cpp
gfx/layers/opengl/TextureClientOGL.h
gfx/layers/opengl/TextureHostOGL.cpp
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -214,24 +214,16 @@ public:
    * process, it might be required by texture uploads etc.
    *
    * If aFlags == CURRENT_FORCE then we will (re-)set our context on the
    * underlying API even if it is already the current context.
    */
   virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) = 0;
 
   /**
-   * Modifies the TextureIdentifier in aInfo to a more reliable kind. For use by
-   * when creating texture hosts/clients. If the desired texture cannot be
-   * created, this method allows the compositor to suggest a less desirable, but
-   * more reliable kind of texture.
-   */
-  virtual void FallbackTextureInfo(TextureInfo& aInfo) {}
-
-  /**
    * Creates a Surface that can be used as a rendering target by this
    * compositor.
    */
   virtual TemporaryRef<CompositingRenderTarget>
   CreateRenderTarget(const gfx::IntRect& aRect, SurfaceInitMode aInit) = 0;
 
   /**
    * Creates a Surface that can be used as a rendering target by this
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -70,17 +70,16 @@ enum CompositableType
 /**
  * How the texture host is used for composition,
  */
 enum TextureHostFlags
 {
   TEXTURE_HOST_DEFAULT = 0,       // The default texture host for the given
                                   // SurfaceDescriptor
   TEXTURE_HOST_TILED = 1 << 0,    // A texture host that supports tiling
-  TEXTURE_HOST_DIRECT = 1 << 1    // Direct texturing
 };
 
 /**
  * Sent from the compositor to the content-side LayerManager, includes properties
  * of the compositor and should (in the future) include information about what
  * kinds of buffer and texture clients to create.
  */
 struct TextureFactoryIdentifier
@@ -91,29 +90,50 @@ struct TextureFactoryIdentifier
   TextureFactoryIdentifier(LayersBackend aLayersBackend = LAYERS_NONE,
                            int32_t aMaxTextureSize = 0)
     : mParentBackend(aLayersBackend)
     , mMaxTextureSize(aMaxTextureSize)
   {}
 };
 
 /**
+ * Identify a texture to a compositable. Many textures can have the same id, but
+ * the id is unique for any texture owned by a particular compositable.
+ */
+typedef uint32_t TextureIdentifier;
+const TextureIdentifier TextureFront = 1;
+const TextureIdentifier TextureBack = 2;
+
+/**
  * Information required by the compositor from the content-side for creating or
  * using compositables and textures.
  */
 struct TextureInfo
 {
   CompositableType mCompositableType;
   uint32_t mTextureHostFlags;
   uint32_t mTextureFlags;
 
   TextureInfo()
     : mCompositableType(BUFFER_UNKNOWN)
     , mTextureHostFlags(0)
     , mTextureFlags(0)
   {}
+
+  TextureInfo(CompositableType aType)
+    : mCompositableType(aType)
+    , mTextureHostFlags(0)
+    , mTextureFlags(0)
+  {}
+
+  bool operator==(const TextureInfo& aOther) const
+  {
+    return mCompositableType == aOther.mCompositableType &&
+           mTextureHostFlags == aOther.mTextureHostFlags &&
+           mTextureFlags == aOther.mTextureFlags;
+  }
 };
 
 
 } // namespace layers
 } // namespace mozilla
 
 #endif
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -62,17 +62,16 @@ class RefLayer;
 class ShadowLayer;
 class ShadowableLayer;
 class ShadowLayerForwarder;
 class ShadowLayerManager;
 class SpecificLayerAttributes;
 class SurfaceDescriptor;
 class Compositor;
 class LayerComposite;
-struct TextureIdentifier;
 struct TextureFactoryIdentifier;
 struct EffectMask;
 
 #define MOZ_LAYER_DECL_NAME(n, e)                           \
   virtual const char* Name() const { return n; }            \
   virtual LayerType GetType() const { return e; }
 
 /**
@@ -152,17 +151,22 @@ public:
   virtual ~LayerManager() {}
 
   /**
    * Release layers and resources held by this layer manager, and mark
    * it as destroyed.  Should do any cleanup necessary in preparation
    * for its widget going away.  After this call, only user data calls
    * are valid on the layer manager.
    */
-  virtual void Destroy() { mDestroyed = true; mUserData.Destroy(); }
+  virtual void Destroy()
+  {
+    mDestroyed = true;
+    mUserData.Destroy();
+    mRoot = nullptr;
+  }
   bool IsDestroyed() { return mDestroyed; }
 
   virtual ShadowLayerForwarder* AsShadowForwarder()
   { return nullptr; }
 
   virtual ShadowLayerManager* AsShadowManager()
   { return nullptr; }
 
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -170,22 +170,20 @@ EXPORTS_mozilla/layers =\
         ShadowLayersChild.h \
         ShadowLayersParent.h \
         ShadowLayersManager.h \
         RenderTrace.h \
         SharedRGBImage.h \
         SharedPlanarYCbCrImage.h \
         ShmemYCbCrImage.h \
         TaskThrottler.h \
-        TextureChild.h \
         TextureClient.h \
         TextureHost.h \
         TextureClientOGL.h \
         TextureHostOGL.h \
-        TextureParent.h \
         TiledContentClient.h \
         $(NULL)
 
 CPPSRCS += \
         AsyncPanZoomController.cpp \
         Axis.cpp \
         CanvasClient.cpp \
         CompositableClient.cpp \
@@ -209,20 +207,18 @@ CPPSRCS += \
         ShmemYCbCrImage.cpp \
         SharedRGBImage.cpp \
         TaskThrottler.cpp \
         ImageClient.cpp \
         ImageHost.cpp \
         ISurfaceAllocator.cpp \
         TextureClient.cpp \
         TextureClientOGL.cpp \
+        TextureHost.cpp \
         TextureHostOGL.cpp \
-        TextureChild.cpp \
-        TextureHost.cpp \
-        TextureParent.cpp \
         TiledContentClient.cpp \
         TiledContentHost.cpp \
         $(NULL)
 
 ifdef MOZ_X11 #{
 EXPORTS_mozilla/layers += ShadowLayerUtilsX11.h
 CPPSRCS += ShadowLayerUtilsX11.cpp
 endif #}
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/Hal.h"
 #include "mozilla/layers/PLayerChild.h"
 #include "mozilla/layers/PLayersChild.h"
 #include "mozilla/layers/PLayersParent.h"
-#include "mozilla/layers/TextureChild.h"
 
 #include "gfxSharedImageSurface.h"
 #include "gfxImageSurface.h"
 #include "gfxUtils.h"
 #include "gfxPlatform.h"
 #include "nsXULAppAPI.h"
 #include "RenderTrace.h"
 #include "GeckoProfiler.h"
@@ -1239,23 +1238,22 @@ BasicShadowLayerManager::ForwardTransact
 
         break;
       }
       case EditReply::TOpTextureSwap: {
         MOZ_LAYERS_LOG(("[LayersForwarder] TextureSwap"));
 
         const OpTextureSwap& ots = reply.get_OpTextureSwap();
 
-        PTextureChild* textureChild = ots.textureChild();
-        MOZ_ASSERT(textureChild);
+        CompositableChild* compositableChild =
+          static_cast<CompositableChild*>(ots.compositableChild());
+        MOZ_ASSERT(compositableChild);
 
-        TextureClient* texClient =
-          static_cast<TextureChild*>(textureChild)->GetTextureClient();
-
-        texClient->SetDescriptorFromReply(ots.image());
+        compositableChild->GetCompositableClient()
+          ->SetDescriptorFromReply(ots.textureId(), ots.image());
         break;
       }
 
       default:
         NS_RUNTIMEABORT("not reached");
       }
     }
   } else if (HasShadowManager()) {
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -31,33 +31,34 @@ CanvasClient::CreateCanvasClient(LayersB
       return new CanvasClientWebGL(aForwarder, aFlags);
     }
     return new CanvasClient2D(aForwarder, aFlags);
   }
   return nullptr;
 }
 
 void
-CanvasClient::SetBuffer(const TextureIdentifier& aTextureIdentifier,
-                        const SurfaceDescriptor& aBuffer)
+CanvasClient::Updated()
 {
-  mTextureClient->SetDescriptor(aBuffer);
+  mForwarder->UpdateTexture(this, 1, mTextureClient->GetDescriptor());
 }
 
+
 CanvasClient2D::CanvasClient2D(CompositableForwarder* aFwd,
                                TextureFlags aFlags)
 : CanvasClient(aFwd, aFlags)
 {
+  mTextureInfo.mCompositableType = BUFFER_IMAGE_SINGLE;
 }
 
 void
 CanvasClient2D::Update(gfx::IntSize aSize, BasicCanvasLayer* aLayer)
 {
   if (!mTextureClient) {
-    mTextureClient = CreateTextureClient(TEXTURE_SHMEM, mFlags);
+    mTextureClient = CreateTextureClient(TEXTURE_SHMEM);
   }
 
   bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
   gfxASurface::gfxContentType contentType = isOpaque
                                               ? gfxASurface::CONTENT_COLOR
                                               : gfxASurface::CONTENT_COLOR_ALPHA;
   mTextureClient->EnsureAllocated(aSize, contentType);
 
@@ -65,23 +66,24 @@ CanvasClient2D::Update(gfx::IntSize aSiz
   static_cast<BasicCanvasLayer*>(aLayer)->UpdateSurface(surface, nullptr);
   mTextureClient->Unlock();
 }
 
 CanvasClientWebGL::CanvasClientWebGL(CompositableForwarder* aFwd,
                                      TextureFlags aFlags)
 : CanvasClient(aFwd, aFlags)
 {
+  mTextureInfo.mCompositableType = BUFFER_IMAGE_BUFFERED;
 }
 
 void
 CanvasClientWebGL::Update(gfx::IntSize aSize, BasicCanvasLayer* aLayer)
 {
   if (!mTextureClient) {
-    mTextureClient = CreateTextureClient(TEXTURE_STREAM_GL, mFlags);
+    mTextureClient = CreateTextureClient(TEXTURE_STREAM_GL);
   }
 
   NS_ASSERTION(aLayer->mGLContext, "CanvasClientWebGL should only be used with GL canvases");
 
   // the content type won't be used
   mTextureClient->EnsureAllocated(aSize, gfxASurface::CONTENT_COLOR);
 
   GLScreenBuffer* screen = aLayer->mGLContext->Screen();
--- a/gfx/layers/client/CanvasClient.h
+++ b/gfx/layers/client/CanvasClient.h
@@ -9,17 +9,16 @@
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/CompositableClient.h"
 
 namespace mozilla {
 
 namespace layers {
 
 class BasicCanvasLayer;
-class TextureIdentifier;
 
 /**
  * Compositable client for 2d and webgl canvas.
  */
 class CanvasClient : public CompositableClient
 {
 public:
   /**
@@ -28,60 +27,63 @@ public:
    * host.
    */
   static TemporaryRef<CanvasClient> CreateCanvasClient(LayersBackend aBackendType,
                                                        CompositableType aImageHostType,
                                                        CompositableForwarder* aFwd,
                                                        TextureFlags aFlags);
 
   CanvasClient(CompositableForwarder* aFwd, TextureFlags aFlags)
-  : CompositableClient(aFwd), mFlags(aFlags)
-  {}
+    : CompositableClient(aFwd)
+  {
+    mTextureInfo.mTextureFlags = aFlags;
+  }
 
   virtual ~CanvasClient() {}
 
   virtual void Update(gfx::IntSize aSize, BasicCanvasLayer* aLayer) = 0;
 
-  virtual void SetBuffer(const TextureIdentifier& aTextureIdentifier,
-                         const SurfaceDescriptor& aBuffer);
-  virtual void Updated()
+  virtual void Updated();
+
+  virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
+                                      const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
   {
-    mTextureClient->Updated();
+    mTextureClient->SetDescriptorFromReply(aDescriptor);
   }
 protected:
   RefPtr<TextureClient> mTextureClient;
-  TextureFlags mFlags;
+  TextureInfo mTextureInfo;
 };
 
 // Used for 2D canvases and WebGL canvas on non-GL systems where readback is requried.
 class CanvasClient2D : public CanvasClient
 {
 public:
   CanvasClient2D(CompositableForwarder* aLayerForwarder,
                  TextureFlags aFlags);
 
-  CompositableType GetType() const MOZ_OVERRIDE
+  TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
-    return BUFFER_IMAGE_SINGLE;
+    return mTextureInfo;
   }
 
   virtual void Update(gfx::IntSize aSize, BasicCanvasLayer* aLayer);
 };
 
 // Used for GL canvases where we don't need to do any readback, i.e., with a
 // GL backend.
 class CanvasClientWebGL : public CanvasClient
 {
 public:
   CanvasClientWebGL(CompositableForwarder* aFwd,
                     TextureFlags aFlags);
 
-  CompositableType GetType() const MOZ_OVERRIDE
+  TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
-    return BUFFER_IMAGE_BUFFERED;
+    return mTextureInfo;
   }
 
   virtual void Update(gfx::IntSize aSize, BasicCanvasLayer* aLayer);
 };
 
 }
 }
 
--- a/gfx/layers/client/CompositableClient.cpp
+++ b/gfx/layers/client/CompositableClient.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/CompositableClient.h"
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/TextureClientOGL.h"
-#include "mozilla/layers/TextureChild.h"
 #include "mozilla/layers/ShadowLayersChild.h"
 #include "mozilla/layers/CompositableForwarder.h"
 
 namespace mozilla {
 namespace layers {
 
 CompositableClient::~CompositableClient()
 {
@@ -65,84 +64,58 @@ CompositableClient::GetAsyncID() const
   }
   return 0; // zero is always an invalid async ID
 }
 
 
 void
 CompositableChild::Destroy()
 {
-  int numChildren = ManagedPTextureChild().Length();
-  for (int i = numChildren-1; i >= 0; --i) {
-    TextureChild* texture =
-      static_cast<TextureChild*>(
-        ManagedPTextureChild()[i]);
-    texture->Destroy();
-  }
   Send__delete__(this);
 }
 
-PTextureChild*
-CompositableChild::AllocPTexture(const TextureInfo& aInfo)
-{
-  return new TextureChild();
-}
-
-bool
-CompositableChild::DeallocPTexture(PTextureChild* aActor)
-{
-  delete aActor;
-  return true;
-}
-
 TemporaryRef<TextureClient>
-CompositableClient::CreateTextureClient(TextureClientType aTextureClientType,
-                                        TextureFlags aFlags)
+CompositableClient::CreateTextureClient(TextureClientType aTextureClientType)
 {
   MOZ_ASSERT(GetForwarder(), "Can't create a texture client if the compositable is not connected to the compositor.");
   LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
   RefPtr<TextureClient> result;
 
   switch (aTextureClientType) {
   case TEXTURE_SHARED_GL:
     if (parentBackend == LAYERS_OPENGL) {
-      result = new TextureClientSharedOGL(GetForwarder(), GetType());
+      result = new TextureClientSharedOGL(GetForwarder(), GetTextureInfo());
     }
      break;
   case TEXTURE_SHARED_GL_EXTERNAL:
     if (parentBackend == LAYERS_OPENGL) {
-      result = new TextureClientSharedOGLExternal(GetForwarder(), GetType());
+      result = new TextureClientSharedOGLExternal(GetForwarder(), GetTextureInfo());
     }
     break;
   case TEXTURE_STREAM_GL:
     if (parentBackend == LAYERS_OPENGL) {
-      result = new TextureClientStreamOGL(GetForwarder(), GetType());
+      result = new TextureClientStreamOGL(GetForwarder(), GetTextureInfo());
     }
     break;
   case TEXTURE_YCBCR:
-    result = new TextureClientShmemYCbCr(GetForwarder(), GetType());
+    result = new TextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
     break;
   case TEXTURE_CONTENT:
      // fall through to TEXTURE_SHMEM
   case TEXTURE_SHMEM:
     if (parentBackend == LAYERS_OPENGL) {
-      result = new TextureClientShmem(GetForwarder(), GetType());
+      result = new TextureClientShmem(GetForwarder(), GetTextureInfo());
     }
     break;
   default:
     MOZ_ASSERT(false, "Unhandled texture client type");
   }
 
   MOZ_ASSERT(result, "Failed to create TextureClient");
   MOZ_ASSERT(result->SupportsType(aTextureClientType),
              "Created the wrong texture client?");
-  result->SetFlags(aFlags);
-  TextureChild* textureChild = static_cast<TextureChild*>(
-    GetIPDLActor()->SendPTextureConstructor(result->GetTextureInfo()));
-
-  result->SetIPDLActor(textureChild);
-  textureChild->SetClient(result);
+  result->SetFlags(GetTextureInfo().mTextureFlags);
 
   return result.forget();
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -66,27 +66,32 @@ public:
   CompositableClient(CompositableForwarder* aForwarder)
   : mCompositableChild(nullptr), mForwarder(aForwarder)
   {
     MOZ_COUNT_CTOR(CompositableClient);
   }
 
   virtual ~CompositableClient();
 
-  virtual CompositableType GetType() const
+  virtual TextureInfo GetTextureInfo() const
   {
-    NS_WARNING("This method should be overridden");
-    return BUFFER_UNKNOWN;
+    MOZ_NOT_REACHED("This method should be overridden");
+    return TextureInfo();
   }
 
   LayersBackend GetCompositorBackendType() const;
 
   TemporaryRef<TextureClient>
-  CreateTextureClient(TextureClientType aTextureClientType,
-                      TextureFlags aFlags);
+  CreateTextureClient(TextureClientType aTextureClientType);
+
+  virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
+                                      const SurfaceDescriptor& aDescriptor)
+  {
+    MOZ_NOT_REACHED("If you want to call this, you should have implemented it");
+  }
 
   /**
    * Establishes the connection with compositor side through IPDL
    */
   virtual bool Connect();
 
   void Destroy();
 
@@ -126,19 +131,16 @@ public:
   {
     MOZ_COUNT_CTOR(CompositableChild);
   }
   ~CompositableChild()
   {
     MOZ_COUNT_DTOR(CompositableChild);
   }
 
-  virtual PTextureChild* AllocPTexture(const TextureInfo& aInfo) MOZ_OVERRIDE;
-  virtual bool DeallocPTexture(PTextureChild* aActor) MOZ_OVERRIDE;
-
   void Destroy();
 
   void SetClient(CompositableClient* aClient)
   {
     mCompositableClient = aClient;
   }
 
   CompositableClient* GetCompositableClient() const
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -69,17 +69,16 @@ ContentClientBasic::CreateDTBuffer(Conte
 void
 ContentClientRemote::DestroyBuffers()
 {
   if (!mTextureClient) {
     return;
   }
 
   MOZ_ASSERT(mTextureClient->GetAccessMode() == TextureClient::ACCESS_READ_WRITE);
-  // dont't call m*mTextureClient->Destroyed();
   mTextureClient = nullptr;
 
   DestroyFrontBuffer();
 
   mForwarder->DestroyThebesBuffer(this);
 }
 
 void
@@ -114,25 +113,25 @@ ContentClientRemote::CreateDTBuffer(Cont
                     "Bad! Did we create a buffer twice without painting?");
 
   mIsNewBuffer = true;
 
   if (mTextureClient) {
     mOldTextures.AppendElement(mTextureClient);
     DestroyBuffers();
   }
-  mTextureClient = CreateTextureClient(TEXTURE_CONTENT, aFlags | HostRelease);
+  mTextureInfo.mTextureFlags = aFlags | HostRelease;
+  mTextureClient = CreateTextureClient(TEXTURE_CONTENT);
 
   mContentType = aType;
   mSize = gfx::IntSize(aRect.width, aRect.height);
   mTextureClient->EnsureAllocated(mSize, mContentType);
-  // note that LockSurfaceDescriptor doesn't actually lock anything
-  MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->LockSurfaceDescriptor()));
+  MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->GetDescriptor()));
 
-  CreateFrontBufferAndNotify(aRect, aFlags | HostRelease);
+  CreateFrontBufferAndNotify(aRect);
 
   RefPtr<DrawTarget> ret = mTextureClient->LockDrawTarget();
   return ret.forget();
 }
 
 already_AddRefed<gfxASurface>
 ContentClientRemote::CreateBuffer(ContentType aType,
                                   const nsIntRect& aRect,
@@ -142,25 +141,25 @@ ContentClientRemote::CreateBuffer(Conten
                     "Bad! Did we create a buffer twice without painting?");
 
   mIsNewBuffer = true;
 
   if (mTextureClient) {
     mOldTextures.AppendElement(mTextureClient);
     DestroyBuffers();
   }
-  mTextureClient = CreateTextureClient(TEXTURE_CONTENT, aFlags | HostRelease);
+  mTextureInfo.mTextureFlags = aFlags | HostRelease;
+  mTextureClient = CreateTextureClient(TEXTURE_CONTENT);
 
   mContentType = aType;
   mSize = gfx::IntSize(aRect.width, aRect.height);
   mTextureClient->EnsureAllocated(mSize, mContentType);
-  // note that LockSurfaceDescriptor doesn't actually lock anything
-  MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->LockSurfaceDescriptor()));
+  MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->GetDescriptor()));
 
-  CreateFrontBufferAndNotify(aRect, aFlags | HostRelease);
+  CreateFrontBufferAndNotify(aRect);
 
   nsRefPtr<gfxASurface> ret = mTextureClient->LockSurface();
   return ret.forget();
 }
 
 nsIntRegion
 ContentClientRemote::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
                                       const nsIntRegion& aVisibleRegion,
@@ -192,17 +191,16 @@ void
 ContentClientRemote::Updated(const nsIntRegion& aRegionToDraw,
                              const nsIntRegion& aVisibleRegion,
                              bool aDidSelfCopy)
 {
   nsIntRegion updatedRegion = GetUpdatedRegion(aRegionToDraw,
                                                aVisibleRegion,
                                                aDidSelfCopy);
 
-  // don't call m*Client->Updated*()
   MOZ_ASSERT(mTextureClient);
   mTextureClient->SetAccessMode(TextureClient::ACCESS_NONE);
   LockFrontBuffer();
   mForwarder->UpdateTextureRegion(this,
                                   ThebesBufferData(BufferRect(),
                                                    BufferRotation()),
                                   updatedRegion);
 }
@@ -237,35 +235,36 @@ ContentClientDoubleBuffered::~ContentCli
   if (mTextureClient) {
     MOZ_ASSERT(mFrontClient);
     mTextureClient->SetDescriptor(SurfaceDescriptor());
     mFrontClient->SetDescriptor(SurfaceDescriptor());
   }
 }
 
 void
-ContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect,
-                                                        uint32_t aFlags)
+ContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
 {
-  mFrontClient = CreateTextureClient(TEXTURE_CONTENT, aFlags);
+  mFrontClient = CreateTextureClient(TEXTURE_CONTENT);
   mFrontClient->EnsureAllocated(mSize, mContentType);
 
   mFrontBufferRect = aBufferRect;
   mFrontBufferRotation = nsIntPoint();
 
-  mForwarder->CreatedDoubleBuffer(this, mFrontClient, mTextureClient);
+  mForwarder->CreatedDoubleBuffer(this,
+                                  *mFrontClient->GetDescriptor(),
+                                  *mTextureClient->GetDescriptor(),
+                                  mTextureInfo);
 }
 
 void
 ContentClientDoubleBuffered::DestroyFrontBuffer()
 {
   MOZ_ASSERT(mFrontClient);
   MOZ_ASSERT(mFrontClient->GetAccessMode() != TextureClient::ACCESS_NONE);
 
-  // dont't call mFrontClient->Destroyed();
   mFrontClient = nullptr;
 }
 
 void
 ContentClientDoubleBuffered::LockFrontBuffer()
 {
   MOZ_ASSERT(mFrontClient);
   mFrontClient->SetAccessMode(TextureClient::ACCESS_NONE);
@@ -410,20 +409,21 @@ ContentClientDoubleBuffered::UpdateDesti
 ContentClientSingleBuffered::~ContentClientSingleBuffered()
 {
   if (mTextureClient) {
     mTextureClient->SetDescriptor(SurfaceDescriptor());
   }
 }
 
 void
-ContentClientSingleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect,
-                                                        uint32_t aFlags)
+ContentClientSingleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
 {
-  mForwarder->CreatedSingleBuffer(this, mTextureClient);
+  mForwarder->CreatedSingleBuffer(this,
+                                  *mTextureClient->GetDescriptor(),
+                                  mTextureInfo);
 }
 
 void
 ContentClientSingleBuffered::SyncFrontBufferToBackBuffer()
 {
   if (!mFrontAndBackBufferDiffer) {
     return;
   }
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -69,21 +69,16 @@ public:
 
   ContentClient(CompositableForwarder* aForwarder)
   : CompositableClient(aForwarder)
   , ThebesLayerBuffer(ContainsVisibleBounds)
   {}
   virtual ~ContentClient()
   {}
 
-  CompositableType GetType() const MOZ_OVERRIDE
-  {
-    return BUFFER_CONTENT;
-  }
-
   typedef ThebesLayerBuffer::PaintState PaintState;
   typedef ThebesLayerBuffer::ContentType ContentType;
 
   virtual void Clear() { ThebesLayerBuffer::Clear(); }
   PaintState BeginPaintBuffer(ThebesLayer* aLayer, ContentType aContentType,
                               uint32_t aFlags)
   {
     return ThebesLayerBuffer::BeginPaint(aLayer, aContentType, aFlags);
@@ -119,20 +114,20 @@ public:
                      BasicLayerManager* aManager);
 
   virtual already_AddRefed<gfxASurface> CreateBuffer(ContentType aType,
                                                      const nsIntRect& aRect,
                                                      uint32_t aFlags) MOZ_OVERRIDE;
   virtual TemporaryRef<gfx::DrawTarget>
     CreateDTBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags);
 
-  virtual CompositableType GetType() const MOZ_OVERRIDE
+  virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
-    MOZ_ASSERT(false, "Should not be called on non-remote ContentClient");
-    return BUFFER_UNKNOWN;
+    MOZ_NOT_REACHED("Should not be called on non-remote ContentClient");
+    return TextureInfo();
   }
 
 
 private:
   BasicLayerManager* mManager;
 };
 
 /**
@@ -198,41 +193,47 @@ public:
 
   virtual bool SupportsAzureContent() const MOZ_OVERRIDE
   {
     return gfxPlatform::GetPlatform()->SupportsAzureContent();
   }
 
   void DestroyBuffers();
 
+  virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
+  {
+    return mTextureInfo;
+  }
+
 protected:
   /**
    * Swap out the old backing buffer for |aBuffer| and attributes.
    */
   void SetBackingBuffer(gfxASurface* aBuffer,
                         const nsIntRect& aRect,
                         const nsIntPoint& aRotation);
 
   virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
                                        const nsIntRegion& aVisibleRegion,
                                        bool aDidSelfCopy);
 
   // Create the front buffer for the ContentClient/Host pair if necessary
   // and notify the compositor that we have created the buffer(s).
-  virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect, uint32_t aFlags) = 0;
+  virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) = 0;
   virtual void DestroyFrontBuffer() {}
   // We're about to hand off to the compositor, if you've got a back buffer,
   // lock it now.
   virtual void LockFrontBuffer() {}
 
   RefPtr<TextureClient> mTextureClient;
   // keep a record of texture clients we have created and need to keep
   // around, then unlock when we are done painting
   nsTArray<RefPtr<TextureClient>> mOldTextures;
 
+  TextureInfo mTextureInfo;
   bool mIsNewBuffer;
   bool mFrontAndBackBufferDiffer;
   gfx::IntSize mSize;
   ContentType mContentType;
 };
 
 /**
  * A double buffered ContentClient. mTextureClient is the back buffer, which
@@ -244,31 +245,28 @@ protected:
  * repsonse to our UpdateTextureRegion message, the compositor swaps its
  * references. In repsonse to the compositor's reply we swap our references
  * (in SwapBuffers).
  */
 class ContentClientDoubleBuffered : public ContentClientRemote
 {
 public:
   ContentClientDoubleBuffered(CompositableForwarder* aFwd)
-  : ContentClientRemote(aFwd)
-  {}
+    : ContentClientRemote(aFwd)
+  {
+    mTextureInfo.mCompositableType = BUFFER_CONTENT_DIRECT;
+  }
   ~ContentClientDoubleBuffered();
 
-  CompositableType GetType() const MOZ_OVERRIDE
-  {
-    return BUFFER_CONTENT_DIRECT;
-  }
-
   virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
 
   virtual void SyncFrontBufferToBackBuffer() MOZ_OVERRIDE;
 
 protected:
-  virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect, uint32_t aFlags) MOZ_OVERRIDE;
+  virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) MOZ_OVERRIDE;
   virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
   virtual void LockFrontBuffer() MOZ_OVERRIDE;
 
 private:
   // The size policy doesn't really matter here; this constructor is
   // intended to be used for creating temporaries
   ContentClientDoubleBuffered(gfxASurface* aBuffer,
                               const nsIntRect& aRect,
@@ -295,26 +293,23 @@ private:
  * kind. We are free to modify the TextureClient once we receive reply from
  * the compositor.
  */
 class ContentClientSingleBuffered : public ContentClientRemote
 {
 public:
   ContentClientSingleBuffered(CompositableForwarder* aFwd)
     : ContentClientRemote(aFwd)
-  {}
+  {
+    mTextureInfo.mCompositableType = BUFFER_CONTENT;    
+  }
   ~ContentClientSingleBuffered();
 
-  virtual CompositableType GetType() const MOZ_OVERRIDE
-  {
-    return BUFFER_CONTENT;
-  }
-
   virtual void SyncFrontBufferToBackBuffer() MOZ_OVERRIDE;
 
 protected:
-  virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect, uint32_t aFlags) MOZ_OVERRIDE;
+  virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) MOZ_OVERRIDE;
 };
 
 }
 }
 
 #endif
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -70,31 +70,33 @@ ImageClient::UpdatePictureRect(nsIntRect
     return;
   }
   mPictureRect = aRect;
   MOZ_ASSERT(mForwarder);
   GetForwarder()->UpdatePictureRect(this, aRect);
 }
 
 ImageClientSingle::ImageClientSingle(CompositableForwarder* aFwd,
-                                       TextureFlags aFlags,
-                                       CompositableType aType)
+                                     TextureFlags aFlags,
+                                     CompositableType aType)
   : ImageClient(aFwd, aType)
-  , mFlags(aFlags)
-{}
+  , mTextureInfo(aType)
+{
+  mTextureInfo.mTextureFlags = aFlags;
+}
 
 void
 ImageClientSingle::EnsureTextureClient(TextureClientType aType)
 {
   // We should not call this method if using ImageBridge or tiled texture
   // clients since SupportsType always fails
   if (mTextureClient && mTextureClient->SupportsType(aType)) {
     return;
   }
-  mTextureClient = CreateTextureClient(aType, mFlags);
+  mTextureClient = CreateTextureClient(aType);
 }
 
 bool
 ImageClientSingle::UpdateImage(ImageContainer* aContainer,
                                uint32_t aContentFlags)
 {
   AutoLockImage autoLock(aContainer);
 
@@ -184,17 +186,17 @@ ImageClientSingle::UpdateImage(ImageCont
   mLastPaintedImageSerial = image->GetSerial();
   aContainer->NotifyPaintedImage(image);
   return true;
 }
 
 void
 ImageClientSingle::Updated()
 {
-  mTextureClient->Updated();
+  mForwarder->UpdateTexture(this, 1, mTextureClient->GetDescriptor());
 }
 
 ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
                                      TextureFlags aFlags)
 : ImageClient(aFwd, BUFFER_BRIDGE)
 , mAsyncContainerID(0)
 , mLayer(nullptr)
 {
--- a/gfx/layers/client/ImageClient.h
+++ b/gfx/layers/client/ImageClient.h
@@ -33,21 +33,16 @@ public:
    */
   static TemporaryRef<ImageClient> CreateImageClient(LayersBackend aBackendType,
                                                      CompositableType aImageHostType,
                                                      CompositableForwarder* aFwd,
                                                      TextureFlags aFlags);
 
   virtual ~ImageClient() {}
 
-  virtual CompositableType GetType() const MOZ_OVERRIDE
-  {
-    return mType;
-  }
-
   /**
    * Update this ImageClient from aContainer in aLayer
    * returns false if this is the wrong kind of ImageClient for aContainer.
    * Note that returning true does not necessarily imply success
    */
   virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) = 0;
 
   /**
@@ -86,19 +81,31 @@ public:
                      TextureFlags aFlags,
                      CompositableType aType);
 
   virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
 
   void EnsureTextureClient(TextureClientType aType);
 
   virtual void Updated();
+
+  virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
+                                      const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
+  {
+    mTextureClient->SetDescriptorFromReply(aDescriptor);
+  }
+
+  virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
+  {
+    return mTextureInfo;
+  }
+
 private:
   RefPtr<TextureClient> mTextureClient;
-  TextureFlags mFlags;
+  TextureInfo mTextureInfo;
 };
 
 /**
  * Image class to be used for async image uploads using the image bridge
  * protocol.
  * We store the ImageBridge id in the TextureClientIdentifier.
  */
 class ImageClientBridge : public ImageClient
@@ -110,16 +117,21 @@ public:
   virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
   virtual bool Connect() { return false; }
   virtual void Updated() {}
   void SetLayer(ShadowableLayer* aLayer)
   {
     mLayer = aLayer;
   }
 
+  virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
+  {
+    return TextureInfo(mType);
+  }
+
 protected:
   uint64_t mAsyncContainerID;
   ShadowableLayer* mLayer;
 };
 
 }
 }
 
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -7,78 +7,44 @@
 #include "mozilla/layers/TextureClientOGL.h"
 
 #include "mozilla/layers/ImageClient.h"
 #include "mozilla/layers/CanvasClient.h"
 #include "mozilla/layers/ContentClient.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/layers/SharedPlanarYCbCrImage.h"
 #include "GLContext.h"
-#include "mozilla/layers/TextureChild.h"
 #include "BasicLayers.h" // for PaintContext
 #include "ShmemYCbCrImage.h"
 #include "gfxReusableSurfaceWrapper.h"
 #include "gfxPlatform.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
 TextureClient::TextureClient(CompositableForwarder* aForwarder,
-                             CompositableType aCompositableType)
+                             const TextureInfo& aTextureInfo)
   : mForwarder(aForwarder)
-  , mTextureChild(nullptr)
+  , mTextureInfo(aTextureInfo)
   , mAccessMode(ACCESS_READ_WRITE)
 {
   MOZ_COUNT_CTOR(TextureClient);
-  mTextureInfo.mCompositableType = aCompositableType;
 }
 
 TextureClient::~TextureClient()
 {
   MOZ_COUNT_DTOR(TextureClient);
   MOZ_ASSERT(mDescriptor.type() == SurfaceDescriptor::T__None, "Need to release surface!");
-
-  if (mTextureChild) {
-    static_cast<TextureChild*>(mTextureChild)->SetClient(nullptr);
-    static_cast<TextureChild*>(mTextureChild)->Destroy();
-    mTextureChild = nullptr;
-  }
-}
-
-void
-TextureClient::Destroyed()
-{
-  // The owning layer must be locked at some point in the chain of callers
-  // by calling Hold.
-  mForwarder->DestroyedThebesBuffer(mDescriptor);
 }
 
-void
-TextureClient::Updated()
-{
-  if (mDescriptor.type() != SurfaceDescriptor::T__None &&
-      mDescriptor.type() != SurfaceDescriptor::Tnull_t) {
-    mForwarder->UpdateTexture(this, SurfaceDescriptor(mDescriptor));
-    mDescriptor = SurfaceDescriptor();
-  } else {
-    NS_WARNING("Trying to send a null SurfaceDescriptor.");
-  }
-}
-
-void
-TextureClient::SetIPDLActor(PTextureChild* aChild) {
-  mTextureChild = aChild;
-}
-
-
 TextureClientShmem::TextureClientShmem(CompositableForwarder* aForwarder,
-                                       CompositableType aCompositableType)
-  : TextureClient(aForwarder, aCompositableType)
+                                       const TextureInfo& aTextureInfo)
+  : TextureClient(aForwarder, aTextureInfo)
   , mSurface(nullptr)
   , mSurfaceAsImage(nullptr)
 {
 }
 
 void
 TextureClientShmem::ReleaseResources()
 {
@@ -89,16 +55,17 @@ TextureClientShmem::ReleaseResources()
 
   if (mTextureInfo.mTextureFlags & HostRelease) {
     mDescriptor = SurfaceDescriptor();
     return;
   }
 
   if (IsSurfaceDescriptorValid(mDescriptor)) {
     mForwarder->DestroySharedSurface(&mDescriptor);
+    mDescriptor = SurfaceDescriptor();
   }
 }
 
 void
 TextureClientShmem::EnsureAllocated(gfx::IntSize aSize,
                                     gfxASurface::gfxContentType aContentType)
 {
   if (aSize != mSize ||
@@ -205,25 +172,26 @@ void
 TextureClientShmemYCbCr::EnsureAllocated(gfx::IntSize aSize,
                                          gfxASurface::gfxContentType aType)
 {
   NS_RUNTIMEABORT("not enough arguments to do this (need both Y and CbCr sizes)");
 }
 
 
 TextureClientTile::TextureClientTile(const TextureClientTile& aOther)
-: TextureClient(aOther.mForwarder, aOther.mTextureInfo.mCompositableType)
-, mSurface(aOther.mSurface)
+  : TextureClient(aOther.mForwarder, aOther.mTextureInfo)
+  , mSurface(aOther.mSurface)
 {}
 
 TextureClientTile::~TextureClientTile()
 {}
 
-TextureClientTile::TextureClientTile(CompositableForwarder* aForwarder, CompositableType aCompositableType)
-  : TextureClient(aForwarder, aCompositableType)
+TextureClientTile::TextureClientTile(CompositableForwarder* aForwarder,
+                                     const TextureInfo& aTextureInfo)
+  : TextureClient(aForwarder, aTextureInfo)
   , mSurface(nullptr)
 {
   mTextureInfo.mTextureHostFlags = TEXTURE_HOST_TILED;
 }
 
 void
 TextureClientTile::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType)
 {
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -77,19 +77,17 @@ public:
    * The Lock* methods lock the texture client for drawing into, providing some
    * object that can be used for drawing to. Once the user is finished
    * with the object it should call Unlock.
    */
   virtual gfxImageSurface* LockImageSurface() { return nullptr; }
   virtual gfxASurface* LockSurface() { return nullptr; }
   virtual gfx::DrawTarget* LockDrawTarget() { return nullptr; }
 
-  // note that this is often used simply as a getter for mDescriptor, not to
-  // lock anything, that is probably bad.
-  virtual SurfaceDescriptor* LockSurfaceDescriptor() { return &mDescriptor; }
+  virtual SurfaceDescriptor* LockSurfaceDescriptor() { return GetDescriptor(); }
   virtual void ReleaseResources() {}
   /**
    * This unlocks the current DrawableTexture and allows the host to composite
    * it directly.
    */
   virtual void Unlock() {}
 
   /**
@@ -100,36 +98,24 @@ public:
                                gfxASurface::gfxContentType aType) = 0;
 
   /**
    * _Only_ used at the end of the layer transaction when receiving a reply from
    *  the compositor.
    */
   virtual void SetDescriptorFromReply(const SurfaceDescriptor& aDescriptor)
   {
-    // default implem
+    // default implementation
     SetDescriptor(aDescriptor);
   }
   virtual void SetDescriptor(const SurfaceDescriptor& aDescriptor)
   {
     mDescriptor = aDescriptor;
   }
-
-  /**
-   * Adds this TextureClient's data to the current layer transaction.
-   * Gives up ownership of any shared resource.
-   */
-  virtual void Updated();
-  virtual void Destroyed();
-
-  void SetIPDLActor(PTextureChild* aTextureChild);
-  PTextureChild* GetIPDLActor() const
-  {
-    return mTextureChild;
-  }
+  SurfaceDescriptor* GetDescriptor() { return &mDescriptor; }
 
   CompositableForwarder* GetForwarder() const
   {
     return mForwarder;
   }
 
   void SetFlags(TextureFlags aFlags)
   {
@@ -152,31 +138,30 @@ public:
   {
     return mAccessMode;
   }
 
   virtual gfxASurface::gfxContentType GetContentType() = 0;
 
 protected:
   TextureClient(CompositableForwarder* aForwarder,
-                CompositableType aCompositableType);
+                const TextureInfo& aTextureInfo);
 
   CompositableForwarder* mForwarder;
   // So far all TextureClients use a SurfaceDescriptor, so it makes sense to
   // keep the reference here.
   SurfaceDescriptor mDescriptor;
   TextureInfo mTextureInfo;
-  PTextureChild* mTextureChild;
   AccessMode mAccessMode;
 };
 
 class TextureClientShmem : public TextureClient
 {
 public:
-  TextureClientShmem(CompositableForwarder* aForwarder, CompositableType aCompositableType);
+  TextureClientShmem(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo);
   ~TextureClientShmem() { ReleaseResources(); }
 
   virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE
   {
     return aType == TEXTURE_SHMEM || aType == TEXTURE_CONTENT;
   }
   virtual gfxImageSurface* LockImageSurface() MOZ_OVERRIDE;
   virtual gfxASurface* LockSurface() MOZ_OVERRIDE { return GetSurface(); }
@@ -196,35 +181,35 @@ private:
   gfx::IntSize mSize;
 
   friend class CompositingFactory;
 };
 
 class TextureClientShmemYCbCr : public TextureClient
 {
 public:
-  TextureClientShmemYCbCr(CompositableForwarder* aForwarder, CompositableType aCompositableType)
-    : TextureClient(aForwarder, aCompositableType)
+  TextureClientShmemYCbCr(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
+    : TextureClient(aForwarder, aTextureInfo)
   { }
   ~TextureClientShmemYCbCr() { ReleaseResources(); }
 
   virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_YCBCR; }
   void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType) MOZ_OVERRIDE;
   virtual void SetDescriptorFromReply(const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
   virtual void SetDescriptor(const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
   virtual void ReleaseResources();
   virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return gfxASurface::CONTENT_COLOR_ALPHA; }
 };
 
 class TextureClientTile : public TextureClient
 {
 public:
   TextureClientTile(const TextureClientTile& aOther);
   TextureClientTile(CompositableForwarder* aForwarder,
-                    CompositableType aCompositableType);
+                    const TextureInfo& aTextureInfo);
   ~TextureClientTile();
 
   virtual void EnsureAllocated(gfx::IntSize aSize,
                                gfxASurface::gfxContentType aType) MOZ_OVERRIDE;
 
   virtual gfxImageSurface* LockImageSurface() MOZ_OVERRIDE;
 
   gfxReusableSurfaceWrapper* GetReusableSurfaceWrapper()
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -176,17 +176,17 @@ BasicTiledLayerBuffer::PaintThebes(const
 
 BasicTiledLayerTile
 BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile,
                                             const nsIntPoint& aTileOrigin,
                                             const nsIntRect& aDirtyRect)
 {
   if (aTile.IsPlaceholderTile()) {
     RefPtr<TextureClient> textureClient =
-      new TextureClientTile(mManager, BUFFER_TILED);
+      new TextureClientTile(mManager, TextureInfo(BUFFER_TILED));
     aTile.mTextureClient = static_cast<TextureClientTile*>(textureClient.get());
   }
   aTile.mTextureClient->EnsureAllocated(gfx::IntSize(GetTileLength(), GetTileLength()), GetContentType());
   gfxASurface* writableSurface = aTile.mTextureClient->LockImageSurface();
   // Bug 742100, this gfxContext really should live on the stack.
   nsRefPtr<gfxContext> ctxt = new gfxContext(writableSurface);
 
   if (mSinglePaintBuffer) {
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -27,27 +27,16 @@ CanvasLayerComposite::CanvasLayerComposi
 
 CanvasLayerComposite::~CanvasLayerComposite()
 {
   MOZ_COUNT_DTOR(CanvasLayerComposite);
 
   CleanupResources();
 }
 
-void
-CanvasLayerComposite::EnsureImageHost(CompositableType aHostType)
-{
-  if (!mImageHost ||
-      mImageHost->GetType() != aHostType) {
-    RefPtr<CompositableHost> bufferHost
-      = CompositableHost::Create(aHostType, mCompositeManager->GetCompositor());
-    mImageHost = static_cast<ImageHost*>(bufferHost.get());
-  }
-}
-
 void CanvasLayerComposite::SetCompositableHost(CompositableHost* aHost) {
   mImageHost = static_cast<ImageHost*>(aHost);
 }
 
 Layer*
 CanvasLayerComposite::GetLayer()
 {
   return this;
--- a/gfx/layers/composite/CanvasLayerComposite.h
+++ b/gfx/layers/composite/CanvasLayerComposite.h
@@ -67,16 +67,14 @@ public:
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return "CanvasLayerComposite"; }
 
 protected:
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
 #endif
 
 private:
-  void EnsureImageHost(CompositableType aHostType);
-
   RefPtr<ImageHost> mImageHost;
 };
 
 } /* layers */
 } /* mozilla */
 #endif /* GFX_CanvasLayerComposite_H */
--- a/gfx/layers/composite/CompositableHost.cpp
+++ b/gfx/layers/composite/CompositableHost.cpp
@@ -2,17 +2,16 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "CompositableHost.h"
 #include "ImageHost.h"
 #include "ContentHost.h"
 #include "TiledContentHost.h"
-#include "mozilla/layers/TextureParent.h"
 #include "Effects.h"
 #include "mozilla/layers/CompositableTransactionParent.h"
 
 namespace mozilla {
 namespace layers {
 
 bool
 CompositableHost::Update(const SurfaceDescriptor& aImage,
@@ -39,72 +38,59 @@ CompositableHost::AddMaskEffect(EffectCh
                                              source->GetSize(),
                                              aTransform);
   effect->mIs3D = aIs3D;
   aEffects.mSecondaryEffects[EFFECT_MASK] = effect;
   return true;
 }
 
 /* static */ TemporaryRef<CompositableHost>
-CompositableHost::Create(CompositableType aType, Compositor* aCompositor)
+CompositableHost::Create(const TextureInfo& aTextureInfo, Compositor* aCompositor)
 {
   RefPtr<CompositableHost> result;
-  switch (aType) {
+  switch (aTextureInfo.mCompositableType) {
   case BUFFER_IMAGE_BUFFERED:
-    result = new ImageHostBuffered(aCompositor, aType);
+    result = new ImageHostBuffered(aTextureInfo, aCompositor);
     return result;
   case BUFFER_IMAGE_SINGLE:
-    result = new ImageHostSingle(aCompositor, aType);
+    result = new ImageHostSingle(aTextureInfo, aCompositor);
     return result;
   case BUFFER_TILED:
-    result = new TiledContentHost(aCompositor);
+    result = new TiledContentHost(aTextureInfo, aCompositor);
     return result;
   case BUFFER_CONTENT:
-    result = new ContentHostSingleBuffered(aCompositor);
+    result = new ContentHostSingleBuffered(aTextureInfo, aCompositor);
     return result;
   case BUFFER_CONTENT_DIRECT:
-    result = new ContentHostDoubleBuffered(aCompositor);
+    result = new ContentHostDoubleBuffered(aTextureInfo, aCompositor);
     return result;
   default:
     MOZ_NOT_REACHED("Unknown CompositableType");
     return nullptr;
   }
 }
 
-PTextureParent*
-CompositableParent::AllocPTexture(const TextureInfo& aInfo)
-{
-  return new TextureParent(aInfo, this);
-}
-
-bool
-CompositableParent::DeallocPTexture(PTextureParent* aActor)
-{
-  delete aActor;
-  return true;
-}
-
 void
 CompositableParent::ActorDestroy(ActorDestroyReason why)
 {
   if (mHost) {
     mHost->Detach();
   }
 }
 
 CompositableParent::CompositableParent(CompositableParentManager* aMgr,
-                                       CompositableType aType,
+                                       const TextureInfo& aTextureInfo,
                                        uint64_t aID)
 : mManager(aMgr)
-, mType(aType)
+, mType(aTextureInfo.mCompositableType)
 , mID(aID)
 , mCompositorID(0)
 {
   MOZ_COUNT_CTOR(CompositableParent);
-  mHost = CompositableHost::Create(aType);
+  mHost = CompositableHost::Create(aTextureInfo);
   if (aID) {
     CompositableMap::Set(aID, this);
   }
 }
 
 CompositableParent::~CompositableParent()
 {
   MOZ_COUNT_DTOR(CompositableParent);
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -43,29 +43,31 @@ class SurfaceDescriptor;
  *
  * Composite is called by the owning layer when it is composited. CompositableHost
  * will use its TextureHost(s) and call Compositor::DrawQuad to do the actual
  * rendering.
  */
 class CompositableHost : public RefCounted<CompositableHost>
 {
 public:
-  CompositableHost(Compositor* aCompositor = nullptr)
-    : mCompositor(aCompositor)
+  CompositableHost(const TextureInfo& aTextureInfo,
+                   Compositor* aCompositor = nullptr)
+    : mTextureInfo(aTextureInfo)
+    , mCompositor(aCompositor)
     , mLayer(nullptr)
   {
     MOZ_COUNT_CTOR(CompositableHost);
   }
 
   virtual ~CompositableHost()
   {
     MOZ_COUNT_DTOR(CompositableHost);
   }
 
-  static TemporaryRef<CompositableHost> Create(CompositableType aType,
+  static TemporaryRef<CompositableHost> Create(const TextureInfo& aTextureInfo,
                                                Compositor* aCompositor = nullptr);
 
   virtual CompositableType GetType() = 0;
 
   virtual void SetCompositor(Compositor* aCompositor)
   {
     mCompositor = aCompositor;
   }
@@ -83,33 +85,47 @@ public:
   /**
    * @return true if we should schedule a composition.
    */
   virtual bool Update(const SurfaceDescriptor& aImage,
                       SurfaceDescriptor* aResult = nullptr);
 
   /**
    * Update the content host.
-   * aTextureInfo identifies the texture host which should be updated.
-   * aNewBack is the new data
    * aUpdated is the region which should be updated
-   * aNewfront may point to the old data in this content host after the call
-   * aNewBackResult may point to the updated data in this content host
    * aUpdatedRegionBack is the region in aNewBackResult which has been updated
    */
   virtual void UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack)
   {
     MOZ_ASSERT(false, "should be implemented or not used");
   }
 
-  virtual void AddTextureHost(TextureHost* aTextureHost,
-                              ISurfaceAllocator* aAllocator = nullptr) = 0;
+  /**
+   * Ensure that a suitable texture host exists in this compositable. The
+   * compositable host may or may not create a new texture host. If a texture
+   * host is replaced, then the compositable is responsible for enusring it is
+   * destroyed correctly (without leaking resources).
+   * aTextureId - identifies the texture within the compositable, how the
+   * compositable chooses to use this is between the compositable client and
+   * host and will vary between types of compositable.
+   * aSurface - the new or existing texture host should support surface
+   * descriptors of the same type and, if necessary, this specific surface
+   * descriptor. Whether it is necessary or not depends on the protocol between
+   * the compositable client and host.
+   * aAllocator - the allocator used to allocate and de-allocate resources.
+   * aTextureInfo - contains flags for the texture.
+   */
+  virtual bool EnsureTextureHost(TextureIdentifier aTextureId,
+                                 const SurfaceDescriptor& aSurface,
+                                 ISurfaceAllocator* aAllocator,
+                                 const TextureInfo& aTextureInfo) = 0;
+
   virtual TextureHost* GetTextureHost() { return nullptr; }
 
   virtual LayerRenderState GetRenderState() = 0;
 
   virtual void SetPictureRect(const nsIntRect& aPictureRect)
   {
     MOZ_ASSERT(false, "Should have been overridden");
   }
@@ -140,30 +156,30 @@ public:
     SetCompositor(nullptr);
   }
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix) { }
 #endif
 
 protected:
+  TextureInfo mTextureInfo;
   Compositor* mCompositor;
   Layer* mLayer;
 };
 
 class CompositableParentManager;
 
 class CompositableParent : public PCompositableParent
 {
 public:
   CompositableParent(CompositableParentManager* aMgr,
-                     CompositableType aType, uint64_t aID = 0);
+                     const TextureInfo& aTextureInfo,
+                     uint64_t aID = 0);
   ~CompositableParent();
-  PTextureParent* AllocPTexture(const TextureInfo& aInfo) MOZ_OVERRIDE;
-  bool DeallocPTexture(PTextureParent* aActor) MOZ_OVERRIDE;
 
   virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
   CompositableHost* GetCompositableHost() const
   {
     return mHost;
   }
 
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -6,18 +6,19 @@
 #include "mozilla/layers/ContentHost.h"
 #include "mozilla/layers/Effects.h"
 #include "nsPrintfCString.h"
 
 namespace mozilla {
 using namespace gfx;
 namespace layers {
 
-ContentHostBase::ContentHostBase(Compositor* aCompositor)
-  : ContentHost(aCompositor)
+ContentHostBase::ContentHostBase(const TextureInfo& aTextureInfo,
+                                 Compositor* aCompositor)
+  : ContentHost(aTextureInfo, aCompositor)
   , mPaintWillResample(false)
   , mInitialised(false)
 {}
 
 ContentHostBase::~ContentHostBase()
 {}
 
 TextureHost*
@@ -199,22 +200,34 @@ ContentHostBase::SetCompositor(Composito
 }
 
 ContentHostSingleBuffered::~ContentHostSingleBuffered()
 {
   DestroyTextures();
   DestroyFrontHost();
 }
 
-void
-ContentHostSingleBuffered::SetTextureHosts(TextureHost* aNewFront,
-                                           TextureHost* aNewBack /*=nullptr*/)
+bool
+ContentHostSingleBuffered::EnsureTextureHost(TextureIdentifier aTextureId,
+                                             const SurfaceDescriptor& aSurface,
+                                             ISurfaceAllocator* aAllocator,
+                                             const TextureInfo& aTextureInfo)
 {
-  MOZ_ASSERT(!aNewBack);
-  mNewFrontHost = aNewFront;
+  MOZ_ASSERT(aTextureId == TextureFront);
+  mNewFrontHost = TextureHost::CreateTextureHost(aSurface.type(),
+                                                 aTextureInfo.mTextureHostFlags,
+                                                 aTextureInfo.mTextureFlags);
+
+  mNewFrontHost->SetBuffer(new SurfaceDescriptor(aSurface), aAllocator);
+  Compositor* compositor = GetCompositor();
+  if (compositor) {
+    mNewFrontHost->SetCompositor(compositor);
+  }
+
+  return true;
 }
 
 void
 ContentHostSingleBuffered::DestroyTextures()
 {
   MOZ_ASSERT(!mNewFrontHost || mNewFrontHost->GetDeAllocator(),
              "We won't be able to destroy our SurfaceDescriptor");
   mNewFrontHost = nullptr;
@@ -270,27 +283,46 @@ ContentHostSingleBuffered::UpdateThebes(
 }
 
 ContentHostDoubleBuffered::~ContentHostDoubleBuffered()
 {
   DestroyTextures();
   DestroyFrontHost();
 }
 
-void
-ContentHostDoubleBuffered::SetTextureHosts(TextureHost* aNewFront,
-                                           TextureHost* aNewBack /*=nullptr*/)
+bool
+ContentHostDoubleBuffered::EnsureTextureHost(TextureIdentifier aTextureId,
+                                             const SurfaceDescriptor& aSurface,
+                                             ISurfaceAllocator* aAllocator,
+                                             const TextureInfo& aTextureInfo)
 {
-  MOZ_ASSERT(aNewBack);
-  // the actual TextureHosts are created in reponse to the PTexture constructor
-  // we just match them up here
-  mNewFrontHost = aNewFront;
-  mBackHost = aNewBack;
-  mBufferRect = nsIntRect();
-  mBufferRotation = nsIntPoint();
+  RefPtr<TextureHost> newHost = TextureHost::CreateTextureHost(aSurface.type(),
+                                                               aTextureInfo.mTextureHostFlags,
+                                                               aTextureInfo.mTextureFlags);
+
+  newHost->SetBuffer(new SurfaceDescriptor(aSurface), aAllocator);
+
+  Compositor* compositor = GetCompositor();
+  if (compositor) {
+    newHost->SetCompositor(compositor);
+  }
+
+  if (aTextureId == TextureFront) {
+    mNewFrontHost = newHost;
+    return true;
+  }
+  if (aTextureId == TextureBack) {
+    mBackHost = newHost;
+    mBufferRect = nsIntRect();
+    mBufferRotation = nsIntPoint();
+    return true;
+  }
+
+  NS_ERROR("Bad texture identifier");
+  return false;
 }
 
 void
 ContentHostDoubleBuffered::DestroyTextures()
 {
   if (mNewFrontHost) {
     MOZ_ASSERT(mNewFrontHost->GetDeAllocator(),
                "We won't be able to destroy our SurfaceDescriptor");
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -34,18 +34,18 @@ public:
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack) = 0;
 
 #ifdef MOZ_DUMP_PAINTING
   virtual already_AddRefed<gfxImageSurface> Dump() { return nullptr; }
 #endif
 
 protected:
-  ContentHost(Compositor* aCompositor)
-  : CompositableHost(aCompositor)
+  ContentHost(const TextureInfo& aTextureInfo, Compositor* aCompositor)
+    : CompositableHost(aTextureInfo, aCompositor)
   {}
 };
 
 /**
  * Base class for non-tiled ContentHosts.
  *
  * Ownership of the SurfaceDescriptor and the resources it represents is passed
  * from the ContentClient to the ContentHost when the TextureClient/Hosts are
@@ -56,17 +56,17 @@ protected:
  * they are recreated or the ContentHost dies.
  */
 class ContentHostBase : public ContentHost
 {
 public:
   typedef ThebesLayerBuffer::ContentType ContentType;
   typedef ThebesLayerBuffer::PaintState PaintState;
 
-  ContentHostBase(Compositor* aCompositor);
+  ContentHostBase(const TextureInfo& aTextureInfo, Compositor* aCompositor);
   ~ContentHostBase();
 
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Point& aOffset,
                          const gfx::Filter& aFilter,
                          const gfx::Rect& aClipRect,
@@ -92,24 +92,16 @@ public:
 
 #ifdef MOZ_DUMP_PAINTING
   virtual already_AddRefed<gfxImageSurface> Dump()
   {
     return mTextureHost->Dump();
   }
 #endif
 
-  // Set one or both texture hosts. We do not use AddTextureHost because for
-  // double buffering, we need to add two hosts and know which is which.
-  virtual void SetTextureHosts(TextureHost* aNewFront,
-                               TextureHost* aNewBack = nullptr) = 0;
-  // For double buffered ContentHosts we want to set both TextureHosts at
-  // once so we ignore this call.
-  virtual void AddTextureHost(TextureHost* aTextureHost,
-                              ISurfaceAllocator* aAllocator = nullptr) MOZ_OVERRIDE {}
   virtual TextureHost* GetTextureHost() MOZ_OVERRIDE;
 
   void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }
   // The client has destroyed its texture clients and we should destroy our
   // texture hosts and SurfaceDescriptors. Note that we don't immediately
   // destroy our front buffer so that we can continue to composite.
   virtual void DestroyTextures() = 0;
 
@@ -138,32 +130,34 @@ protected:
 };
 
 /**
  * Double buffering is implemented by swapping the front and back TextureHosts.
  */
 class ContentHostDoubleBuffered : public ContentHostBase
 {
 public:
-  ContentHostDoubleBuffered(Compositor* aCompositor)
-    : ContentHostBase(aCompositor)
+  ContentHostDoubleBuffered(const TextureInfo& aTextureInfo,
+                            Compositor* aCompositor)
+    : ContentHostBase(aTextureInfo, aCompositor)
   {}
 
   ~ContentHostDoubleBuffered();
 
   virtual CompositableType GetType() { return BUFFER_CONTENT_DIRECT; }
 
   virtual void UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack);
 
-  // We expect both TextureHosts.
-  virtual void SetTextureHosts(TextureHost* aNewFront,
-                               TextureHost* aNewBack = nullptr) MOZ_OVERRIDE;
+  virtual bool EnsureTextureHost(TextureIdentifier aTextureId,
+                                 const SurfaceDescriptor& aSurface,
+                                 ISurfaceAllocator* aAllocator,
+                                 const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
   virtual void DestroyTextures() MOZ_OVERRIDE;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 #endif
 protected:
   nsIntRegion mValidRegionForNextBackBuffer;
   // Texture host for the back buffer. We never read or write this buffer. We
@@ -174,31 +168,33 @@ protected:
 
 /**
  * Single buffered, therefore we must synchronously upload the image from the
  * TextureHost in the layers transaction (i.e., in UpdateThebes).
  */
 class ContentHostSingleBuffered : public ContentHostBase
 {
 public:
-  ContentHostSingleBuffered(Compositor* aCompositor)
-    : ContentHostBase(aCompositor)
+  ContentHostSingleBuffered(const TextureInfo& aTextureInfo,
+                            Compositor* aCompositor)
+    : ContentHostBase(aTextureInfo, aCompositor)
   {}
   virtual ~ContentHostSingleBuffered();
 
   virtual CompositableType GetType() { return BUFFER_CONTENT; }
 
   virtual void UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack);
 
-  // We expect only one TextureHost.
-  virtual void SetTextureHosts(TextureHost* aNewFront,
-                               TextureHost* aNewBack = nullptr) MOZ_OVERRIDE;
+  virtual bool EnsureTextureHost(TextureIdentifier aTextureId,
+                                 const SurfaceDescriptor& aSurface,
+                                 ISurfaceAllocator* aAllocator,
+                                 const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
   virtual void DestroyTextures() MOZ_OVERRIDE;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 #endif
 };
 
 }
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -19,23 +19,38 @@ namespace layers {
 void
 ImageHostSingle::SetCompositor(Compositor* aCompositor) {
   CompositableHost::SetCompositor(aCompositor);
   if (mTextureHost) {
     mTextureHost->SetCompositor(aCompositor);
   }
 }
 
-void
-ImageHostSingle::AddTextureHost(TextureHost* aHost, ISurfaceAllocator* aAllocator)
+bool
+ImageHostSingle::EnsureTextureHost(TextureIdentifier aTextureId,
+                                   const SurfaceDescriptor& aSurface,
+                                   ISurfaceAllocator* aAllocator,
+                                   const TextureInfo& aTextureInfo)
 {
-  mTextureHost = aHost;
-  if (mCompositor) {
-    mTextureHost->SetCompositor(mCompositor);
+  if (mTextureHost &&
+      mTextureHost->GetBuffer() &&
+      mTextureHost->GetBuffer()->type() == aSurface.type()) {
+    return false;
   }
+
+  mTextureHost = TextureHost::CreateTextureHost(aSurface.type(),
+                                                mTextureInfo.mTextureHostFlags,
+                                                mTextureInfo.mTextureFlags);
+
+  Compositor* compositor = GetCompositor();
+  if (compositor) {
+    mTextureHost->SetCompositor(compositor);
+  }
+
+  return true;
 }
 
 void
 ImageHostSingle::Composite(EffectChain& aEffectChain,
                            float aOpacity,
                            const gfx::Matrix4x4& aTransform,
                            const gfx::Point& aOffset,
                            const gfx::Filter& aFilter,
@@ -129,24 +144,28 @@ ImageHostBuffered::Update(const SurfaceD
   if (!GetTextureHost()) {
     *aResult = aImage;
     return false;
   }
   GetTextureHost()->SwapTextures(aImage, aResult);
   return GetTextureHost()->IsValid();
 }
 
-void
-ImageHostBuffered::AddTextureHost(TextureHost* aHost,
-                                  ISurfaceAllocator* aAllocator)
+bool
+ImageHostBuffered::EnsureTextureHost(TextureIdentifier aTextureId,
+                                     const SurfaceDescriptor& aSurface,
+                                     ISurfaceAllocator* aAllocator,
+                                     const TextureInfo& aTextureInfo)
 {
-  MOZ_ASSERT(aAllocator);
-  mTextureHost = aHost;
-  if (mCompositor) {
-    mTextureHost->SetCompositor(mCompositor);
+  bool result = ImageHostSingle::EnsureTextureHost(aTextureId,
+                                                   aSurface,
+                                                   aAllocator,
+                                                   aTextureInfo);
+  if (result) {
+    mTextureHost->SetBuffer(new SurfaceDescriptor(null_t()), aAllocator);
+    mPictureRect = nsIntRect(0, 0, -1, -1);
   }
-  mTextureHost->SetBuffer(new SurfaceDescriptor(null_t()),
-                          aAllocator);
-  mPictureRect = nsIntRect(0, 0, -1, -1);
+
+  return result;
 }
 
 }
 }
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -19,43 +19,44 @@ namespace layers {
  * ImageHosts support Update., not UpdateThebes().
  */
 class ImageHost : public CompositableHost
 {
 public:
   TextureHost* GetTextureHost() MOZ_OVERRIDE { return nullptr; }
 
 protected:
-  ImageHost(Compositor* aCompositor)
-  : CompositableHost(aCompositor)
+  ImageHost(const TextureInfo& aTextureInfo, Compositor* aCompositor)
+  : CompositableHost(aTextureInfo, aCompositor)
   {
     MOZ_COUNT_CTOR(ImageHost);
   }
 
   ~ImageHost()
   {
     MOZ_COUNT_DTOR(ImageHost);
   }
 };
 
 // ImageHost with a single TextureHost
 class ImageHostSingle : public ImageHost
 {
 public:
-  ImageHostSingle(Compositor* aCompositor, CompositableType aType)
-    : ImageHost(aCompositor)
+  ImageHostSingle(const TextureInfo& aTextureInfo, Compositor* aCompositor)
+    : ImageHost(aTextureInfo, aCompositor)
     , mTextureHost(nullptr)
-    , mType(aType)
     , mHasPictureRect(false)
   {}
 
-  virtual CompositableType GetType() { return mType; }
+  virtual CompositableType GetType() { return mTextureInfo.mCompositableType; }
 
-  virtual void AddTextureHost(TextureHost* aTextureHost,
-                              ISurfaceAllocator* aAllocator = nullptr) MOZ_OVERRIDE;
+  virtual bool EnsureTextureHost(TextureIdentifier aTextureId,
+                                 const SurfaceDescriptor& aSurface,
+                                 ISurfaceAllocator* aAllocator,
+                                 const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
 
   TextureHost* GetTextureHost() MOZ_OVERRIDE { return mTextureHost; }
 
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Point& aOffset,
                          const gfx::Filter& aFilter,
@@ -84,33 +85,35 @@ public:
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 #endif
 
 protected:
   RefPtr<TextureHost> mTextureHost;
   nsIntRect mPictureRect;
-  CompositableType mType;
   bool mHasPictureRect;
 };
 
 // Double buffered ImageHost. We have a single TextureHost and double buffering
 // is done at the TextureHost/Client level. This is in contrast with buffered
 // ContentHosts which do their own double buffering 
 class ImageHostBuffered : public ImageHostSingle
 {
 public:
-  ImageHostBuffered(Compositor* aCompositor, CompositableType aType)
-    : ImageHostSingle(aCompositor, aType)
+  ImageHostBuffered(const TextureInfo& aTextureInfo, Compositor* aCompositor)
+    : ImageHostSingle(aTextureInfo, aCompositor)
   {}
 
   virtual bool Update(const SurfaceDescriptor& aImage,
                       SurfaceDescriptor* aResult = nullptr) MOZ_OVERRIDE;
 
-  virtual void AddTextureHost(TextureHost* aTextureHost,
-                              ISurfaceAllocator* aAllocator = nullptr) MOZ_OVERRIDE;
+  virtual bool EnsureTextureHost(TextureIdentifier aTextureId,
+                                 const SurfaceDescriptor& aSurface,
+                                 ISurfaceAllocator* aAllocator,
+                                 const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
+
 };
 
 }
 }
 
 #endif
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -285,17 +285,17 @@ public:
     MOZ_ASSERT(false, "called SetCompositableHost for a layer without a compositable host");
   }
   virtual CompositableHost* GetCompositableHost() = 0;
 
   virtual void CleanupResources() = 0;
 
   virtual TiledLayerComposer* AsTiledLayerComposer() { return NULL; }
 
-  virtual void EnsureBuffer(CompositableType aHostType)
+  virtual void EnsureBuffer(CompositableType aType)
   {
     MOZ_ASSERT(false, "Should not be called unless overriden.");
   }
 
 protected:
   LayerManagerComposite* mCompositeManager;
   RefPtr<Compositor> mCompositor;
   bool mDestroyed;
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -40,17 +40,16 @@ TextureHost::CreateTextureHost(SurfaceDe
   }
 }
 
 
 TextureHost::TextureHost()
   : mFlags(0)
   , mBuffer(nullptr)
   , mFormat(gfx::FORMAT_UNKNOWN)
-  , mTextureParent(nullptr)
   , mDeAllocator(nullptr)
 {
   MOZ_COUNT_CTOR(TextureHost);
 }
 
 TextureHost::~TextureHost()
 {
   if (mBuffer) {
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -227,29 +227,16 @@ public:
   }
 
   LayerRenderState GetRenderState()
   {
     return LayerRenderState(mBuffer,
                             mFlags & NeedsYFlip ? LAYER_RENDER_STATE_Y_FLIPPED : 0);
   }
 
-  // IPC
-
-  void SetTextureParent(TextureParent* aParent)
-  {
-    MOZ_ASSERT(!mTextureParent || mTextureParent == aParent);
-    mTextureParent = aParent;
-  }
-
-  TextureParent* GetIPDLActor() const
-  {
-    return mTextureParent;
-  }
-
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char *Name() = 0;
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 #endif
 
 
   SurfaceDescriptor* GetBuffer() const { return mBuffer; }
   /**
@@ -301,17 +288,16 @@ protected:
     return reinterpret_cast<uint64_t>(this);
   }
 
   // Texture info
   TextureFlags mFlags;
   SurfaceDescriptor* mBuffer;
   gfx::SurfaceFormat mFormat;
 
-  TextureParent* mTextureParent;
   ISurfaceAllocator* mDeAllocator;
 };
 
 
 /**
  * This can be used as an offscreen rendering target by the compositor, and
  * subsequently can be used as a source by the compositor.
  */
--- a/gfx/layers/composite/ThebesLayerComposite.cpp
+++ b/gfx/layers/composite/ThebesLayerComposite.cpp
@@ -43,23 +43,24 @@ ThebesLayerComposite::~ThebesLayerCompos
 
 void
 ThebesLayerComposite::SetCompositableHost(CompositableHost* aHost)
 {
   mBuffer= static_cast<ContentHost*>(aHost);
 }
 
 void
-ThebesLayerComposite::EnsureBuffer(CompositableType aHostType)
+ThebesLayerComposite::EnsureBuffer(CompositableType aType)
 {
-  MOZ_ASSERT(aHostType == BUFFER_TILED, "Should only be called for tiled layers.");
+  MOZ_ASSERT(aType == BUFFER_TILED,
+             "Should only be called for tiled layers.");
   if (!mBuffer ||
-      mBuffer->GetType() != aHostType) {
+      mBuffer->GetType() != aType) {
     RefPtr<CompositableHost> bufferHost
-      = CompositableHost::Create(aHostType, mCompositeManager->GetCompositor());
+      = CompositableHost::Create(TextureInfo(aType), mCompositeManager->GetCompositor());
     NS_ASSERTION(bufferHost->GetType() == BUFFER_TILED, "bad buffer type");
     mBuffer = static_cast<ContentHost*>(bufferHost.get());
     mRequiresTiledProperties = true;
   }
 }
 
 void
 ThebesLayerComposite::Disconnect()
--- a/gfx/layers/composite/ThebesLayerComposite.h
+++ b/gfx/layers/composite/ThebesLayerComposite.h
@@ -53,17 +53,17 @@ public:
                            const nsIntRect& aClipRect) MOZ_OVERRIDE;
 
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   virtual void SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
-  virtual void EnsureBuffer(CompositableType aHostType) MOZ_OVERRIDE;
+  virtual void EnsureBuffer(CompositableType aType) MOZ_OVERRIDE;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return "ThebesLayerComposite"; }
 
 protected:
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
 #endif
 
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -279,17 +279,17 @@ TiledContentHost::RenderLayerBuffer(Tile
 void
 TiledTexture::Validate(gfxReusableSurfaceWrapper* aReusableSurface, Compositor* aCompositor, uint16_t aSize)
 {
   TextureFlags flags = 0;
   if (!mTextureHost) {
     // convert placeholder tile to a real tile
     mTextureHost = TextureHost::CreateTextureHost(SurfaceDescriptor::Tnull_t,
                                                   TEXTURE_HOST_TILED,
-                                                  0);
+                                                  flags);
     mTextureHost->SetCompositor(aCompositor);
     flags |= NewTile;
   }
 
   mTextureHost->Update(aReusableSurface, flags, gfx::IntSize(aSize, aSize));
 }
 
 #ifdef MOZ_LAYERS_HAVE_LOG
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -121,18 +121,18 @@ class TiledThebesLayerComposite;
  * on the tile (via ValidateTile and Update), that calls Update on the texture host,
  * which works as for regular texture hosts. Rendering takes us to RenderTile which
  * is similar to Composite for non-tiled ContentHosts.
  */
 class TiledContentHost : public ContentHost,
                          public TiledLayerComposer
 {
 public:
-  TiledContentHost(Compositor* aCompositor)
-    : ContentHost(aCompositor)
+  TiledContentHost(const TextureInfo& aTextureInfo, Compositor* aCompositor)
+    : ContentHost(aTextureInfo, aCompositor)
     , mVideoMemoryTiledBuffer(aCompositor)
     , mLowPrecisionVideoMemoryTiledBuffer(aCompositor)
     , mPendingUpload(false)
     , mPendingLowPrecisionUpload(false)
   {}
   ~TiledContentHost();
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE
@@ -176,20 +176,23 @@ public:
                  const gfx::Rect& aClipRect,
                  const nsIntRegion* aVisibleRegion = nullptr,
                  TiledLayerProperties* aLayerProperties = nullptr);
 
   virtual CompositableType GetType() { return BUFFER_TILED; }
 
   virtual TiledLayerComposer* AsTiledLayerComposer() { return this; }
 
-  virtual void AddTextureHost(TextureHost* aTextureHost,
-                              ISurfaceAllocator* aAllocator = nullptr)
+  virtual bool EnsureTextureHost(TextureIdentifier aTextureId,
+                                 const SurfaceDescriptor& aSurface,
+                                 ISurfaceAllocator* aAllocator,
+                                 const TextureInfo& aTextureInfo) MOZ_OVERRIDE
   {
-    MOZ_ASSERT(false, "Does nothing");
+    MOZ_NOT_REACHED("Does nothing");
+    return false;
   }
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 #endif
 
 private:
   void ProcessUploadQueue(nsIntRegion* aNewValidRegion,
--- a/gfx/layers/ipc/CompositableForwarder.h
+++ b/gfx/layers/ipc/CompositableForwarder.h
@@ -51,37 +51,40 @@ public:
    * TextureClient/Host pairs without sending SurfaceDescriptors,
    * use these messages to assign the single or double buffer
    * (TextureClient/Host pairs) to the CompositableHost.
    * We expect the textures to already have been created.
    * With these messages, the ownership of the SurfaceDescriptor(s)
    * moves to the compositor.
    */
   virtual void CreatedSingleBuffer(CompositableClient* aCompositable,
-                                   TextureClient* aBuffer) = 0;
+                                   const SurfaceDescriptor& aDescriptor,
+                                   const TextureInfo& aTextureInfo) = 0;
   virtual void CreatedDoubleBuffer(CompositableClient* aCompositable,
-                                   TextureClient* aFront,
-                                   TextureClient* aBack) = 0;
+                                   const SurfaceDescriptor& aFrontDescriptor,
+                                   const SurfaceDescriptor& aBackDescriptor,
+                                   const TextureInfo& aTextureInfo) = 0;
 
   /**
    * Tell the compositor that a Compositable is killing its buffer(s),
    * that is TextureClient/Hosts.
    */
   virtual void DestroyThebesBuffer(CompositableClient* aCompositable) = 0;
 
   /**
-   * Communicate to the compositor that the texture identified by aLayer
-   * and aIdentifier has been updated to aImage.
+   * Communicate to the compositor that the texture identified by aCompositable
+   * and aTextureId has been updated to aImage.
    */
-  virtual void UpdateTexture(TextureClient* aTexture,
-                             const SurfaceDescriptor& aImage) = 0;
+  virtual void UpdateTexture(CompositableClient* aCompositable,
+                             TextureIdentifier aTextureId,
+                             SurfaceDescriptor* aDescriptor) = 0;
 
   /**
-   * Communicate to the compositor that aRegion in the texture identified by aLayer
-   * and aIdentifier has been updated to aThebesBuffer.
+   * Communicate to the compositor that aRegion in the texture identified by
+   * aCompositable and aIdentifier has been updated to aThebesBuffer.
    */
   virtual void UpdateTextureRegion(CompositableClient* aCompositable,
                                    const ThebesBufferData& aThebesBufferData,
                                    const nsIntRegion& aUpdatedRegion) = 0;
 
   /**
    * Communicate the picture rect of a YUV image in aLayer to the compositor
    */
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -8,91 +8,73 @@
 #include "CompositableTransactionParent.h"
 #include "ShadowLayers.h"
 #include "RenderTrace.h"
 #include "ShadowLayersManager.h"
 #include "CompositableHost.h"
 #include "mozilla/layers/ContentHost.h"
 #include "ShadowLayerParent.h"
 #include "TiledLayerBuffer.h"
-#include "mozilla/layers/TextureParent.h"
 #include "LayerManagerComposite.h"
 #include "CompositorParent.h"
 
 namespace mozilla {
 namespace layers {
 
-//--------------------------------------------------
-// Convenience accessors
-template<class OpPaintT>
-Layer* GetLayerFromOpPaint(const OpPaintT& op)
-{
-  PTextureParent* textureParent = op.textureParent();
-  CompositableHost* compoHost
-    = static_cast<CompositableParent*>(textureParent->Manager())->GetCompositableHost();
-  return compoHost ? compoHost->GetLayer() : nullptr;
-}
-
 bool
 CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation& aEdit,
                                                      EditReplyVector& replyv)
 {
   switch (aEdit.type()) {
     case CompositableOperation::TOpCreatedSingleBuffer: {
       MOZ_LAYERS_LOG(("[ParentSide] Created single buffer"));
       const OpCreatedSingleBuffer& op = aEdit.get_OpCreatedSingleBuffer();
       CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
-      TextureParent* textureParent = static_cast<TextureParent*>(op.bufferParent());
+      ContentHostBase* content = static_cast<ContentHostBase*>(compositableParent->GetCompositableHost());
 
-      textureParent->EnsureTextureHost(op.descriptor().type());
-      textureParent->GetTextureHost()->SetBuffer(new SurfaceDescriptor(op.descriptor()),
-                                                 compositableParent->GetCompositableManager());
-
-      ContentHostBase* content = static_cast<ContentHostBase*>(compositableParent->GetCompositableHost());
-      content->SetTextureHosts(textureParent->GetTextureHost());
+      content->EnsureTextureHost(TextureFront, op.descriptor(),
+                                 compositableParent->GetCompositableManager(),
+                                 op.textureInfo());
 
       break;
     }
     case CompositableOperation::TOpCreatedDoubleBuffer: {
       MOZ_LAYERS_LOG(("[ParentSide] Created double buffer"));
       const OpCreatedDoubleBuffer& op = aEdit.get_OpCreatedDoubleBuffer();
       CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
-      TextureParent* frontParent = static_cast<TextureParent*>(op.frontParent());
-      TextureParent* backParent = static_cast<TextureParent*>(op.backParent());
-
+      ContentHostBase* content = static_cast<ContentHostBase*>(compositableParent->GetCompositableHost());
 
-      frontParent->EnsureTextureHost(op.frontDescriptor().type());
-      backParent->EnsureTextureHost(op.backDescriptor().type());
-      frontParent->GetTextureHost()->SetBuffer(new SurfaceDescriptor(op.frontDescriptor()),
-                                               compositableParent->GetCompositableManager());
-      backParent->GetTextureHost()->SetBuffer(new SurfaceDescriptor(op.backDescriptor()),
-                                              compositableParent->GetCompositableManager());
-
-      ContentHostBase* content = static_cast<ContentHostBase*>(compositableParent->GetCompositableHost());
-      content->SetTextureHosts(frontParent->GetTextureHost(),
-                               backParent->GetTextureHost());
+      content->EnsureTextureHost(TextureFront, op.frontDescriptor(),
+                                 compositableParent->GetCompositableManager(),
+                                 op.textureInfo());
+      content->EnsureTextureHost(TextureBack, op.backDescriptor(),
+                                 compositableParent->GetCompositableManager(),
+                                 op.textureInfo());
 
       break;
     }
     case CompositableOperation::TOpDestroyThebesBuffer: {
       MOZ_LAYERS_LOG(("[ParentSide] Created double buffer"));
       const OpDestroyThebesBuffer& op = aEdit.get_OpDestroyThebesBuffer();
       CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
       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();
 
-      TextureParent* textureParent = static_cast<TextureParent*>(op.textureParent());
-      CompositableHost* compositable = textureParent->GetCompositableHost();
-      Layer* layer = GetLayerFromOpPaint(op);
+      CompositableParent* compositableParent =
+        static_cast<CompositableParent*>(op.compositableParent());
+      CompositableHost* compositable =
+        compositableParent->GetCompositableHost();
+
+      Layer* layer = compositable ? compositable->GetLayer() : nullptr;
       ShadowLayer* shadowLayer = layer ? layer->AsShadowLayer() : nullptr;
       if (shadowLayer) {
         Compositor* compositor = static_cast<LayerManagerComposite*>(layer->Manager())->GetCompositor();
         compositable->SetCompositor(compositor);
         compositable->SetLayer(layer);
       } else {
         // if we reach this branch, it most likely means that async textures
         // are coming in before we had time to attach the conmpositable to a
@@ -100,28 +82,31 @@ CompositableParentManager::ReceiveCompos
         // happening continuously, though.
       }
 
       if (layer) {
         RenderTraceInvalidateStart(layer, "FF00FF", layer->GetVisibleRegion().GetBounds());
       }
 
       const SurfaceDescriptor& descriptor = op.image();
-      textureParent->EnsureTextureHost(descriptor.type());
-      MOZ_ASSERT(textureParent->GetTextureHost());
+      compositable->EnsureTextureHost(op.textureId(),
+                                      descriptor,
+                                      compositableParent->GetCompositableManager(),
+                                      TextureInfo());
+      MOZ_ASSERT(compositable->GetTextureHost());
 
       SurfaceDescriptor newBack;
-      bool shouldRecomposite = compositable->Update(op.image(), &newBack);
+      bool shouldRecomposite = compositable->Update(descriptor, &newBack);
       if (IsSurfaceDescriptorValid(newBack)) {
-        replyv.push_back(OpTextureSwap(op.textureParent(), nullptr, newBack));
+        replyv.push_back(OpTextureSwap(compositableParent, nullptr, op.textureId(), newBack));
       }
 
-      if (shouldRecomposite && textureParent->GetCompositorID()) {
+      if (shouldRecomposite && compositableParent->GetCompositorID()) {
         CompositorParent* cp
-          = CompositorParent::GetCompositor(textureParent->GetCompositorID());
+          = CompositorParent::GetCompositor(compositableParent->GetCompositorID());
         if (cp) {
           cp->ScheduleComposition();
         }
       }
 
       if (layer) {
         RenderTraceInvalidateEnd(layer, "FF00FF");
       }
--- a/gfx/layers/ipc/CompositorChild.cpp
+++ b/gfx/layers/ipc/CompositorChild.cpp
@@ -25,16 +25,17 @@ CompositorChild::CompositorChild(LayerMa
 CompositorChild::~CompositorChild()
 {
   MOZ_COUNT_DTOR(CompositorChild);
 }
 
 void
 CompositorChild::Destroy()
 {
+  mLayerManager->Destroy();
   mLayerManager = NULL;
   while (size_t len = ManagedPLayersChild().Length()) {
     ShadowLayersChild* layers =
       static_cast<ShadowLayersChild*>(ManagedPLayersChild()[len - 1]);
     layers->Destroy();
   }
   SendStop();
 }
--- a/gfx/layers/ipc/ImageBridgeChild.cpp
+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
@@ -7,17 +7,16 @@
 
 #include "CompositorParent.h" // for CompositorParent::CompositorLoop
 #include "ImageBridgeChild.h"
 #include "ImageBridgeParent.h"
 #include "gfxSharedImageSurface.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/layers/CompositableClient.h"
-#include "mozilla/layers/TextureChild.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/ImageClient.h"
 #include "mozilla/layers/LayersTypes.h"
 
 using namespace base;
 using namespace mozilla::ipc;
 
@@ -73,23 +72,30 @@ struct CompositableTransaction
 
 struct AutoEndTransaction {
   AutoEndTransaction(CompositableTransaction* aTxn) : mTxn(aTxn) {}
   ~AutoEndTransaction() { mTxn->End(); }
   CompositableTransaction* mTxn;
 };
 
 void
-ImageBridgeChild::UpdateTexture(TextureClient* aTexture,
-                                const SurfaceDescriptor& aImage)
+ImageBridgeChild::UpdateTexture(CompositableClient* aCompositable,
+                                TextureIdentifier aTextureId,
+                                SurfaceDescriptor* aDescriptor)
 {
-  MOZ_ASSERT(aImage.type() != SurfaceDescriptor::T__None, "[debug] STOP");
-  MOZ_ASSERT(aTexture);
-  MOZ_ASSERT(aTexture->GetIPDLActor());
-  mTxn->AddEdit(OpPaintTexture(nullptr, aTexture->GetIPDLActor(), aImage));
+  if (aDescriptor->type() != SurfaceDescriptor::T__None &&
+      aDescriptor->type() != SurfaceDescriptor::Tnull_t) {
+    MOZ_ASSERT(aCompositable);
+    MOZ_ASSERT(aCompositable->GetIPDLActor());
+    mTxn->AddEdit(OpPaintTexture(nullptr, aCompositable->GetIPDLActor(), 1,
+                  SurfaceDescriptor(*aDescriptor)));
+    *aDescriptor = SurfaceDescriptor();
+  } else {
+    NS_WARNING("Trying to send a null SurfaceDescriptor.");
+  }
 }
 
 void
 ImageBridgeChild::UpdatePictureRect(CompositableClient* aCompositable,
                                     const nsIntRect& aRect)
 {
   mTxn->AddNoSwapEdit(OpUpdatePictureRect(nullptr, aCompositable->GetIPDLActor(), aRect));
 }
@@ -201,26 +207,26 @@ ImageBridgeChild::~ImageBridgeChild()
 }
 
 void
 ImageBridgeChild::Connect(CompositableClient* aCompositable)
 {
   MOZ_ASSERT(aCompositable);
   uint64_t id = 0;
   CompositableChild* child = static_cast<CompositableChild*>(
-    SendPCompositableConstructor(aCompositable->GetType(), &id));
+    SendPCompositableConstructor(aCompositable->GetTextureInfo(), &id));
   MOZ_ASSERT(child);
   child->SetAsyncID(id);
   aCompositable->SetIPDLActor(child);
   MOZ_ASSERT(child->GetAsyncID() == id);
   child->SetClient(aCompositable);
 }
 
 PCompositableChild*
-ImageBridgeChild::AllocPCompositable(const CompositableType& aType, uint64_t* aID)
+ImageBridgeChild::AllocPCompositable(const TextureInfo& aInfo, uint64_t* aID)
 {
   return new CompositableChild();
 }
 
 bool
 ImageBridgeChild::DeallocPCompositable(PCompositableChild* aActor)
 {
   delete aActor;
@@ -331,20 +337,24 @@ ImageBridgeChild::EndTransaction()
       return;
     }
   }
   for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
     const EditReply& reply = replies[i];
     switch (reply.type()) {
     case EditReply::TOpTextureSwap: {
       const OpTextureSwap& ots = reply.get_OpTextureSwap();
-      PTextureChild* textureChild = ots.textureChild();
-      MOZ_ASSERT(textureChild);
-      TextureClient* texClient = static_cast<TextureChild*>(textureChild)->GetTextureClient();
-      texClient->SetDescriptor(ots.image());
+
+      CompositableChild* compositableChild =
+          static_cast<CompositableChild*>(ots.compositableChild());
+
+      MOZ_ASSERT(compositableChild);
+
+      compositableChild->GetCompositableClient()
+        ->SetDescriptorFromReply(ots.textureId(), ots.image());
       break;
     }
     default:
       NS_RUNTIMEABORT("not reached");
     }
   }
 }
 
@@ -470,18 +480,17 @@ ImageBridgeChild::CreateImageClient(Comp
 }
 
 TemporaryRef<ImageClient>
 ImageBridgeChild::CreateImageClientNow(CompositableType aType)
 {
   mCompositorBackend = LAYERS_OPENGL;
 
   RefPtr<ImageClient> client
-    = ImageClient::CreateImageClient(mCompositorBackend,
-                                     aType, this, 0);
+    = ImageClient::CreateImageClient(mCompositorBackend, aType, this, 0);
   MOZ_ASSERT(client, "failed to create ImageClient");
   if (client) {
     client->Connect();
   }
   return client.forget();
 }
 
 PGrallocBufferChild*
--- a/gfx/layers/ipc/ImageBridgeChild.h
+++ b/gfx/layers/ipc/ImageBridgeChild.h
@@ -160,17 +160,17 @@ public:
 
   /**
    * Returns the ImageBridgeChild's message loop.
    *
    * Can be called from any thread.
    */
   MessageLoop * GetMessageLoop() const;
 
-  PCompositableChild* AllocPCompositable(const CompositableType& aType, uint64_t* aID) MOZ_OVERRIDE;
+  PCompositableChild* AllocPCompositable(const TextureInfo& aInfo, uint64_t* aID) MOZ_OVERRIDE;
   bool DeallocPCompositable(PCompositableChild* aActor) MOZ_OVERRIDE;
 
   /**
    * This must be called by the static function DeleteImageBridgeSync defined
    * in ImageBridgeChild.cpp ONLY.
    */
   ~ImageBridgeChild();
 
@@ -226,38 +226,41 @@ public:
   static void DispatchImageClientUpdate(ImageClient* aClient, ImageContainer* aContainer);
 
 
   // CompositableForwarder
 
   virtual void Connect(CompositableClient* aCompositable) MOZ_OVERRIDE;
 
   /**
-   * Communicate to the compositor that the texture identified by aLayer
-   * and aIdentifier has been updated to aImage.
+   * Communicate to the compositor that the texture identified by aCompositable
+   * and aTextureId has been updated to aDescriptor.
    */
-  virtual void UpdateTexture(TextureClient* aTexture,
-                             const SurfaceDescriptor& aImage) MOZ_OVERRIDE;
+  virtual void UpdateTexture(CompositableClient* aCompositable,
+                             TextureIdentifier aTextureId,
+                             SurfaceDescriptor* aDescriptor) MOZ_OVERRIDE;
 
   /**
    * Communicate the picture rect of a YUV image in aLayer to the compositor
    */
   virtual void UpdatePictureRect(CompositableClient* aCompositable,
                                  const nsIntRect& aRect) MOZ_OVERRIDE;
 
 
   // at the moment we don't need to implement these. They are only used for
   // thebes layers which don't support async updates.
   virtual void CreatedSingleBuffer(CompositableClient* aCompositable,
-                                   TextureClient* aBuffer) MOZ_OVERRIDE {
+                                   const SurfaceDescriptor& aDescriptor,
+                                   const TextureInfo& aTextureInfo) MOZ_OVERRIDE {
     NS_RUNTIMEABORT("should not be called");
   }
   virtual void CreatedDoubleBuffer(CompositableClient* aCompositable,
-                                   TextureClient* aFront,
-                                   TextureClient* aBack) MOZ_OVERRIDE {
+                                   const SurfaceDescriptor& aFrontDescriptor,
+                                   const SurfaceDescriptor& aBackDescriptor,
+                                   const TextureInfo& aTextureInfo) MOZ_OVERRIDE {
     NS_RUNTIMEABORT("should not be called");
   }
   virtual void DestroyThebesBuffer(CompositableClient* aCompositable) MOZ_OVERRIDE {
     NS_RUNTIMEABORT("should not be called");
   }
   virtual void UpdateTextureRegion(CompositableClient* aCompositable,
                                    const ThebesBufferData& aThebesBufferData,
                                    const nsIntRegion& aUpdatedRegion) MOZ_OVERRIDE {
--- a/gfx/layers/ipc/ImageBridgeParent.cpp
+++ b/gfx/layers/ipc/ImageBridgeParent.cpp
@@ -43,18 +43,17 @@ ImageBridgeParent::ActorDestroy(ActorDes
     NewRunnableMethod(this, &ImageBridgeParent::DeferredDestroy));
 }
 
 bool
 ImageBridgeParent::RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply)
 {
   EditReplyVector replyv;
   for (EditArray::index_type i = 0; i < aEdits.Length(); ++i) {
-    ReceiveCompositableUpdate(aEdits[i],
-                              replyv);
+    ReceiveCompositableUpdate(aEdits[i], replyv);
   }
 
   aReply->SetCapacity(replyv.size());
   if (replyv.size() > 0) {
     aReply->AppendElements(&replyv.front(), replyv.size());
   }
 
   // Ensure that any pending operations involving back and front
@@ -135,22 +134,22 @@ ImageBridgeParent::DeallocPGrallocBuffer
   return true;
 #else
   NS_RUNTIMEABORT("Um, how did we get here?");
   return false;
 #endif
 }
 
 PCompositableParent*
-ImageBridgeParent::AllocPCompositable(const CompositableType& aType,
-                                                         uint64_t* aID)
+ImageBridgeParent::AllocPCompositable(const TextureInfo& aInfo,
+                                      uint64_t* aID)
 {
   uint64_t id = GenImageContainerID();
   *aID = id;
-  return new CompositableParent(this, aType, id);
+  return new CompositableParent(this, aInfo, id);
 }
 
 bool ImageBridgeParent::DeallocPCompositable(PCompositableParent* aActor)
 {
   delete aActor;
   return true;
 }
 
--- a/gfx/layers/ipc/ImageBridgeParent.h
+++ b/gfx/layers/ipc/ImageBridgeParent.h
@@ -40,17 +40,17 @@ public:
 
   virtual bool
   DeallocPGrallocBuffer(PGrallocBufferParent* actor) MOZ_OVERRIDE;
 
   // PImageBridge
   virtual bool RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply);
   virtual bool RecvUpdateNoSwap(const EditArray& aEdits);
 
-  PCompositableParent* AllocPCompositable(const CompositableType& aType,
+  PCompositableParent* AllocPCompositable(const TextureInfo& aInfo,
                                           uint64_t*) MOZ_OVERRIDE;
   bool DeallocPCompositable(PCompositableParent* aActor) MOZ_OVERRIDE;
 
   bool RecvStop() MOZ_OVERRIDE;
 
   MessageLoop * GetMessageLoop();
 
 
--- a/gfx/layers/ipc/LayerTransaction.ipdlh
+++ b/gfx/layers/ipc/LayerTransaction.ipdlh
@@ -6,34 +6,33 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include LayersSurfaces;
 include protocol PCompositable;
 include protocol PCompositor;
 include protocol PGrallocBuffer;
 include protocol PLayer;
 include protocol PRenderFrame;
-include protocol PTexture;
 
 include "mozilla/WidgetUtils.h";
 include "mozilla/TimeStamp.h";
 include "mozilla/dom/ScreenOrientation.h";
 include "nsCSSProperty.h";
 include "gfxipc/ShadowLayerUtils.h";
 
 using gfxPoint3D;
 using nscoord;
 using nsRect;
 using nsPoint;
 using mozilla::TimeDuration;
 using mozilla::TimeStamp;
 using mozilla::ScreenRotation;
 using nsCSSProperty;
 using mozilla::dom::ScreenOrientation;
-using mozilla::layers::CompositableType;
+using mozilla::layers::TextureInfo;
 using mozilla::gfx::Margin;
 
 namespace mozilla {
 namespace layers {
 
 struct TargetConfig {
   nsIntRect naturalBounds;
   ScreenRotation rotation;
@@ -239,33 +238,33 @@ struct OpPaintTiledLayerBuffer {
   PLayer layer;
   // Bug 747811
   // FIXME: We need to support sharing tile across process.
   uintptr_t tiledLayerBuffer;
 };
 
 struct OpCreatedSingleBuffer {
   PCompositable compositable;
-  PTexture buffer;
   SurfaceDescriptor descriptor;
+  TextureInfo textureInfo;
 };
 struct OpCreatedDoubleBuffer {
   PCompositable compositable;
-  PTexture front;
   SurfaceDescriptor frontDescriptor;
-  PTexture back;
   SurfaceDescriptor backDescriptor;
+  TextureInfo textureInfo;
 };
 
 struct OpDestroyThebesBuffer {
   PCompositable compositable;
 };
 
 struct OpPaintTexture {
-  PTexture texture;
+  PCompositable compositable;
+  uint32_t textureId;
   SurfaceDescriptor image;
 };
 
 struct OpPaintTextureRegion {
   PCompositable compositable;
   ThebesBufferData bufferData;
   nsIntRegion updatedRegion;
 };
@@ -315,27 +314,22 @@ union Edit {
 // Replies to operations
 
 struct OpContentBufferSwap {
   PCompositable compositable;
   nsIntRegion frontUpdatedRegion;
 };
 
 struct OpTextureSwap {
-  PTexture texture;
+  PCompositable compositable;
+  uint32_t textureId;
   SurfaceDescriptor image;
 };
 
 // Unit of a "changeset reply".  This is a weird abstraction, probably
 // only to be used for buffer swapping.
 union EditReply {
   OpContentBufferSwap;
   OpTextureSwap;
 };
 
-struct OpTextureReply {
-  PTexture texture;
-  SurfaceDescriptor image;
-};
-
-
 } // namespace
 } // namespace
--- a/gfx/layers/ipc/PCompositable.ipdl
+++ b/gfx/layers/ipc/PCompositable.ipdl
@@ -2,28 +2,23 @@
  * vim: sw=2 ts=8 et :
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PLayers;
 include protocol PImageBridge;
-include protocol PTexture;
 include "mozilla/layers/CompositorTypes.h";
 include protocol PCompositor;
 
-using mozilla::layers::TextureInfo;
-
 namespace mozilla {
 namespace layers {
 
 async protocol PCompositable
 {
     manager PImageBridge or PLayers;
-    manages PTexture;
 parent:
-    async PTexture(TextureInfo info);
     async __delete__();
 };
     
 } // namespace
 } // namespace
--- a/gfx/layers/ipc/PImageBridge.ipdl
+++ b/gfx/layers/ipc/PImageBridge.ipdl
@@ -2,22 +2,21 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include LayersSurfaces;
 include LayerTransaction;
 include protocol PGrallocBuffer;
 include protocol PCompositable;
-include protocol PTexture;
 
 include "mozilla/layers/CompositorTypes.h";
 
 using ImageHandle;
-using mozilla::layers::CompositableType;
+using mozilla::layers::TextureInfo;
 
 namespace mozilla {
 namespace layers {
 
 /**
  * The PImageBridge protocol is used to allow isolated threads or processes to push
  * frames directly to the compositor thread/process without relying on the main thread
  * which might be too busy dealing with content script.
@@ -44,15 +43,15 @@ parent:
   // in a state in which they can't send asynchronous messages to their child
   // counterpart so as to not race with the upcomming __delete__ message.
   // In the child side, the __delete__ messages are not sent right after Stop,
   // they are scheduled in the ImageBridgeChild's message queue in order to ensure
   // that all the messages from the parent side have been received and processed
   // before sending __delete__.
   sync Stop();
 
-  sync PCompositable(CompositableType aType) returns (uint64_t id);
+  sync PCompositable(TextureInfo aInfo) returns (uint64_t id);
 };
 
 
 } // namespace
 } // namespace
 
--- a/gfx/layers/ipc/PLayers.ipdl
+++ b/gfx/layers/ipc/PLayers.ipdl
@@ -7,24 +7,25 @@
 
 include LayersSurfaces;
 include LayerTransaction;
 include protocol PCompositable;
 include protocol PCompositor;
 include protocol PGrallocBuffer;
 include protocol PLayer;
 include protocol PRenderFrame;
-include protocol PTexture;
 
 include "mozilla/WidgetUtils.h";
 include "mozilla/TimeStamp.h";
 include "mozilla/dom/ScreenOrientation.h";
 include "nsCSSProperty.h";
 include "gfxipc/ShadowLayerUtils.h";
 
+using mozilla::layers::TextureInfo;
+
 /**
  * The layers protocol is spoken between thread contexts that manage
  * layer (sub)trees.  The protocol comprises atomically publishing
  * layer subtrees to a "shadow" thread context (which grafts the
  * subtree into its own tree), and atomically updating a published
  * subtree.  ("Atomic" in this sense is wrt painting.)
  */
 
@@ -41,17 +42,17 @@ parent:
   /**
    * Only the parent side has privileges to allocate the buffer.
    * Allocation may fail (pmem is a scarce resource), and if so null_t
    * is returned.
    */
   sync PGrallocBuffer(gfxIntSize size, gfxContentType content)
     returns (MaybeMagicGrallocBufferHandle handle);
   async PLayer();
-  async PCompositable(CompositableType aType);
+  async PCompositable(TextureInfo aTextureInfo);
 
   // The isFirstPaint flag can be used to indicate that this is the first update
   // for a particular document.
   sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint)
     returns (EditReply[] reply);
 
   // We don't need to send a sync transaction if
   // no transaction operate require a swap.
deleted file mode 100644
--- a/gfx/layers/ipc/PTexture.ipdl
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PCompositable;
-include LayersSurfaces;
-
-namespace mozilla {
-namespace layers {
-
-/**
- * PTexture should be removed in the short term.
- * in the mean time it is used to match TextureClients and textureHosts.
- */
-async protocol PTexture
-{
-  manager PCompositable;
-
-parent:
-  async __delete__();
-};
-
-}
-}
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -11,26 +11,24 @@
 #include "gfxSharedImageSurface.h"
 #include "gfxPlatform.h"
 
 #include "AutoOpenSurface.h"
 #include "mozilla/ipc/SharedMemorySysV.h"
 #include "mozilla/layers/PLayerChild.h"
 #include "mozilla/layers/PLayersChild.h"
 #include "mozilla/layers/PLayersParent.h"
-#include "mozilla/layers/TextureChild.h"
 #include "mozilla/layers/LayerTransaction.h"
 #include "mozilla/layers/LayersSurfaces.h"
 #include "ShadowLayers.h"
 #include "ShadowLayerChild.h"
 #include "gfxipc/ShadowLayerUtils.h"
 #include "RenderTrace.h"
 #include "GeckoProfiler.h"
 #include "nsXULAppAPI.h"
-#include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/ImageClient.h"
 #include "mozilla/layers/CanvasClient.h"
 #include "mozilla/layers/ContentClient.h"
 #include "ISurfaceAllocator.h"
 
 using namespace mozilla::ipc;
 using namespace mozilla::gl;
 using namespace mozilla::dom;
@@ -297,25 +295,32 @@ ShadowLayerForwarder::PaintedTiledLayerB
 {
   if (XRE_GetProcessType() != GeckoProcessType_Default)
     NS_RUNTIMEABORT("PaintedTiledLayerBuffer must be made IPC safe (not share pointers)");
   mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(NULL, Shadow(aLayer),
                                                uintptr_t(aTiledLayerBuffer)));
 }
 
 void
-ShadowLayerForwarder::UpdateTexture(TextureClient* aTexture,
-                                    const SurfaceDescriptor& aImage)
+ShadowLayerForwarder::UpdateTexture(CompositableClient* aCompositable,
+                                    TextureIdentifier aTextureId,
+                                    SurfaceDescriptor* aDescriptor)
 {
-  MOZ_ASSERT(aImage.type() != SurfaceDescriptor::T__None);
-  MOZ_ASSERT(aImage.type() != SurfaceDescriptor::Tnull_t);
-  MOZ_ASSERT(aTexture);
-  MOZ_ASSERT(aTexture->GetIPDLActor());
-  mTxn->AddPaint(OpPaintTexture(nullptr, aTexture->GetIPDLActor(), aImage));
+  if (aDescriptor->type() != SurfaceDescriptor::T__None &&
+      aDescriptor->type() != SurfaceDescriptor::Tnull_t) {
+    MOZ_ASSERT(aCompositable);
+    MOZ_ASSERT(aCompositable->GetIPDLActor());
+    mTxn->AddPaint(OpPaintTexture(nullptr, aCompositable->GetIPDLActor(), 1,
+                                  SurfaceDescriptor(*aDescriptor)));
+    *aDescriptor = SurfaceDescriptor();
+  } else {
+    NS_WARNING("Trying to send a null SurfaceDescriptor.");
+  }
 }
+
 void
 ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
                                           const ThebesBufferData& aThebesBufferData,
                                           const nsIntRegion& aUpdatedRegion)
 {
   MOZ_ASSERT(aCompositable);
   MOZ_ASSERT(aCompositable->GetIPDLActor());
   mTxn->AddPaint(OpPaintTextureRegion(nullptr, aCompositable->GetIPDLActor(),
@@ -696,47 +701,46 @@ AutoOpenSurface::GetAsImage()
 void
 ShadowLayerForwarder::Connect(CompositableClient* aCompositable)
 {
 #ifdef GFX_COMPOSITOR_LOGGING
   printf("ShadowLayerForwarder::Connect(Compositable)\n");
 #endif
   MOZ_ASSERT(aCompositable);
   CompositableChild* child = static_cast<CompositableChild*>(
-    mShadowManager->SendPCompositableConstructor(aCompositable->GetType()));
+    mShadowManager->SendPCompositableConstructor(aCompositable->GetTextureInfo()));
   MOZ_ASSERT(child);
   aCompositable->SetIPDLActor(child);
   child->SetClient(aCompositable);
 }
 
 void
 ShadowLayerForwarder::CreatedSingleBuffer(CompositableClient* aCompositable,
-                                          TextureClient* aBuffer)
+                                          const SurfaceDescriptor& aDescriptor,
+                                          const TextureInfo& aTextureInfo)
 {
-  MOZ_ASSERT(aBuffer->LockSurfaceDescriptor()->type() != SurfaceDescriptor::T__None &&
-             aBuffer->LockSurfaceDescriptor()->type() != SurfaceDescriptor::Tnull_t);
+  MOZ_ASSERT(aDescriptor.type() != SurfaceDescriptor::T__None &&
+             aDescriptor.type() != SurfaceDescriptor::Tnull_t);
   mTxn->AddEdit(OpCreatedSingleBuffer(nullptr, aCompositable->GetIPDLActor(),
-                                      nullptr, aBuffer->GetIPDLActor(),
-                                      *aBuffer->LockSurfaceDescriptor()));
+                                      aDescriptor, aTextureInfo));
 }
 
 void
 ShadowLayerForwarder::CreatedDoubleBuffer(CompositableClient* aCompositable,
-                                          TextureClient* aFront,
-                                          TextureClient* aBack)
+                                          const SurfaceDescriptor& aFrontDescriptor,
+                                          const SurfaceDescriptor& aBackDescriptor,
+                                          const TextureInfo& aTextureInfo)
 {
-  MOZ_ASSERT(aFront->LockSurfaceDescriptor()->type() != SurfaceDescriptor::T__None &&
-             aBack->LockSurfaceDescriptor()->type() != SurfaceDescriptor::T__None &&
-             aFront->LockSurfaceDescriptor()->type() != SurfaceDescriptor::Tnull_t &&
-             aBack->LockSurfaceDescriptor()->type() != SurfaceDescriptor::Tnull_t);
+  MOZ_ASSERT(aFrontDescriptor.type() != SurfaceDescriptor::T__None &&
+             aBackDescriptor.type() != SurfaceDescriptor::T__None &&
+             aFrontDescriptor.type() != SurfaceDescriptor::Tnull_t &&
+             aBackDescriptor.type() != SurfaceDescriptor::Tnull_t);
   mTxn->AddEdit(OpCreatedDoubleBuffer(nullptr, aCompositable->GetIPDLActor(),
-                                      nullptr, aFront->GetIPDLActor(),
-                                      *aFront->LockSurfaceDescriptor(),
-                                      nullptr, aBack->GetIPDLActor(),
-                                      *aBack->LockSurfaceDescriptor()));
+                                      aFrontDescriptor, aBackDescriptor,
+                                      aTextureInfo));
 }
 
 void
 ShadowLayerForwarder::DestroyThebesBuffer(CompositableClient* aCompositable)
 {
   mTxn->AddEdit(OpDestroyThebesBuffer(nullptr, aCompositable->GetIPDLActor()));
 }
 
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -150,20 +150,22 @@ public:
 
   /**
    * Setup the IPDL actor for aCompositable to be part of layers
    * transactions.
    */
   void Connect(CompositableClient* aCompositable);
 
   virtual void CreatedSingleBuffer(CompositableClient* aCompositable,
-                                   TextureClient* aBuffer) MOZ_OVERRIDE;
+                                   const SurfaceDescriptor& aDescriptor,
+                                   const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
   virtual void CreatedDoubleBuffer(CompositableClient* aCompositable,
-                                   TextureClient* aFront,
-                                   TextureClient* aBack) MOZ_OVERRIDE;
+                                   const SurfaceDescriptor& aFrontDescriptor,
+                                   const SurfaceDescriptor& aBackDescriptor,
+                                   const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
   virtual void DestroyThebesBuffer(CompositableClient* aCompositable) MOZ_OVERRIDE;
 
   /**
    * Adds an edit in the layers transaction in order to attach
    * the corresponding compositable and layer on the compositor side.
    * Connect must have been called on aCompositable beforehand.
    */
   void Attach(CompositableClient* aCompositable,
@@ -265,18 +267,19 @@ public:
    * compositor side.
    */
   void AttachAsyncCompositable(PLayersChild* aLayer, uint64_t aID);
 
   /**
    * Communicate to the compositor that the texture identified by aLayer
    * and aIdentifier has been updated to aImage.
    */
-  void UpdateTexture(TextureClient* aTexture,
-                     const SurfaceDescriptor& aImage);
+  virtual void UpdateTexture(CompositableClient* aCompositable,
+                             TextureIdentifier aTextureId,
+                             SurfaceDescriptor* aDescriptor) MOZ_OVERRIDE;
 
   /**
    * Communicate to the compositor that aRegion in the texture identified by aLayer
    * and aIdentifier has been updated to aThebesBuffer.
    */
   virtual void UpdateTextureRegion(CompositableClient* aCompositable,
                                    const ThebesBufferData& aThebesBufferData,
                                    const nsIntRegion& aUpdatedRegion) MOZ_OVERRIDE;
--- a/gfx/layers/ipc/ShadowLayersChild.cpp
+++ b/gfx/layers/ipc/ShadowLayersChild.cpp
@@ -58,17 +58,17 @@ ShadowLayersChild::AllocPLayer()
 bool
 ShadowLayersChild::DeallocPLayer(PLayerChild* actor)
 {
   delete actor;
   return true;
 }
 
 PCompositableChild*
-ShadowLayersChild::AllocPCompositable(const CompositableType& aType)
+ShadowLayersChild::AllocPCompositable(const TextureInfo& aInfo)
 {
   return new CompositableChild();
 }
 
 bool
 ShadowLayersChild::DeallocPCompositable(PCompositableChild* actor)
 {
   delete actor;
--- a/gfx/layers/ipc/ShadowLayersChild.h
+++ b/gfx/layers/ipc/ShadowLayersChild.h
@@ -33,16 +33,16 @@ protected:
   AllocPGrallocBuffer(const gfxIntSize&, const gfxContentType&,
                       MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
   virtual bool
   DeallocPGrallocBuffer(PGrallocBufferChild* actor) MOZ_OVERRIDE;
 
   virtual PLayerChild* AllocPLayer() MOZ_OVERRIDE;
   virtual bool DeallocPLayer(PLayerChild* actor) MOZ_OVERRIDE;
 
-  virtual PCompositableChild* AllocPCompositable(const CompositableType& aType) MOZ_OVERRIDE;
+  virtual PCompositableChild* AllocPCompositable(const TextureInfo& aInfo) MOZ_OVERRIDE;
   virtual bool DeallocPCompositable(PCompositableChild* actor) MOZ_OVERRIDE;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // ifndef mozilla_layers_ShadowLayersChild_h
--- a/gfx/layers/ipc/ShadowLayersParent.cpp
+++ b/gfx/layers/ipc/ShadowLayersParent.cpp
@@ -15,17 +15,16 @@
 #include "mozilla/unused.h"
 #include "RenderTrace.h"
 #include "ShadowLayerParent.h"
 #include "ShadowLayersParent.h"
 #include "ShadowLayers.h"
 #include "ShadowLayerUtils.h"
 #include "TiledLayerBuffer.h"
 #include "gfxPlatform.h"
-#include "mozilla/layers/TextureParent.h"
 #include "CompositableHost.h"
 
 typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
 
 using mozilla::layout::RenderFrameParent;
 
 namespace mozilla {
 namespace layers {
@@ -41,23 +40,16 @@ cast(const PLayerParent* in)
 
 static CompositableParent*
 cast(const PCompositableParent* in)
 {
   return const_cast<CompositableParent*>(
     static_cast<const CompositableParent*>(in));
 }
 
-template<class OpPaintT>
-static TextureHost*
-AsTextureHost(const OpPaintT& op)
-{
-  return static_cast<TextureParent*>(op.textureParent())->GetTextureHost();
-}
-
 template<class OpCreateT>
 static ShadowLayerParent*
 AsShadowLayer(const OpCreateT& op)
 {
   return cast(op.layerParent());
 }
 
 static ShadowLayerParent*
@@ -505,19 +497,19 @@ ShadowLayersParent::AllocPLayer()
 bool
 ShadowLayersParent::DeallocPLayer(PLayerParent* actor)
 {
   delete actor;
   return true;
 }
 
 PCompositableParent*
-ShadowLayersParent::AllocPCompositable(const CompositableType& aType)
+ShadowLayersParent::AllocPCompositable(const TextureInfo& aInfo)
 {
-  return new CompositableParent(this, aType);
+  return new CompositableParent(this, aInfo);
 }
 
 bool
 ShadowLayersParent::DeallocPCompositable(PCompositableParent* actor)
 {
   delete actor;
   return true;
 }
--- a/gfx/layers/ipc/ShadowLayersParent.h
+++ b/gfx/layers/ipc/ShadowLayersParent.h
@@ -81,17 +81,17 @@ protected:
   AllocPGrallocBuffer(const gfxIntSize& aSize, const gfxContentType& aContent,
                       MaybeMagicGrallocBufferHandle* aOutHandle) MOZ_OVERRIDE;
   virtual bool
   DeallocPGrallocBuffer(PGrallocBufferParent* actor) MOZ_OVERRIDE;
 
   virtual PLayerParent* AllocPLayer() MOZ_OVERRIDE;
   virtual bool DeallocPLayer(PLayerParent* actor) MOZ_OVERRIDE;
 
-  virtual PCompositableParent* AllocPCompositable(const CompositableType& aType) MOZ_OVERRIDE;
+  virtual PCompositableParent* AllocPCompositable(const TextureInfo& aInfo) MOZ_OVERRIDE;
   virtual bool DeallocPCompositable(PCompositableParent* actor) MOZ_OVERRIDE;
   
   void Attach(ShadowLayerParent* aLayerParent, CompositableParent* aCompositable);
 
 private:
   nsRefPtr<ShadowLayerManager> mLayerManager;
   ShadowLayersManager* mShadowLayersManager;
   // Hold the root because it might be grafted under various
deleted file mode 100644
--- a/gfx/layers/ipc/TextureChild.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/layers/TextureChild.h"
-#include "mozilla/layers/TextureClient.h"
-
-namespace mozilla {
-namespace layers {
-
-CompositableClient*
-TextureChild::GetCompositableClient()
-{
-  return static_cast<CompositableChild*>(Manager())->GetCompositableClient();
-}
-
-void
-TextureChild::Destroy()
-{
-  if (mTextureClient) {
-  	mTextureClient->SetIPDLActor(nullptr);
-  	mTextureClient = nullptr;
-  }
-  Send__delete__(this);
-}
-
-} // namespace
-} // namespace
\ No newline at end of file
deleted file mode 100644
--- a/gfx/layers/ipc/TextureChild.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_LAYERS_TEXTURECHILD_H
-#define MOZILLA_LAYERS_TEXTURECHILD_H
-
-#include "mozilla/layers/PTextureChild.h"
-#include "CompositableClient.h"
-
-namespace mozilla {
-namespace layers {
-
-class TextureClient;
-
-class TextureChild : public PTextureChild
-{
-public:
-  TextureChild()
-  : mTextureClient(nullptr)
-  {
-    MOZ_COUNT_CTOR(TextureClient);
-  }
-  ~TextureChild()
-  {
-    MOZ_COUNT_DTOR(TextureClient);
-  }
-
-  void SetClient(TextureClient* aTextureClient)
-  {
-    mTextureClient = aTextureClient;
-  }
-
-  CompositableClient* GetCompositableClient();
-  TextureClient* GetTextureClient() const
-  {
-    return mTextureClient;
-  }
-
-  void Destroy();
-
-private:
-  TextureClient* mTextureClient;
-};
-
-} // namespace
-} // namespace
-
-#endif
deleted file mode 100644
--- a/gfx/layers/ipc/TextureParent.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/layers/TextureParent.h"
-#include "mozilla/layers/Compositor.h"
-#include "CompositableHost.h"
-#include "ShadowLayerParent.h"
-#include "LayerManagerComposite.h"
-#include "Compositor.h"
-#include "mozilla/layers/CompositableTransactionParent.h"
-
-namespace mozilla {
-namespace layers {
-
-TextureParent::TextureParent(const TextureInfo& aInfo,
-                             CompositableParent* aCompositable)
-: mTextureInfo(aInfo)
-, mLastSurfaceType(SurfaceDescriptor::Tnull_t)
-{
-  MOZ_COUNT_CTOR(TextureParent);
-}
-
-TextureParent::~TextureParent()
-{
-  MOZ_COUNT_DTOR(TextureParent);
-}
-
-bool
-TextureParent::EnsureTextureHost(SurfaceDescriptor::Type aSurfaceType)
-{
-  if (!SurfaceTypeChanged(aSurfaceType)) {
-    return false;
-  }
-
-  MOZ_ASSERT(!mTextureHost || mTextureHost->GetIPDLActor() == this);
-
-  CompositableParent* compParent = static_cast<CompositableParent*>(Manager());
-  CompositableHost* compositable = compParent->GetCompositableHost();
-
-  mTextureHost = TextureHost::CreateTextureHost(aSurfaceType,
-                                                mTextureInfo.mTextureHostFlags,
-                                                mTextureInfo.mTextureFlags);
-  mTextureHost->SetTextureParent(this);
-  compositable->AddTextureHost(mTextureHost,
-                               compParent->GetCompositableManager());
-
-  mLastSurfaceType = aSurfaceType;
-
-  Compositor* compositor = compositable->GetCompositor();
-  if (compositor) {
-    mTextureHost->SetCompositor(compositor);
-  }
-  return true;
-}
-
-void TextureParent::SetTextureHost(TextureHost* aHost)
-{
-  MOZ_ASSERT(!mTextureHost || mTextureHost == aHost);
-  mTextureHost = aHost;
-}
-
-CompositableHost* TextureParent::GetCompositableHost() const
-{
-  CompositableParent* actor = static_cast<CompositableParent*>(Manager());
-  return actor->GetCompositableHost();
-}
-
-uint64_t
-TextureParent::GetCompositorID()
-{
-  return static_cast<CompositableParent*>(Manager())->GetCompositorID();
-}
-
-
-TextureHost* TextureParent::GetTextureHost() const
-{
-  return mTextureHost;
-}
-
-bool TextureParent::SurfaceTypeChanged(SurfaceDescriptor::Type aNewSurfaceType)
-{
-  return mLastSurfaceType != aNewSurfaceType;
-}
-
-void TextureParent::SetCurrentSurfaceType(SurfaceDescriptor::Type aNewSurfaceType)
-{
-  mLastSurfaceType = aNewSurfaceType;
-}
-
-
-} // namespace
-} // namespace
deleted file mode 100644
--- a/gfx/layers/ipc/TextureParent.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_LAYERS_TEXTUREPARENT_H
-#define MOZILLA_LAYERS_TEXTUREPARENT_H
-
-#include "mozilla/layers/PTextureParent.h"
-#include "mozilla/layers/CompositorTypes.h"
-#include "CompositableHost.h"
-
-namespace mozilla {
-namespace layers {
-
-class TextureHost;
-class CompositableHost;
-class TextureInfo;
-
-class TextureParent : public PTextureParent
-{
-public:
-  TextureParent(const TextureInfo& aInfo, CompositableParent* aCompositable);
-  virtual ~TextureParent();
-
-  void SetTextureHost(TextureHost* aHost);
-
-  TextureHost* GetTextureHost() const;
-  CompositableHost* GetCompositableHost() const;
-
-  const TextureInfo& GetTextureInfo() const
-  {
-    return mTextureInfo;
-  }
-
-  bool SurfaceTypeChanged(SurfaceDescriptor::Type aNewSurfaceType);
-  void SetCurrentSurfaceType(SurfaceDescriptor::Type aNewSurfaceType);
-  SurfaceDescriptor::Type GetSurfaceType() const
-  {
-    return mLastSurfaceType;
-  }
-
-  uint64_t GetCompositorID();
-
-  bool EnsureTextureHost(SurfaceDescriptor::Type aSurfaceType);
-private:
-  TextureInfo mTextureInfo;
-  RefPtr<TextureHost> mTextureHost;
-  SurfaceDescriptor::Type mLastSurfaceType;
-};
-
-} // namespace
-} // namespace
-
-#endif
--- a/gfx/layers/ipc/ipdl.mk
+++ b/gfx/layers/ipc/ipdl.mk
@@ -6,10 +6,9 @@ IPDLSRCS = \
   LayersSurfaces.ipdlh \
   LayerTransaction.ipdlh \
   PCompositable.ipdl \
   PCompositor.ipdl \
   PGrallocBuffer.ipdl \
   PImageBridge.ipdl \
   PLayer.ipdl \
   PLayers.ipdl \
-  PTexture.ipdl \
   $(NULL)
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -635,23 +635,16 @@ CompositorOGL::SetLayerProgramProjection
     for (PRUint32 mask = MaskNone; mask < NumMaskTypes; ++mask) {
       if (mPrograms[i].mVariations[mask]) {
         mPrograms[i].mVariations[mask]->CheckAndSetProjectionMatrix(aMatrix);
       }
     }
   }
 }
 
-void
-CompositorOGL::FallbackTextureInfo(TextureInfo& aId)
-{
-  // Try again without direct texturing enabled
-  aId.mTextureHostFlags &= ~TEXTURE_HOST_DIRECT;
-}
-
 TemporaryRef<CompositingRenderTarget>
 CompositorOGL::CreateRenderTarget(const IntRect &aRect, SurfaceInitMode aInit)
 {
   GLuint tex = 0;
   GLuint fbo = 0;
   CreateFBOWithTexture(aRect, aInit, 0, &fbo, &tex);
   RefPtr<CompositingRenderTargetOGL> surface
     = new CompositingRenderTargetOGL(this, tex, fbo);
--- a/gfx/layers/opengl/CompositorOGL.h
+++ b/gfx/layers/opengl/CompositorOGL.h
@@ -34,18 +34,16 @@ public:
 
   virtual void Destroy() MOZ_OVERRIDE;
 
   virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
   {
     return TextureFactoryIdentifier(LAYERS_OPENGL, GetMaxTextureSize());
   }
 
-  virtual void FallbackTextureInfo(TextureInfo& aId) MOZ_OVERRIDE;
-
   virtual TemporaryRef<CompositingRenderTarget> 
   CreateRenderTarget(const gfx::IntRect &aRect, SurfaceInitMode aInit) MOZ_OVERRIDE;
 
   virtual TemporaryRef<CompositingRenderTarget>
   CreateRenderTargetFromSource(const gfx::IntRect &aRect,
                                const CompositingRenderTarget *aSource) MOZ_OVERRIDE;
 
   virtual void SetRenderTarget(CompositingRenderTarget *aSurface) MOZ_OVERRIDE;
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -7,18 +7,18 @@
 #include "GLContext.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
 TextureClientSharedOGL::TextureClientSharedOGL(CompositableForwarder* aForwarder,
-                                               CompositableType aCompositableType)
-  : TextureClient(aForwarder, aCompositableType)
+                                               const TextureInfo& aTextureInfo)
+  : TextureClient(aForwarder, aTextureInfo)
   , mGL(nullptr)
 {
 }
 
 void
 TextureClientSharedOGL::ReleaseResources()
 {
   if (!IsSurfaceDescriptorValid(mDescriptor)) {
--- a/gfx/layers/opengl/TextureClientOGL.h
+++ b/gfx/layers/opengl/TextureClientOGL.h
@@ -10,17 +10,17 @@
 #include "ISurfaceAllocator.h" // For IsSurfaceDescriptorValid
 
 namespace mozilla {
 namespace layers {
 
 class TextureClientSharedOGL : public TextureClient
 {
 public:
-  TextureClientSharedOGL(CompositableForwarder* aForwarder, CompositableType aCompositableType);
+  TextureClientSharedOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo);
   ~TextureClientSharedOGL() { ReleaseResources(); }
 
   virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL; }
   virtual void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType);
   virtual void ReleaseResources();
   virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return gfxASurface::CONTENT_COLOR_ALPHA; }
 
 protected:
@@ -29,29 +29,29 @@ protected:
 
   friend class CompositingFactory;
 };
 
 // Doesn't own the surface descriptor, so we shouldn't delete it
 class TextureClientSharedOGLExternal : public TextureClientSharedOGL
 {
 public:
-  TextureClientSharedOGLExternal(CompositableForwarder* aForwarder, CompositableType aCompositableType)
-    : TextureClientSharedOGL(aForwarder, aCompositableType)
+  TextureClientSharedOGLExternal(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
+    : TextureClientSharedOGL(aForwarder, aTextureInfo)
   {}
 
   virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL_EXTERNAL; }
   virtual void ReleaseResources() {}
 };
 
 class TextureClientStreamOGL : public TextureClient
 {
 public:
-  TextureClientStreamOGL(CompositableForwarder* aForwarder, CompositableType aCompositableType)
-    : TextureClient(aForwarder, aCompositableType)
+  TextureClientStreamOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
+    : TextureClient(aForwarder, aTextureInfo)
   {}
   ~TextureClientStreamOGL() { ReleaseResources(); }
 
   virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_STREAM_GL; }
   virtual void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType) { }
   virtual void ReleaseResources() { mDescriptor = SurfaceDescriptor(); }
   virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return gfxASurface::CONTENT_COLOR_ALPHA; }
 };
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -152,17 +152,17 @@ TextureImageTextureHostOGL::SetComposito
   }
 }
 
 void
 TextureImageTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
                                        nsIntRegion* aRegion)
 {
   if (!mGL) {
-    NS_WARNING("trying to update TextureImageTextureHostOGL without a compositor ?");
+    NS_WARNING("trying to update TextureImageTextureHostOGL without a compositor?");
     return;
   }
   AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
   nsIntSize size = surf.Size();
 
   if (!mTexture ||
       mTexture->GetSize() != size ||
       mTexture->GetContentType() != surf.ContentType()) {