Backed out changeset 4b7de1f2b4a0 (bug 856079) for various test failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 24 Apr 2013 11:28:05 -0400
changeset 129755 9219b3b1edda24851fd7184840553f6ae955ea79
parent 129754 52127bafd50b98ba21f8c492ed76ef27a52c8f3f
child 129756 b0268b65bc46e27bd32b249989d2f0416c2b08f3
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-esr52@d7ce90899997 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs856079
milestone23.0a1
backs out4b7de1f2b4a0d7a21dda516d22143b5d8b6f4d7e
Backed out changeset 4b7de1f2b4a0 (bug 856079) for various test failures. CLOSED TREE
gfx/layers/Compositor.h
gfx/layers/CompositorTypes.h
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/RenderTrace.cpp
gfx/layers/basic/BasicLayerManager.cpp
gfx/layers/basic/BasicLayers.h
gfx/layers/basic/BasicThebesLayer.cpp
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/composite/CanvasLayerComposite.cpp
gfx/layers/composite/CanvasLayerComposite.h
gfx/layers/composite/ColorLayerComposite.h
gfx/layers/composite/ContainerLayerComposite.cpp
gfx/layers/composite/ContainerLayerComposite.h
gfx/layers/composite/ImageHost.h
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/composite/ImageLayerComposite.h
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/LayerManagerComposite.h
gfx/layers/composite/ThebesLayerComposite.cpp
gfx/layers/composite/ThebesLayerComposite.h
gfx/layers/ipc/CompositableTransactionParent.cpp
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
gfx/layers/ipc/ImageBridgeChild.cpp
gfx/layers/ipc/ImageBridgeParent.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayerTransactionParent.h
gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
gfx/layers/ipc/ShadowLayerUtilsGralloc.h
gfx/layers/ipc/ShadowLayerUtilsMac.cpp
gfx/layers/ipc/ShadowLayerUtilsX11.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/moz.build
gfx/layers/opengl/GLManager.cpp
gfx/layers/opengl/LayerManagerOGL.h
layout/ipc/RenderFrameParent.cpp
widget/android/nsWindow.cpp
widget/cocoa/nsChildView.mm
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -21,17 +21,17 @@
  * structures.
  * Most of the documentation for layers is directly in the source code in the
  * form of doc comments. An overview can also be found in the the wiki:
  * https://wiki.mozilla.org/Gecko:Overview#Graphics
  *
  *
  * # Main interfaces and abstractions
  *
- *  - Layer, ShadowableLayer and LayerComposite
+ *  - Layer, ShadowableLayer and ShadowLayer
  *    (see Layers.h and ipc/ShadowLayers.h)
  *  - CompositableClient and CompositableHost
  *    (client/CompositableClient.h composite/CompositableHost.h)
  *  - TextureClient and TextureHost
  *    (client/TextureClient.h composite/TextureHost.h)
  *  - TextureSource
  *    (composite/TextureHost.h)
  *  - Forwarders
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -131,22 +131,13 @@ struct TextureInfo
   bool operator==(const TextureInfo& aOther) const
   {
     return mCompositableType == aOther.mCompositableType &&
            mTextureHostFlags == aOther.mTextureHostFlags &&
            mTextureFlags == aOther.mTextureFlags;
   }
 };
 
-/**
- * How a SurfaceDescriptor will be opened.
- *
- * See ShadowLayerForwarder::OpenDescriptor for example.
- */
-enum OpenMode {
-  OPEN_READ_ONLY,
-  OPEN_READ_WRITE
-};
 
 } // namespace layers
 } // namespace mozilla
 
 #endif
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -3,17 +3,17 @@
  */
 /* 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/DebugOnly.h"
 
 #include "mozilla/layers/PLayerTransaction.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/Telemetry.h"
 
 #include "ImageLayers.h"
 #include "ImageContainer.h"
 #include "Layers.h"
 #include "gfxPlatform.h"
 #include "ReadbackLayer.h"
 #include "gfxUtils.h"
@@ -455,26 +455,26 @@ Layer::CanUseOpaqueSurface()
     parent->CanUseOpaqueSurface();
 }
 
 // NB: eventually these methods will be defined unconditionally, and
 // can be moved into Layers.h
 const nsIntRect*
 Layer::GetEffectiveClipRect()
 {
-  if (LayerComposite* shadow = AsLayerComposite()) {
+  if (ShadowLayer* shadow = AsShadowLayer()) {
     return shadow->GetShadowClipRect();
   }
   return GetClipRect();
 }
 
 const nsIntRegion&
 Layer::GetEffectiveVisibleRegion()
 {
-  if (LayerComposite* shadow = AsLayerComposite()) {
+  if (ShadowLayer* shadow = AsShadowLayer()) {
     return shadow->GetShadowVisibleRegion();
   }
   return GetVisibleRegion();
 }
 
 gfx3DMatrix
 Layer::SnapTransformTranslation(const gfx3DMatrix& aTransform,
                                 gfxMatrix* aResidualTransform)
@@ -635,17 +635,17 @@ Layer::GetTransform()
   transform.ScalePost(mPostXScale, mPostYScale, 1.0f);
   return transform;
 }
 
 const gfx3DMatrix
 Layer::GetLocalTransform()
 {
   gfx3DMatrix transform;
-  if (LayerComposite* shadow = AsLayerComposite())
+  if (ShadowLayer* shadow = AsShadowLayer())
     transform = shadow->GetShadowTransform();
   else
     transform = mTransform;
   if (ContainerLayer* c = AsContainerLayer()) {
     transform.Scale(c->GetPreXScale(), c->GetPreYScale(), 1.0f);
   }
   transform.ScalePost(mPostXScale, mPostYScale, 1.0f);
   return transform;
@@ -660,17 +660,17 @@ Layer::ApplyPendingUpdatesForThisTransac
     Mutated();
   }
   mPendingTransform = nullptr;
 }
 
 const float
 Layer::GetLocalOpacity()
 {
-   if (LayerComposite* shadow = AsLayerComposite())
+   if (ShadowLayer* shadow = AsShadowLayer())
     return shadow->GetShadowOpacity();
   return mOpacity;
 }
 
 float
 Layer::GetEffectiveOpacity()
 {
   float opacity = GetLocalOpacity();
@@ -970,17 +970,17 @@ LayerManager::StopFrameTimeRecording(uin
 void
 LayerManager::BeginTabSwitch()
 {
   mTabSwitchStart = TimeStamp::Now();
 }
 
 #ifdef MOZ_LAYERS_HAVE_LOG
 
-static nsACString& PrintInfo(nsACString& aTo, LayerComposite* aLayerComposite);
+static nsACString& PrintInfo(nsACString& aTo, ShadowLayer* aShadowLayer);
 
 #ifdef MOZ_DUMP_PAINTING
 template <typename T>
 void WriteSnapshotLinkToDumpFile(T* aObj, FILE* aFile)
 {
   nsCString string(aObj->Name());
   string.Append("-");
   string.AppendInt((uint64_t)aObj);
@@ -1096,17 +1096,17 @@ Layer::LogSelf(const char* aPrefix)
 }
 
 nsACString&
 Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("%s%s (0x%p)", mManager->Name(), Name(), this);
 
-  ::PrintInfo(aTo, AsLayerComposite());
+  ::PrintInfo(aTo, AsShadowLayer());
 
   if (mUseClipRect) {
     AppendToString(aTo, mClipRect, " [clip=", "]");
   }
   if (1.0 != mPostXScale || 1.0 != mPostYScale) {
     aTo.AppendPrintf(" [postScale=%g, %g]", mPostXScale, mPostYScale);
   }
   if (!mTransform.IsIdentity()) {
@@ -1307,29 +1307,29 @@ LayerManager::InitLog()
 LayerManager::IsLogEnabled()
 {
   NS_ABORT_IF_FALSE(!!sLog,
                     "layer manager must be created before logging is allowed");
   return PR_LOG_TEST(sLog, PR_LOG_DEBUG);
 }
 
 static nsACString&
-PrintInfo(nsACString& aTo, LayerComposite* aLayerComposite)
+PrintInfo(nsACString& aTo, ShadowLayer* aShadowLayer)
 {
-  if (!aLayerComposite) {
+  if (!aShadowLayer) {
     return aTo;
   }
-  if (const nsIntRect* clipRect = aLayerComposite->GetShadowClipRect()) {
+  if (const nsIntRect* clipRect = aShadowLayer->GetShadowClipRect()) {
     AppendToString(aTo, *clipRect, " [shadow-clip=", "]");
   }
-  if (!aLayerComposite->GetShadowTransform().IsIdentity()) {
-    AppendToString(aTo, aLayerComposite->GetShadowTransform(), " [shadow-transform=", "]");
+  if (!aShadowLayer->GetShadowTransform().IsIdentity()) {
+    AppendToString(aTo, aShadowLayer->GetShadowTransform(), " [shadow-transform=", "]");
   }
-  if (!aLayerComposite->GetShadowVisibleRegion().IsEmpty()) {
-    AppendToString(aTo, aLayerComposite->GetShadowVisibleRegion(), " [shadow-visible=", "]");
+  if (!aShadowLayer->GetShadowVisibleRegion().IsEmpty()) {
+    AppendToString(aTo, aShadowLayer->GetShadowVisibleRegion(), " [shadow-visible=", "]");
   }
   return aTo;
 }
 
 #else  // !MOZ_LAYERS_HAVE_LOG
 
 void Layer::Dump(FILE* aFile, const char* aPrefix, bool aDumpHtml) {}
 void Layer::DumpSelf(FILE* aFile, const char* aPrefix) {}
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -55,20 +55,20 @@ class ThebesLayer;
 class ContainerLayer;
 class ImageLayer;
 class ColorLayer;
 class ImageContainer;
 class CanvasLayer;
 class ReadbackLayer;
 class ReadbackProcessor;
 class RefLayer;
-class LayerComposite;
+class ShadowLayer;
 class ShadowableLayer;
 class ShadowLayerForwarder;
-class LayerManagerComposite;
+class ShadowLayerManager;
 class SpecificLayerAttributes;
 class SurfaceDescriptor;
 class Compositor;
 class LayerComposite;
 struct TextureFactoryIdentifier;
 struct EffectMask;
 
 #define MOZ_LAYER_DECL_NAME(n, e)                           \
@@ -163,17 +163,17 @@ public:
     mUserData.Destroy();
     mRoot = nullptr;
   }
   bool IsDestroyed() { return mDestroyed; }
 
   virtual ShadowLayerForwarder* AsShadowForwarder()
   { return nullptr; }
 
-  virtual LayerManagerComposite* AsLayerManagerComposite()
+  virtual ShadowLayerManager* AsShadowManager()
   { return nullptr; }
 
   /**
    * Returns true if this LayerManager is owned by an nsIWidget,
    * and is used for drawing into the widget.
    */
   virtual bool IsWidgetLayerManager() { return true; }
 
@@ -1010,27 +1010,33 @@ public:
 
    /**
     * Dynamic cast to a Color. Returns null if this is not a
     * ColorLayer.
     */
   virtual ColorLayer* AsColorLayer() { return nullptr; }
 
   /**
-   * Dynamic cast to a LayerComposite.  Return null if this is not a
-   * LayerComposite.  Can be used anytime.
+   * Dynamic cast to a ShadowLayer.  Return null if this is not a
+   * ShadowLayer.  Can be used anytime.
    */
-  virtual LayerComposite* AsLayerComposite() { return nullptr; }
+  virtual ShadowLayer* AsShadowLayer() { return nullptr; }
 
   /**
    * Dynamic cast to a ShadowableLayer.  Return null if this is not a
    * ShadowableLayer.  Can be used anytime.
    */
   virtual ShadowableLayer* AsShadowableLayer() { return nullptr; }
 
+  /**
+   * Dynamic cast to a LayerComposite.  Return null if this is not a
+   * ShadowableLayer.  Can be used anytime.
+   */
+  virtual LayerComposite* AsLayerComposite() { return nullptr; }
+
   // These getters can be used anytime.  They return the effective
   // values that should be used when drawing this layer to screen,
   // accounting for this layer possibly being a shadow.
   const nsIntRect* GetEffectiveClipRect();
   const nsIntRegion& GetEffectiveVisibleRegion();
   /**
    * Returns the product of the opacities of this layer and all ancestors up
    * to and excluding the nearest ancestor that has UseIntermediateSurface() set.
--- a/gfx/layers/RenderTrace.cpp
+++ b/gfx/layers/RenderTrace.cpp
@@ -30,17 +30,17 @@ void RenderTraceLayers(Layer *aLayer, co
 
   gfx3DMatrix trans = aRootTransform * aLayer->GetTransform();
   trans.ProjectTo2D();
   nsIntRect clipRect = aLayer->GetEffectiveVisibleRegion().GetBounds();
   gfxRect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
   trans.TransformBounds(rect);
 
   if (strcmp(aLayer->Name(), "ContainerLayer") != 0 &&
-      strcmp(aLayer->Name(), "ContainerLayerComposite") != 0) {
+      strcmp(aLayer->Name(), "ShadowContainerLayer") != 0) {
     printf_stderr("%s RENDERTRACE %u rect #%02X%s %i %i %i %i\n",
       aLayer->Name(), (int)PR_IntervalNow(),
       colorId, aColor,
       (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
   }
 
   colorId++;
 
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -1246,17 +1246,17 @@ BasicShadowLayerManager::EndEmptyTransac
 }
 
 void
 BasicShadowLayerManager::ForwardTransaction()
 {
   RenderTraceScope rendertrace("Foward Transaction", "000090");
   mPhase = PHASE_FORWARD;
 
-  // forward this transaction's changeset to our LayerManagerComposite
+  // forward this transaction's changeset to our ShadowLayerManager
   AutoInfallibleTArray<EditReply, 10> replies;
   if (HasShadowManager() && ShadowLayerForwarder::EndTransaction(&replies)) {
     for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
       const EditReply& reply = replies[i];
 
       switch (reply.type()) {
       case EditReply::TOpContentBufferSwap: {
         MOZ_LAYERS_LOG(("[LayersForwarder] DoubleBufferSwap"));
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -16,21 +16,21 @@
 #include "nsThreadUtils.h"
 
 class nsIWidget;
 
 namespace mozilla {
 namespace layers {
 
 class BasicShadowableLayer;
-class ThebesLayerComposite;
-class ContainerLayerComposite;
-class ImageLayerComposite;
-class CanvasLayerComposite;
-class ColorLayerComposite;
+class ShadowThebesLayer;
+class ShadowContainerLayer;
+class ShadowImageLayer;
+class ShadowCanvasLayer;
+class ShadowColorLayer;
 class ReadbackProcessor;
 class ImageFactory;
 class PaintLayerContext;
 
 /**
  * This is a cairo/Thebes-only, main-thread-only implementation of layers.
  * 
  * In each transaction, the client sets up the layer tree and then during
--- a/gfx/layers/basic/BasicThebesLayer.cpp
+++ b/gfx/layers/basic/BasicThebesLayer.cpp
@@ -344,17 +344,17 @@ public:
     oldBuffer = SetBuffer(nullptr, aNewRect, aNewRotation);
     MOZ_ASSERT(!oldBuffer);
   }
 
 protected:
   virtual already_AddRefed<gfxASurface>
   CreateBuffer(ContentType, const nsIntRect&, uint32_t, gfxASurface**)
   {
-    NS_RUNTIMEABORT("ThebesLayerComposite can't paint content");
+    NS_RUNTIMEABORT("ShadowThebesLayer can't paint content");
     return nullptr;
   }
 };
 
 already_AddRefed<ThebesLayer>
 BasicLayerManager::CreateThebesLayer()
 {
   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -38,17 +38,17 @@ class CompositableChild;
  * shadow layer forwarder machinery that is used on the main thread.
  *
  * The first step is to create a Compositable client and call Connect().
  * Connect() creates the underlying IPDL actor (see CompositableChild) and the
  * corresponding CompositableHost on the other side.
  *
  * To do in-transaction texture transfer (the default), call
  * ShadowLayerForwarder::Attach(CompositableClient*, ShadowableLayer*). This
- * will let the LayerComposite on the compositor side know which CompositableHost
+ * will let the ShadowLayer on the compositor side know which CompositableHost
  * to use for compositing.
  *
  * To do async texture transfer (like async-video), the CompositableClient
  * should be created with a different CompositableForwarder (like
  * ImageBridgeChild) and attachment is done with
  * CompositableForwarder::AttachAsyncCompositable that takes an identifier
  * instead of a CompositableChild, since the CompositableClient is not managed
  * by this layer forwarder (the matching uses a global map on the compositor side,
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -4,31 +4,30 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/ContentClient.h"
 #include "mozilla/gfx/2D.h"
 #include "BasicThebesLayer.h"
 #include "nsIWidget.h"
 #include "gfxUtils.h"
 #include "gfxPlatform.h"
-#include "mozilla/layers/LayerManagerComposite.h"
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
 /* static */ TemporaryRef<ContentClient>
 ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
 {
   if (aForwarder->GetCompositorBackendType() != LAYERS_OPENGL) {
     return nullptr;
   }
-  if (LayerManagerComposite::SupportsDirectTexturing() ||
+  if (ShadowLayerManager::SupportsDirectTexturing() ||
       PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
     return new ContentClientDoubleBuffered(aForwarder);
   }
   return new ContentClientSingleBuffered(aForwarder);
 }
 
 ContentClientBasic::ContentClientBasic(CompositableForwarder* aForwarder,
                                        BasicLayerManager* aManager)
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -16,19 +16,21 @@ class gfxReusableSurfaceWrapper;
 namespace mozilla {
 
 namespace gl {
 class GLContext;
 }
 
 namespace layers {
 
+class PTextureChild;
 class ContentClient;
 class PlanarYCbCrImage;
 class Image;
+class PTextureChild;
 class CompositableForwarder;
 
 /**
  * This class allows texture clients to draw into textures through Azure or
  * thebes and applies locking semantics to allow GPU or CPU level
  * synchronization.
  * TextureClient's purpose is for the texture data to be
  * forwarded to the right place on the compositor side and with correct locking
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -12,17 +12,17 @@
 #include "CanvasLayerComposite.h"
 #include "ImageHost.h"
 #include "gfx2DGlue.h"
 
 using namespace mozilla;
 using namespace mozilla::layers;
 
 CanvasLayerComposite::CanvasLayerComposite(LayerManagerComposite* aManager)
-  : CanvasLayer(aManager, nullptr)
+  : ShadowCanvasLayer(aManager, nullptr)
   , LayerComposite(aManager)
   , mImageHost(nullptr)
 {
   MOZ_COUNT_CTOR(CanvasLayerComposite);
   mImplData = static_cast<LayerComposite*>(this);
 }
 
 CanvasLayerComposite::~CanvasLayerComposite()
--- a/gfx/layers/composite/CanvasLayerComposite.h
+++ b/gfx/layers/composite/CanvasLayerComposite.h
@@ -2,64 +2,73 @@
  * 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 GFX_CanvasLayerComposite_H
 #define GFX_CanvasLayerComposite_H
 
 
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "gfxASurface.h"
 #if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
 #include "mozilla/X11Util.h"
 #endif
 
 namespace mozilla {
 namespace layers {
 
 // Canvas layers use ImageHosts (but CanvasClients) because compositing a
 // canvas is identical to compositing an image.
 class ImageHost;
 
-class CanvasLayerComposite : public CanvasLayer,
+// NB: eventually we'll have separate shadow canvas2d and shadow
+// canvas3d layers, but currently they look the same from the
+// perspective of the compositor process
+class CanvasLayerComposite : public ShadowCanvasLayer,
                              public LayerComposite
 {
 public:
   CanvasLayerComposite(LayerManagerComposite* aManager);
-
   virtual ~CanvasLayerComposite();
 
   // CanvasLayer impl
   virtual void Initialize(const Data& aData) MOZ_OVERRIDE
   {
     NS_RUNTIMEABORT("Incompatibe surface type");
   }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
+  // ShadowCanvasLayer impl
+  virtual void Swap(const SurfaceDescriptor& aNewFront,
+                    bool needYFlip,
+                    SurfaceDescriptor* aNewBack) MOZ_OVERRIDE
+  {
+    NS_ERROR("Should never be called");
+  }
+
   virtual void SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
 
   virtual void Disconnect() MOZ_OVERRIDE
   {
     Destroy();
   }
 
+  // LayerComposite impl
   virtual Layer* GetLayer() MOZ_OVERRIDE;
   virtual void RenderLayer(const nsIntPoint& aOffset,
                            const nsIntRect& aClipRect) MOZ_OVERRIDE;
 
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
-  void SetBounds(nsIntRect aBounds) { mBounds = aBounds; }
-
 #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:
--- a/gfx/layers/composite/ColorLayerComposite.h
+++ b/gfx/layers/composite/ColorLayerComposite.h
@@ -4,28 +4,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_ColorLayerComposite_H
 #define GFX_ColorLayerComposite_H
 
 #include "mozilla/layers/PLayerTransaction.h"
 #include "mozilla/layers/ShadowLayers.h"
 
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 
 namespace mozilla {
 namespace layers {
 
 
-class ColorLayerComposite : public ColorLayer,
+class ColorLayerComposite : public ShadowColorLayer,
                             public LayerComposite
 {
 public:
   ColorLayerComposite(LayerManagerComposite *aManager)
-    : ColorLayer(aManager, nullptr)
+    : ShadowColorLayer(aManager, nullptr)
     , LayerComposite(aManager)
   {
     MOZ_COUNT_CTOR(ColorLayerComposite);
     mImplData = static_cast<LayerComposite*>(this);
   }
   ~ColorLayerComposite()
   {
     MOZ_COUNT_DTOR(ColorLayerComposite);
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -147,17 +147,17 @@ ContainerRender(ContainerT* aContainer,
     gfx::Rect rect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height);
     gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
     aManager->GetCompositor()->DrawQuad(rect, clipRect, effectChain, opacity,
                                         transform, gfx::Point(aOffset.x, aOffset.y));
   }
 }
 
 ContainerLayerComposite::ContainerLayerComposite(LayerManagerComposite *aManager)
-  : ContainerLayer(aManager, nullptr)
+  : ShadowContainerLayer(aManager, nullptr)
   , LayerComposite(aManager)
 {
   MOZ_COUNT_CTOR(ContainerLayerComposite);
   mImplData = static_cast<LayerComposite*>(this);
 }
 
 ContainerLayerComposite::~ContainerLayerComposite()
 {
@@ -324,17 +324,17 @@ ContainerLayerComposite::CleanupResource
 {
   for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
     LayerComposite* layerToCleanup = static_cast<LayerComposite*>(l->ImplData());
     layerToCleanup->CleanupResources();
   }
 }
 
 RefLayerComposite::RefLayerComposite(LayerManagerComposite* aManager)
-  : RefLayer(aManager, nullptr)
+  : ShadowRefLayer(aManager, nullptr)
   , LayerComposite(aManager)
 {
   mImplData = static_cast<LayerComposite*>(this);
 }
 
 RefLayerComposite::~RefLayerComposite()
 {
   Destroy();
--- a/gfx/layers/composite/ContainerLayerComposite.h
+++ b/gfx/layers/composite/ContainerLayerComposite.h
@@ -5,36 +5,35 @@
 
 #ifndef GFX_ContainerLayerComposite_H
 #define GFX_ContainerLayerComposite_H
 
 #include "mozilla/layers/PLayerTransaction.h"
 #include "mozilla/layers/ShadowLayers.h"
 
 #include "Layers.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "mozilla/layers/Effects.h"
 
 #include "gfxUtils.h"
 #include "gfx2DGlue.h"
 
 namespace mozilla {
 namespace layers {
 
-class ContainerLayerComposite : public ContainerLayer,
+class ContainerLayerComposite : public ShadowContainerLayer,
                                 public LayerComposite
 {
   template<class ContainerT>
   friend void ContainerRender(ContainerT* aContainer,
                               const nsIntPoint& aOffset,
                               LayerManagerComposite* aManager,
                               const nsIntRect& aClipRect);
 public:
   ContainerLayerComposite(LayerManagerComposite *aManager);
-
   ~ContainerLayerComposite();
 
   void InsertAfter(Layer* aChild, Layer* aAfter);
 
   void RemoveChild(Layer* aChild);
 
   void RepositionChild(Layer* aChild, Layer* aAfter);
 
@@ -60,17 +59,17 @@ public:
   // container layers don't use a compositable
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; }
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return "ContainerLayerComposite"; }
 #endif
 };
 
-class RefLayerComposite : public RefLayer,
+class RefLayerComposite : public ShadowRefLayer,
                           public LayerComposite
 {
   template<class ContainerT>
   friend void ContainerRender(ContainerT* aContainer,
                               const nsIntPoint& aOffset,
                               LayerManagerComposite* aManager,
                               const nsIntRect& aClipRect);
 public:
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -2,17 +2,17 @@
  * 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_GFX_IMAGEHOST_H
 #define MOZILLA_GFX_IMAGEHOST_H
 
 #include "CompositableHost.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 
 namespace mozilla {
 namespace layers {
 
 /**
  * Used for compositing Image and Canvas layers, matched on the content-side
  * by an ImageClient or CanvasClient.
  *
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -17,17 +17,17 @@
 #include "CompositableHost.h"
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 ImageLayerComposite::ImageLayerComposite(LayerManagerComposite* aManager)
-  : ImageLayer(aManager, nullptr)
+  : ShadowImageLayer(aManager, nullptr)
   , LayerComposite(aManager)
   , mImageHost(nullptr)
 {
   MOZ_COUNT_CTOR(ImageLayerComposite);
   mImplData = static_cast<LayerComposite*>(this);
 }
 
 ImageLayerComposite::~ImageLayerComposite()
--- a/gfx/layers/composite/ImageLayerComposite.h
+++ b/gfx/layers/composite/ImageLayerComposite.h
@@ -4,37 +4,43 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_ImageLayerComposite_H
 #define GFX_ImageLayerComposite_H
 
 #include "mozilla/layers/PLayerTransaction.h"
 #include "mozilla/layers/ShadowLayers.h"
 
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "ImageLayers.h"
 #include "mozilla/Mutex.h"
 
 namespace mozilla {
 namespace layers {
 
 class ImageHost;
 
-class ImageLayerComposite : public ImageLayer,
+class ImageLayerComposite : public ShadowImageLayer,
                             public LayerComposite
 {
   typedef gl::TextureImage TextureImage;
 
 public:
   ImageLayerComposite(LayerManagerComposite* aManager);
-
   virtual ~ImageLayerComposite();
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
+  // ShadowImageLayer impl
+  virtual void Swap(const SurfaceDescriptor& aFront,
+                    SurfaceDescriptor* aNewBack)
+  {
+    NS_ERROR("Not implemented");
+  }
+
   virtual void Disconnect() MOZ_OVERRIDE;
 
   virtual void SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
 
   virtual Layer* GetLayer() MOZ_OVERRIDE;
 
   virtual void RenderLayer(const nsIntPoint& aOffset,
                            const nsIntRect& aClipRect);
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -4,29 +4,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/PLayerTransaction.h"
 
 // This must occur *after* layers/PLayerTransaction.h to avoid
 // typedefs conflicts.
 #include "mozilla/Util.h"
 
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "ThebesLayerComposite.h"
 #include "ContainerLayerComposite.h"
 #include "ImageLayerComposite.h"
 #include "ColorLayerComposite.h"
 #include "CanvasLayerComposite.h"
 #include "CompositableHost.h"
 #include "mozilla/gfx/Matrix.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/layers/ImageHost.h"
 #include "mozilla/layers/ContentHost.h"
-#include "mozilla/layers/Compositor.h"
 
 #include "gfxContext.h"
 #include "gfxUtils.h"
 #include "gfx2DGlue.h"
 #ifdef XP_MACOSX
 #include "gfxPlatformMac.h"
 #else
 #include "gfxPlatform.h"
@@ -43,17 +42,16 @@
 #ifdef MOZ_WIDGET_ANDROID
 #include <android/log.h>
 #endif
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
-using namespace mozilla::gl;
 
 static LayerComposite*
 ToLayerComposite(Layer* aLayer)
 {
   return static_cast<LayerComposite*>(aLayer->ImplData());
 }
 
 static void ClearSubtree(Layer* aLayer)
@@ -75,30 +73,26 @@ LayerManagerComposite::ClearCachedResour
   }
 
   ClearSubtree(subtree);
   // FIXME [bjacob]
   // XXX the old LayerManagerOGL code had a mMaybeInvalidTree that it set to true here.
   // Do we need that?
 }
 
+
+
 /**
  * LayerManagerComposite
  */
 LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
-: mCompositor(aCompositor)
 {
+  mCompositor = aCompositor;
 }
 
-LayerManagerComposite::~LayerManagerComposite()
-{
-  Destroy();
-}
-
-
 bool
 LayerManagerComposite::Initialize()
 {
   mComposer2D = mCompositor->GetWidget()->GetComposer2D();
   return mCompositor->Initialize();
 }
 
 void
@@ -544,68 +538,68 @@ LayerManagerComposite::ComputeRenderInte
 
     return ((highPrecisionIntegrity * highPrecisionMultiplier) +
             (lowPrecisionIntegrity * lowPrecisionMultiplier)) / 2;
   }
 
   return 1.f;
 }
 
-already_AddRefed<ThebesLayerComposite>
-LayerManagerComposite::CreateThebesLayerComposite()
+already_AddRefed<ShadowThebesLayer>
+LayerManagerComposite::CreateShadowThebesLayer()
 {
-  if (mDestroyed) {
+  if (LayerManagerComposite::mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
   }
   return nsRefPtr<ThebesLayerComposite>(new ThebesLayerComposite(this)).forget();
 }
 
-already_AddRefed<ContainerLayerComposite>
-LayerManagerComposite::CreateContainerLayerComposite()
+already_AddRefed<ShadowContainerLayer>
+LayerManagerComposite::CreateShadowContainerLayer()
 {
-  if (mDestroyed) {
+  if (LayerManagerComposite::mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
   }
   return nsRefPtr<ContainerLayerComposite>(new ContainerLayerComposite(this)).forget();
 }
 
-already_AddRefed<ImageLayerComposite>
-LayerManagerComposite::CreateImageLayerComposite()
+already_AddRefed<ShadowImageLayer>
+LayerManagerComposite::CreateShadowImageLayer()
 {
-  if (mDestroyed) {
+  if (LayerManagerComposite::mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
   }
   return nsRefPtr<ImageLayerComposite>(new ImageLayerComposite(this)).forget();
 }
 
-already_AddRefed<ColorLayerComposite>
-LayerManagerComposite::CreateColorLayerComposite()
+already_AddRefed<ShadowColorLayer>
+LayerManagerComposite::CreateShadowColorLayer()
 {
   if (LayerManagerComposite::mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
   }
   return nsRefPtr<ColorLayerComposite>(new ColorLayerComposite(this)).forget();
 }
 
-already_AddRefed<CanvasLayerComposite>
-LayerManagerComposite::CreateCanvasLayerComposite()
+already_AddRefed<ShadowCanvasLayer>
+LayerManagerComposite::CreateShadowCanvasLayer()
 {
   if (LayerManagerComposite::mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
   }
   return nsRefPtr<CanvasLayerComposite>(new CanvasLayerComposite(this)).forget();
 }
 
-already_AddRefed<RefLayerComposite>
-LayerManagerComposite::CreateRefLayerComposite()
+already_AddRefed<ShadowRefLayer>
+LayerManagerComposite::CreateShadowRefLayer()
 {
   if (LayerManagerComposite::mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
   }
   return nsRefPtr<RefLayerComposite>(new RefLayerComposite(this)).forget();
 }
 
@@ -641,91 +635,19 @@ LayerManagerComposite::CreateDrawTarget(
   if (useAcceleration) {
     return Factory::CreateDrawTarget(BACKEND_COREGRAPHICS_ACCELERATED,
                                      aSize, aFormat);
   }
 #endif
   return LayerManager::CreateDrawTarget(aSize, aFormat);
 }
 
-LayerComposite::LayerComposite(LayerManagerComposite *aManager)
-  : mCompositeManager(aManager)
-  , mCompositor(aManager->GetCompositor())
-  , mShadowOpacity(1.0)
-  , mUseShadowClipRect(false)
-  , mDestroyed(false)
-{ }
-
-LayerComposite::~LayerComposite()
-{
-}
-
 void
 LayerComposite::Destroy()
 {
   if (!mDestroyed) {
     mDestroyed = true;
     CleanupResources();
   }
 }
 
-const nsIntSize&
-LayerManagerComposite::GetWidgetSize()
-{
-  return mCompositor->GetWidgetSize();
-}
-
-void
-LayerManagerComposite::SetCompositorID(uint32_t aID)
-{
-  NS_ASSERTION(mCompositor, "No compositor");
-  mCompositor->SetCompositorID(aID);
-}
-
-void
-LayerManagerComposite::NotifyShadowTreeTransaction()
-{
-  mCompositor->NotifyLayersTransaction();
-}
-
-bool
-LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
-{
-  return mCompositor->CanUseCanvasLayerForSize(aSize);
-}
-
-TextureFactoryIdentifier
-LayerManagerComposite::GetTextureFactoryIdentifier()
-{
-  return mCompositor->GetTextureFactoryIdentifier();
-}
-
-int32_t
-LayerManagerComposite::GetMaxTextureSize() const
-{
-  return mCompositor->GetMaxTextureSize();
-}
-
-#ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
-
-/*static*/ already_AddRefed<TextureImage>
-LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
-                                                        const SurfaceDescriptor&,
-                                                        GLenum)
-{
-  return nullptr;
-}
-
-/*static*/ bool
-LayerManagerComposite::SupportsDirectTexturing()
-{
-  return false;
-}
-
-/*static*/ void
-LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
-{
-}
-
-#endif  // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
-
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -5,17 +5,16 @@
 
 #ifndef GFX_LayerManagerComposite_H
 #define GFX_LayerManagerComposite_H
 
 #include "mozilla/layers/Compositor.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "Composer2D.h"
 #include "mozilla/TimeStamp.h"
-#include "Layers.h"
 
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 #include "gfxContext.h"
 #include "gfx3DMatrix.h"
 #include "GLDefs.h"
@@ -26,33 +25,53 @@ class GLContext;
 class TextureImage;
 }
 }
 
 namespace mozilla {
 namespace layers {
 
 class LayerComposite;
-class ThebesLayerComposite;
-class ContainerLayerComposite;
-class ImageLayerComposite;
-class CanvasLayerComposite;
-class ColorLayerComposite;
-class RefLayerComposite;
+class ShadowThebesLayer;
+class ShadowContainerLayer;
+class ShadowImageLayer;
+class ShadowCanvasLayer;
+class ShadowColorLayer;
 class CompositableHost;
-class EffectChain;
-class TiledLayerComposer;
 
-class THEBES_API LayerManagerComposite : public LayerManager
+/**
+ * Composite layers are for use with OMTC on the compositor thread only. There
+ * must be corresponding Basic layers on the content thread. For composite
+ * layers, the layer manager only maintains the layer tree, all rendering is
+ * done by a Compositor (see Compositor.h). As such, composite layers are
+ * platform-independent and can be used on any platform for which there is a
+ * Compositor implementation.
+ *
+ * The composite layer tree reflects exactly the basic layer tree. To
+ * composite to screen, the layer manager walks the layer tree calling render
+ * methods which in turn call into their CompositableHosts' Composite methods.
+ * These call Compositor::DrawQuad to do the rendering.
+ *
+ * Mostly, layers are updated during the layers transaction. This is done from
+ * CompositableClient to CompositableHost without interacting with the layer.
+ *
+ * mCompositor is stored in ShadowLayerManager.
+ *
+ * Post-landing TODO: merge LayerComposite with ShadowLayer
+ */
+class THEBES_API LayerManagerComposite : public ShadowLayerManager
 {
 public:
   LayerManagerComposite(Compositor* aCompositor);
-  ~LayerManagerComposite();
-  
-  virtual void Destroy() MOZ_OVERRIDE;
+  virtual ~LayerManagerComposite()
+  {
+    Destroy();
+  }
+
+  virtual void Destroy();
 
   /**
    * return True if initialization was succesful, false when it was not.
    */
   bool Initialize();
 
   /**
    * Sets the clipping region for this layer manager. This is important on
@@ -66,54 +85,66 @@ public:
   void SetClippingRegion(const nsIntRegion& aClippingRegion)
   {
     mClippingRegion = aClippingRegion;
   }
 
   /**
    * LayerManager implementation.
    */
-  virtual LayerManagerComposite* AsLayerManagerComposite() MOZ_OVERRIDE
+  virtual ShadowLayerManager* AsShadowManager() MOZ_OVERRIDE
   {
     return this;
   }
 
   void UpdateRenderBounds(const nsIntRect& aRect);
 
   void BeginTransaction() MOZ_OVERRIDE;
   void BeginTransactionWithTarget(gfxContext* aTarget) MOZ_OVERRIDE;
 
-  void NotifyShadowTreeTransaction();
+  virtual void NotifyShadowTreeTransaction() MOZ_OVERRIDE
+  {
+    mCompositor->NotifyLayersTransaction();
+  }
 
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
   virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
 
   virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE { mRoot = aLayer; }
 
-  virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE;
+  virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE
+  {
+    return mCompositor->CanUseCanvasLayerForSize(aSize);
+  }
 
-  virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE;
+  virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
+  {
+    return mCompositor->GetTextureFactoryIdentifier();
+  }
 
-  virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE;
+  virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE
+  {
+    return mCompositor->GetMaxTextureSize();
+  }
 
   virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<ImageLayer> CreateImageLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<ColorLayer> CreateColorLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() MOZ_OVERRIDE;
-  already_AddRefed<ThebesLayerComposite> CreateThebesLayerComposite();
-  already_AddRefed<ContainerLayerComposite> CreateContainerLayerComposite();
-  already_AddRefed<ImageLayerComposite> CreateImageLayerComposite();
-  already_AddRefed<ColorLayerComposite> CreateColorLayerComposite();
-  already_AddRefed<CanvasLayerComposite> CreateCanvasLayerComposite();
-  already_AddRefed<RefLayerComposite> CreateRefLayerComposite();
+  virtual already_AddRefed<ShadowThebesLayer> CreateShadowThebesLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ShadowRefLayer> CreateShadowRefLayer() MOZ_OVERRIDE;
 
   virtual LayersBackend GetBackendType() MOZ_OVERRIDE
   {
     return LAYERS_NONE;
   }
   virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE
   {
     MOZ_ASSERT(false, "Shouldn't be called for composited layer manager");
@@ -168,55 +199,30 @@ public:
   /**
    * Creates a DrawTarget which is optimized for inter-operating with this
    * layermanager.
    */
   virtual TemporaryRef<mozilla::gfx::DrawTarget>
     CreateDrawTarget(const mozilla::gfx::IntSize &aSize,
                      mozilla::gfx::SurfaceFormat aFormat) MOZ_OVERRIDE;
 
-  const nsIntSize& GetWidgetSize();
+  const nsIntSize& GetWidgetSize()
+  {
+    return mCompositor->GetWidgetSize();
+  }
 
   /**
    * Calculates the 'completeness' of the rendering that intersected with the
    * screen on the last render. This is only useful when progressive tile
    * drawing is enabled, otherwise this will always return 1.0.
    * This function's expense scales with the size of the layer tree and the
    * complexity of individual layers' valid regions.
    */
   float ComputeRenderIntegrity();
 
-  /**
-   * Try to open |aDescriptor| for direct texturing.  If the
-   * underlying surface supports direct texturing, a non-null
-   * TextureImage is returned.  Otherwise null is returned.
-   */
-  static already_AddRefed<gl::TextureImage>
-  OpenDescriptorForDirectTexturing(gl::GLContext* aContext,
-                                   const SurfaceDescriptor& aDescriptor,
-                                   GLenum aWrapMode);
-
-  /**
-   * returns true if PlatformAllocBuffer will return a buffer that supports
-   * direct texturing
-   */
-  static bool SupportsDirectTexturing();
-
-  static void PlatformSyncBeforeReplyUpdate();
-
-  void SetCompositorID(uint32_t aID);
-
-  Compositor* GetCompositor() const
-  {
-    return mCompositor;
-  }
-
-  bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
-  RefPtr<Compositor> mCompositor;
-
 private:
   /** Region we're clipping our current drawing to. */
   nsIntRegion mClippingRegion;
   nsIntRect mRenderBounds;
 
   /** Current root layer. */
   LayerComposite *RootLayer() const;
 
@@ -244,42 +250,34 @@ private:
   /* Thebes layer callbacks; valid at the end of a transaciton,
    * while rendering */
   DrawThebesLayerCallback mThebesLayerCallback;
   void *mThebesLayerCallbackData;
   gfxMatrix mWorldMatrix;
   bool mInTransaction;
 };
 
+
+
+
 /**
- * Composite layers are for use with OMTC on the compositor thread only. There
- * must be corresponding Basic layers on the content thread. For composite
- * layers, the layer manager only maintains the layer tree, all rendering is
- * done by a Compositor (see Compositor.h). As such, composite layers are
- * platform-independent and can be used on any platform for which there is a
- * Compositor implementation.
- *
- * The composite layer tree reflects exactly the basic layer tree. To
- * composite to screen, the layer manager walks the layer tree calling render
- * methods which in turn call into their CompositableHosts' Composite methods.
- * These call Compositor::DrawQuad to do the rendering.
- *
- * Mostly, layers are updated during the layers transaction. This is done from
- * CompositableClient to CompositableHost without interacting with the layer.
- *
- * A reference to the Compositor is stored in LayerManagerComposite.
+ * General information and tree management for layers.
  */
 class LayerComposite
 {
 public:
-  LayerComposite(LayerManagerComposite* aManager);
+  LayerComposite(LayerManagerComposite *aManager)
+    : mCompositeManager(aManager)
+    , mCompositor(aManager->GetCompositor())
+    , mDestroyed(false)
+  { }
 
-  virtual ~LayerComposite();
+  virtual ~LayerComposite() {}
 
-  virtual LayerComposite* GetFirstChildComposite()
+  virtual LayerComposite *GetFirstChildComposite()
   {
     return nullptr;
   }
 
   /* Do NOT call this from the generic LayerComposite destructor.  Only from the
    * concrete class destructor
    */
   virtual void Destroy();
@@ -294,63 +292,19 @@ public:
     MOZ_ASSERT(false, "called SetCompositableHost for a layer without a compositable host");
   }
   virtual CompositableHost* GetCompositableHost() = 0;
 
   virtual void CleanupResources() = 0;
 
   virtual TiledLayerComposer* GetTiledLayerComposer() { return nullptr; }
 
-
-  virtual void DestroyFrontBuffer() { }
-
-  /**
-   * The following methods are
-   *
-   * CONSTRUCTION PHASE ONLY
-   *
-   * They are analogous to the Layer interface.
-   */
-  void SetShadowVisibleRegion(const nsIntRegion& aRegion)
-  {
-    mShadowVisibleRegion = aRegion;
-  }
-
-  void SetShadowOpacity(float aOpacity)
-  {
-    mShadowOpacity = aOpacity;
-  }
-
-  void SetShadowClipRect(const nsIntRect* aRect)
-  {
-    mUseShadowClipRect = aRect != nullptr;
-    if (aRect) {
-      mShadowClipRect = *aRect;
-    }
-  }
-
-  void SetShadowTransform(const gfx3DMatrix& aMatrix)
-  {
-    mShadowTransform = aMatrix;
-  }
-
-  // These getters can be used anytime.
-  float GetShadowOpacity() { return mShadowOpacity; }
-  const nsIntRect* GetShadowClipRect() { return mUseShadowClipRect ? &mShadowClipRect : nullptr; }
-  const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; }
-  const gfx3DMatrix& GetShadowTransform() { return mShadowTransform; }
-
 protected:
-  gfx3DMatrix mShadowTransform;
-  nsIntRegion mShadowVisibleRegion;
-  nsIntRect mShadowClipRect;
   LayerManagerComposite* mCompositeManager;
   RefPtr<Compositor> mCompositor;
-  float mShadowOpacity;
-  bool mUseShadowClipRect;
   bool mDestroyed;
 };
 
 
 } /* layers */
 } /* mozilla */
 
 #endif /* GFX_LayerManagerComposite_H */
--- a/gfx/layers/composite/ThebesLayerComposite.cpp
+++ b/gfx/layers/composite/ThebesLayerComposite.cpp
@@ -21,17 +21,17 @@
 
 #include "mozilla/layers/CompositorTypes.h" // for TextureInfo
 #include "mozilla/layers/Effects.h"
 
 namespace mozilla {
 namespace layers {
 
 ThebesLayerComposite::ThebesLayerComposite(LayerManagerComposite *aManager)
-  : ThebesLayer(aManager, nullptr)
+  : ShadowThebesLayer(aManager, nullptr)
   , LayerComposite(aManager)
   , mBuffer(nullptr)
 {
   MOZ_COUNT_CTOR(ThebesLayerComposite);
   mImplData = static_cast<LayerComposite*>(this);
 }
 
 ThebesLayerComposite::~ThebesLayerComposite()
--- a/gfx/layers/composite/ThebesLayerComposite.h
+++ b/gfx/layers/composite/ThebesLayerComposite.h
@@ -5,40 +5,45 @@
 
 #ifndef GFX_ThebesLayerComposite_H
 #define GFX_ThebesLayerComposite_H
 
 #include "mozilla/layers/PLayerTransaction.h"
 #include "mozilla/layers/ShadowLayers.h"
 
 #include "Layers.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "base/task.h"
 
 
 namespace mozilla {
 namespace layers {
 
 /**
  * Thebes layers use ContentHosts for their compsositable host.
  * By using different ContentHosts, ThebesLayerComposite support tiled and
  * non-tiled Thebes layers and single or double buffering.
  */
 
 class ContentHost;
 
-class ThebesLayerComposite : public ThebesLayer,
+class ThebesLayerComposite : public ShadowThebesLayer,
                              public LayerComposite
 {
 public:
   ThebesLayerComposite(LayerManagerComposite *aManager);
   virtual ~ThebesLayerComposite();
 
   virtual void Disconnect() MOZ_OVERRIDE;
 
+  virtual void SetValidRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
+  {
+    ShadowThebesLayer::SetValidRegion(aRegion);
+  }
+
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
 
   virtual void Destroy() MOZ_OVERRIDE;
 
   virtual Layer* GetLayer() MOZ_OVERRIDE;
 
@@ -50,33 +55,20 @@ public:
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   virtual void SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
   void EnsureTiled() { mRequiresTiledProperties = true; }
 
-  virtual void InvalidateRegion(const nsIntRegion& aRegion)
-  {
-    NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions");
-  }
-
-  void SetValidRegion(const nsIntRegion& aRegion)
-  {
-    MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
-    mValidRegion = aRegion;
-    Mutated();
-  }
-
-  MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_SHADOW)
+#ifdef MOZ_LAYERS_HAVE_LOG
+  virtual const char* Name() const MOZ_OVERRIDE { return "ThebesLayerComposite"; }
 
 protected:
-
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
 #endif
 
 private:
   gfxRect GetDisplayPort();
   gfxSize GetEffectiveResolution();
   gfxRect GetCompositionBounds();
 
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -8,18 +8,17 @@
 #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/LayerManagerComposite.h"
-#include "mozilla/layers/ThebesLayerComposite.h"
+#include "LayerManagerComposite.h"
 #include "CompositorParent.h"
 
 namespace mozilla {
 namespace layers {
 
 bool
 CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation& aEdit,
                                                      EditReplyVector& replyv)
@@ -52,17 +51,17 @@ CompositableParentManager::ReceiveCompos
       const OpPaintTexture& op = aEdit.get_OpPaintTexture();
 
       CompositableParent* compositableParent =
         static_cast<CompositableParent*>(op.compositableParent());
       CompositableHost* compositable =
         compositableParent->GetCompositableHost();
 
       Layer* layer = compositable ? compositable->GetLayer() : nullptr;
-      LayerComposite* shadowLayer = layer ? layer->AsLayerComposite() : 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
         // layer. Don't panic, it is okay in this case. it should not be
@@ -102,18 +101,18 @@ CompositableParentManager::ReceiveCompos
     }
     case CompositableOperation::TOpPaintTextureRegion: {
       MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));
 
       const OpPaintTextureRegion& op = aEdit.get_OpPaintTextureRegion();
       CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
       CompositableHost* compositable =
         compositableParent->GetCompositableHost();
-      ThebesLayerComposite* thebes =
-        static_cast<ThebesLayerComposite*>(compositable->GetLayer());
+      ShadowThebesLayer* thebes =
+        static_cast<ShadowThebesLayer*>(compositable->GetLayer());
 
       const ThebesBufferData& bufferData = op.bufferData();
 
       RenderTraceInvalidateStart(thebes, "FF00FF", op.updatedRegion().GetBounds());
 
       nsIntRegion frontUpdatedRegion;
       compositable->UpdateThebes(bufferData,
                                  op.updatedRegion(),
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -398,19 +398,19 @@ CompositorParent::ScheduleTask(Cancelabl
     MessageLoop::current()->PostDelayedTask(FROM_HERE, task, time);
   }
 }
 
 void
 CompositorParent::NotifyShadowTreeTransaction()
 {
   if (mLayerManager) {
-    LayerManagerComposite* managerComposite = mLayerManager->AsLayerManagerComposite();
-    if (managerComposite) {
-      managerComposite->NotifyShadowTreeTransaction();
+    ShadowLayerManager *shadow = mLayerManager->AsShadowManager();
+    if (shadow) {
+      shadow->NotifyShadowTreeTransaction();
     }
   }
   ScheduleComposition();
 }
 
 void
 CompositorParent::ScheduleComposition()
 {
@@ -657,49 +657,49 @@ CompositorParent::TransformFixedLayers(L
     if (ContainerLayer* c = aLayer->AsContainerLayer()) {
       layerTransform.Scale(1.0f/c->GetPreXScale(),
                            1.0f/c->GetPreYScale(),
                            1);
     }
     layerTransform.ScalePost(1.0f/aLayer->GetPostXScale(),
                              1.0f/aLayer->GetPostYScale(),
                              1);
-    LayerComposite* layerComposite = aLayer->AsLayerComposite();
-    layerComposite->SetShadowTransform(layerTransform);
+    ShadowLayer* shadow = aLayer->AsShadowLayer();
+    shadow->SetShadowTransform(layerTransform);
 
     const nsIntRect* clipRect = aLayer->GetClipRect();
     if (clipRect) {
       nsIntRect transformedClipRect(*clipRect);
       transformedClipRect.MoveBy(translation.x, translation.y);
-      layerComposite->SetShadowClipRect(&transformedClipRect);
+      shadow->SetShadowClipRect(&transformedClipRect);
     }
 
     // The transform has now been applied, so there's no need to iterate over
     // child layers.
     return;
   }
 
   for (Layer* child = aLayer->GetFirstChild();
        child; child = child->GetNextSibling()) {
     TransformFixedLayers(child, aTranslation, aScaleDiff, aFixedLayerMargins);
   }
 }
 
-// Go down the composite layer tree, setting properties to match their
-// content-side counterparts.
+// Go down shadow layer tree, setting properties to match their non-shadow
+// counterparts.
 static void
 SetShadowProperties(Layer* aLayer)
 {
   // FIXME: Bug 717688 -- Do these updates in LayerTransactionParent::RecvUpdate.
-  LayerComposite* layerComposite = aLayer->AsLayerComposite();
-  // Set the layerComposite's base transform to the layer's base transform.
-  layerComposite->SetShadowTransform(aLayer->GetBaseTransform());
-  layerComposite->SetShadowVisibleRegion(aLayer->GetVisibleRegion());
-  layerComposite->SetShadowClipRect(aLayer->GetClipRect());
-  layerComposite->SetShadowOpacity(aLayer->GetOpacity());
+  ShadowLayer* shadow = aLayer->AsShadowLayer();
+  // Set the shadow's base transform to the layer's base transform.
+  shadow->SetShadowTransform(aLayer->GetBaseTransform());
+  shadow->SetShadowVisibleRegion(aLayer->GetVisibleRegion());
+  shadow->SetShadowClipRect(aLayer->GetClipRect());
+  shadow->SetShadowOpacity(aLayer->GetOpacity());
 
   for (Layer* child = aLayer->GetFirstChild();
       child; child = child->GetNextSibling()) {
     SetShadowProperties(child);
   }
 }
 
 static void
@@ -788,33 +788,33 @@ SampleAnimations(Layer* aLayer, TimeStam
     double portion = animData.mFunctions[segmentIndex]->GetValue(positionInSegment);
 
     activeAnimations = true;
 
     // interpolate the property
     Animatable interpolatedValue;
     SampleValue(portion, animation, animData.mStartValues[segmentIndex],
                 animData.mEndValues[segmentIndex], &interpolatedValue);
-    LayerComposite* layerComposite = aLayer->AsLayerComposite();
+    ShadowLayer* shadow = aLayer->AsShadowLayer();
     switch (animation.property()) {
     case eCSSProperty_opacity:
     {
-      layerComposite->SetShadowOpacity(interpolatedValue.get_float());
+      shadow->SetShadowOpacity(interpolatedValue.get_float());
       break;
     }
     case eCSSProperty_transform:
     {
       gfx3DMatrix matrix = interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value();
       if (ContainerLayer* c = aLayer->AsContainerLayer()) {
         matrix.ScalePost(c->GetInheritedXScale(),
                          c->GetInheritedYScale(),
                          1);
       }
       NS_ASSERTION(!aLayer->GetIsFixedPosition(), "Can't animate transforms on fixed-position layers");
-      layerComposite->SetShadowTransform(matrix);
+      shadow->SetShadowTransform(matrix);
       break;
     }
     default:
       NS_WARNING("Unhandled animated property");
     }
   }
 
   for (Layer* child = aLayer->GetFirstChild(); child;
@@ -838,17 +838,17 @@ CompositorParent::ApplyAsyncContentTrans
   }
 
   ContainerLayer* container = aLayer->AsContainerLayer();
   if (!container) {
     return appliedTransform;
   }
 
   if (AsyncPanZoomController* controller = aLayer->GetAsyncPanZoomController()) {
-    LayerComposite* layerComposite = aLayer->AsLayerComposite();
+    ShadowLayer* shadow = aLayer->AsShadowLayer();
 
     ViewTransform treeTransform;
     *aWantNextFrame |=
       controller->SampleContentTransformForFrame(aCurrentFrame,
                                                  container,
                                                  &treeTransform);
 
     gfx3DMatrix transform(gfx3DMatrix(treeTransform) * aLayer->GetTransform());
@@ -856,17 +856,17 @@ CompositorParent::ApplyAsyncContentTrans
     // will apply the resolution scale again when computing the effective
     // transform, we must apply the inverse resolution scale here.
     transform.Scale(1.0f/container->GetPreXScale(),
                     1.0f/container->GetPreYScale(),
                     1);
     transform.ScalePost(1.0f/aLayer->GetPostXScale(),
                         1.0f/aLayer->GetPostYScale(),
                         1);
-    layerComposite->SetShadowTransform(transform);
+    shadow->SetShadowTransform(transform);
 
     gfx::Margin fixedLayerMargins(0, 0, 0, 0);
     TransformFixedLayers(
       aLayer,
       -treeTransform.mTranslation / treeTransform.mScale,
       treeTransform.mScale,
       fixedLayerMargins);
 
@@ -874,17 +874,17 @@ CompositorParent::ApplyAsyncContentTrans
   }
 
   return appliedTransform;
 }
 
 void
 CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRootTransform)
 {
-  LayerComposite* layerComposite = aLayer->AsLayerComposite();
+  ShadowLayer* shadow = aLayer->AsShadowLayer();
   ContainerLayer* container = aLayer->AsContainerLayer();
 
   const FrameMetrics& metrics = container->GetFrameMetrics();
   // We must apply the resolution scale before a pan/zoom transform, so we call
   // GetTransform here.
   const gfx3DMatrix& currentTransform = aLayer->GetTransform();
 
   gfx3DMatrix treeTransform;
@@ -986,17 +986,17 @@ CompositorParent::TransformScrollableLay
   // transform, we must apply the inverse resolution scale here.
   gfx3DMatrix computedTransform = treeTransform * currentTransform;
   computedTransform.Scale(1.0f/container->GetPreXScale(),
                           1.0f/container->GetPreYScale(),
                           1);
   computedTransform.ScalePost(1.0f/container->GetPostXScale(),
                               1.0f/container->GetPostYScale(),
                               1);
-  layerComposite->SetShadowTransform(computedTransform);
+  shadow->SetShadowTransform(computedTransform);
   TransformFixedLayers(aLayer, offset, scaleDiff, fixedLayerMargins);
 }
 
 bool
 CompositorParent::TransformShadowTree(TimeStamp aCurrentFrame)
 {
   bool wantNextFrame = false;
   Layer* root = mLayerManager->GetRoot();
@@ -1058,19 +1058,19 @@ CompositorParent::ShadowLayersUpdated(La
   mIsFirstPaint = mIsFirstPaint || isFirstPaint;
   mLayersUpdated = true;
   Layer* root = aLayerTree->GetRoot();
   mLayerManager->SetRoot(root);
   if (root) {
     SetShadowProperties(root);
   }
   ScheduleComposition();
-  LayerManagerComposite *layerComposite = mLayerManager->AsLayerManagerComposite();
-  if (layerComposite) {
-    layerComposite->NotifyShadowTreeTransaction();
+  ShadowLayerManager *shadow = mLayerManager->AsShadowManager();
+  if (shadow) {
+    shadow->NotifyShadowTreeTransaction();
   }
 }
 
 
 void
 CompositorParent::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom,
                                         const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect)
 {
@@ -1127,17 +1127,17 @@ CompositorParent::AllocPLayerTransaction
 
     *aTextureFactoryIdentifier = mLayerManager->GetTextureFactoryIdentifier();
     return new LayerTransactionParent(mLayerManager, this, 0);
   // Basic layers compositor not yet implemented
   /*} else if (aBackendHint == mozilla::layers::LAYERS_BASIC) {
     nsRefPtr<LayerManager> layerManager = new BasicShadowLayerManager(mWidget);
     mWidget = NULL;
     mLayerManager = layerManager;
-    LayerManagerComposite* slm = layerManager->AsLayerManagerComposite();
+    ShadowLayerManager* slm = layerManager->AsShadowManager();
     if (!slm) {
       return NULL;
     }
     *aTextureFactoryIdentifier = layerManager->GetTextureFactoryIdentifier();
     return new LayerTransactionParent(slm, this, 0); */
   } else {
     NS_ERROR("Unsupported backend selected for Async Compositor");
     return NULL;
@@ -1370,17 +1370,17 @@ PLayerTransactionParent*
 CrossProcessCompositorParent::AllocPLayerTransaction(const LayersBackend& aBackendType,
                                                      const uint64_t& aId,
                                                      TextureFactoryIdentifier* aTextureFactoryIdentifier)
 {
   MOZ_ASSERT(aId != 0);
 
   nsRefPtr<LayerManager> lm = sCurrentCompositor->GetLayerManager();
   *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
-  return new LayerTransactionParent(lm->AsLayerManagerComposite(), this, aId);
+  return new LayerTransactionParent(lm->AsShadowManager(), this, aId);
 }
 
 bool
 CrossProcessCompositorParent::DeallocPLayerTransaction(PLayerTransactionParent* aLayers)
 {
   LayerTransactionParent* slp = static_cast<LayerTransactionParent*>(aLayers);
   RemoveIndirectTree(slp->GetId());
   delete aLayers;
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -16,17 +16,17 @@
 //#define COMPOSITOR_PERFORMANCE_WARNING
 
 #include "mozilla/layers/PCompositorParent.h"
 #include "mozilla/layers/PLayerTransactionParent.h"
 #include "base/thread.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/TimeStamp.h"
 #include "ShadowLayersManager.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 class nsIWidget;
 
 namespace base {
 class Thread;
 }
 
 namespace mozilla {
 namespace layers {
--- a/gfx/layers/ipc/ImageBridgeChild.cpp
+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
@@ -11,17 +11,16 @@
 #include "gfxSharedImageSurface.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/layers/CompositableClient.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/ImageClient.h"
 #include "mozilla/layers/LayersTypes.h"
-#include "ShadowLayers.h"
 
 using namespace base;
 using namespace mozilla::ipc;
 
 namespace mozilla {
 namespace layers {
 
 typedef std::vector<CompositableOperation> OpVector;
--- a/gfx/layers/ipc/ImageBridgeParent.cpp
+++ b/gfx/layers/ipc/ImageBridgeParent.cpp
@@ -54,17 +54,17 @@ ImageBridgeParent::RecvUpdate(const Edit
   aReply->SetCapacity(replyv.size());
   if (replyv.size() > 0) {
     aReply->AppendElements(&replyv.front(), replyv.size());
   }
 
   // Ensure that any pending operations involving back and front
   // buffers have completed, so that neither process stomps on the
   // other's buffer contents.
-  LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
+  ShadowLayerManager::PlatformSyncBeforeReplyUpdate();
 
   return true;
 }
 
 bool
 ImageBridgeParent::RecvUpdateNoSwap(const EditArray& aEdits)
 {
   InfallibleTArray<EditReply> noReplies;
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -16,21 +16,16 @@
 #include "RenderTrace.h"
 #include "ShadowLayerParent.h"
 #include "LayerTransactionParent.h"
 #include "ShadowLayers.h"
 #include "ShadowLayerUtils.h"
 #include "TiledLayerBuffer.h"
 #include "gfxPlatform.h"
 #include "CompositableHost.h"
-#include "mozilla/layers/ThebesLayerComposite.h"
-#include "mozilla/layers/ImageLayerComposite.h"
-#include "mozilla/layers/ColorLayerComposite.h"
-#include "mozilla/layers/ContainerLayerComposite.h"
-#include "mozilla/layers/CanvasLayerComposite.h"
 
 typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
 
 using mozilla::layout::RenderFrameParent;
 
 namespace mozilla {
 namespace layers {
 
@@ -47,23 +42,23 @@ static CompositableParent*
 cast(const PCompositableParent* in)
 {
   return const_cast<CompositableParent*>(
     static_cast<const CompositableParent*>(in));
 }
 
 template<class OpCreateT>
 static ShadowLayerParent*
-AsLayerComposite(const OpCreateT& op)
+AsShadowLayer(const OpCreateT& op)
 {
   return cast(op.layerParent());
 }
 
 static ShadowLayerParent*
-AsLayerComposite(const OpSetRoot& op)
+AsShadowLayer(const OpSetRoot& op)
 {
   return cast(op.rootParent());
 }
 
 static ShadowLayerParent*
 ShadowContainer(const OpInsertAfter& op)
 {
   return cast(op.containerParent());
@@ -125,17 +120,17 @@ ShadowContainer(const OpRaiseToTopChild&
 static ShadowLayerParent*
 ShadowChild(const OpRaiseToTopChild& op)
 {
   return cast(op.childLayerParent());
 }
 
 //--------------------------------------------------
 // LayerTransactionParent
-LayerTransactionParent::LayerTransactionParent(LayerManagerComposite* aManager,
+LayerTransactionParent::LayerTransactionParent(ShadowLayerManager* aManager,
                                                ShadowLayersManager* aLayersManager,
                                                uint64_t aId)
   : mLayerManager(aManager)
   , mShadowLayersManager(aLayersManager)
   , mId(aId)
   , mDestroyed(false)
 {
   MOZ_COUNT_CTOR(LayerTransactionParent);
@@ -189,66 +184,66 @@ LayerTransactionParent::RecvUpdate(const
   for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
     const Edit& edit = cset[i];
 
     switch (edit.type()) {
     // Create* ops
     case Edit::TOpCreateThebesLayer: {
       MOZ_LAYERS_LOG(("[ParentSide] CreateThebesLayer"));
 
-      nsRefPtr<ThebesLayerComposite> layer =
-        layer_manager()->CreateThebesLayerComposite();
-      AsLayerComposite(edit.get_OpCreateThebesLayer())->Bind(layer);
+      nsRefPtr<ShadowThebesLayer> layer =
+        layer_manager()->CreateShadowThebesLayer();
+      AsShadowLayer(edit.get_OpCreateThebesLayer())->Bind(layer);
       break;
     }
     case Edit::TOpCreateContainerLayer: {
       MOZ_LAYERS_LOG(("[ParentSide] CreateContainerLayer"));
 
-      nsRefPtr<ContainerLayer> layer = layer_manager()->CreateContainerLayerComposite();
-      AsLayerComposite(edit.get_OpCreateContainerLayer())->Bind(layer);
+      nsRefPtr<ContainerLayer> layer = layer_manager()->CreateShadowContainerLayer();
+      AsShadowLayer(edit.get_OpCreateContainerLayer())->Bind(layer);
       break;
     }
     case Edit::TOpCreateImageLayer: {
       MOZ_LAYERS_LOG(("[ParentSide] CreateImageLayer"));
 
-      nsRefPtr<ImageLayerComposite> layer =
-        layer_manager()->CreateImageLayerComposite();
-      AsLayerComposite(edit.get_OpCreateImageLayer())->Bind(layer);
+      nsRefPtr<ShadowImageLayer> layer =
+        layer_manager()->CreateShadowImageLayer();
+      AsShadowLayer(edit.get_OpCreateImageLayer())->Bind(layer);
       break;
     }
     case Edit::TOpCreateColorLayer: {
       MOZ_LAYERS_LOG(("[ParentSide] CreateColorLayer"));
 
-      nsRefPtr<ColorLayerComposite> layer = layer_manager()->CreateColorLayerComposite();
-      AsLayerComposite(edit.get_OpCreateColorLayer())->Bind(layer);
+      nsRefPtr<ShadowColorLayer> layer = layer_manager()->CreateShadowColorLayer();
+      AsShadowLayer(edit.get_OpCreateColorLayer())->Bind(layer);
       break;
     }
     case Edit::TOpCreateCanvasLayer: {
       MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
 
-      nsRefPtr<CanvasLayerComposite> layer =
-        layer_manager()->CreateCanvasLayerComposite();
-      AsLayerComposite(edit.get_OpCreateCanvasLayer())->Bind(layer);
+      nsRefPtr<ShadowCanvasLayer> layer =
+        layer_manager()->CreateShadowCanvasLayer();
+      AsShadowLayer(edit.get_OpCreateCanvasLayer())->Bind(layer);
       break;
     }
     case Edit::TOpCreateRefLayer: {
       MOZ_LAYERS_LOG(("[ParentSide] CreateRefLayer"));
 
-      nsRefPtr<RefLayerComposite> layer =
-        layer_manager()->CreateRefLayerComposite();
-      AsLayerComposite(edit.get_OpCreateRefLayer())->Bind(layer);
+      nsRefPtr<ShadowRefLayer> layer =
+        layer_manager()->CreateShadowRefLayer();
+      AsShadowLayer(edit.get_OpCreateRefLayer())->Bind(layer);
       break;
     }
 
       // Attributes
     case Edit::TOpSetLayerAttributes: {
       MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
 
       const OpSetLayerAttributes& osla = edit.get_OpSetLayerAttributes();
-      Layer* layer = AsLayerComposite(osla)->AsLayer();
+      Layer* layer = AsShadowLayer(osla)->AsLayer();
       const LayerAttributes& attrs = osla.attrs();
 
       const CommonLayerAttributes& common = attrs.common();
       layer->SetVisibleRegion(common.visibleRegion());
       layer->SetContentFlags(common.contentFlags());
       layer->SetOpacity(common.opacity());
       layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
       layer->SetBaseTransform(common.transform().value());
@@ -267,18 +262,18 @@ LayerTransactionParent::RecvUpdate(const
       const SpecificLayerAttributes& specific = attrs.specific();
       switch (specific.type()) {
       case Specific::Tnull_t:
         break;
 
       case Specific::TThebesLayerAttributes: {
         MOZ_LAYERS_LOG(("[ParentSide]   thebes layer"));
 
-        ThebesLayerComposite* thebesLayer =
-          static_cast<ThebesLayerComposite*>(layer);
+        ShadowThebesLayer* thebesLayer =
+          static_cast<ShadowThebesLayer*>(layer);
         const ThebesLayerAttributes& attrs =
           specific.get_ThebesLayerAttributes();
 
         thebesLayer->SetValidRegion(attrs.validRegion());
 
         break;
       }
       case Specific::TContainerLayerAttributes: {
@@ -300,17 +295,17 @@ LayerTransactionParent::RecvUpdate(const
           specific.get_ColorLayerAttributes().color().value());
         break;
 
       case Specific::TCanvasLayerAttributes:
         MOZ_LAYERS_LOG(("[ParentSide]   canvas layer"));
 
         static_cast<CanvasLayer*>(layer)->SetFilter(
           specific.get_CanvasLayerAttributes().filter());
-        static_cast<CanvasLayerComposite*>(layer)->SetBounds(
+        static_cast<ShadowCanvasLayer*>(layer)->SetBounds(
           specific.get_CanvasLayerAttributes().bounds());
         break;
 
       case Specific::TRefLayerAttributes:
         MOZ_LAYERS_LOG(("[ParentSide]   ref layer"));
 
         static_cast<RefLayer*>(layer)->SetReferentId(
           specific.get_RefLayerAttributes().id());
@@ -328,17 +323,17 @@ LayerTransactionParent::RecvUpdate(const
         NS_RUNTIMEABORT("not reached");
       }
       break;
     }
     // Tree ops
     case Edit::TOpSetRoot: {
       MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
 
-      mRoot = AsLayerComposite(edit.get_OpSetRoot())->AsContainer();
+      mRoot = AsShadowLayer(edit.get_OpSetRoot())->AsContainer();
       break;
     }
     case Edit::TOpInsertAfter: {
       MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
 
       const OpInsertAfter& oia = edit.get_OpInsertAfter();
       ShadowContainer(oia)->AsContainer()->InsertAfter(
         ShadowChild(oia)->AsLayer(), ShadowAfter(oia)->AsLayer());
@@ -406,34 +401,34 @@ LayerTransactionParent::RecvUpdate(const
     if (replyv.size() > 0) {
       reply->AppendElements(&replyv.front(), replyv.size());
     }
   }
 
   // Ensure that any pending operations involving back and front
   // buffers have completed, so that neither process stomps on the
   // other's buffer contents.
-  LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
+  ShadowLayerManager::PlatformSyncBeforeReplyUpdate();
 
   mShadowLayersManager->ShadowLayersUpdated(this, targetConfig, isFirstPaint);
 
 #ifdef COMPOSITOR_PERFORMANCE_WARNING
   int compositeTime = (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();
   if (compositeTime > 15) {
     printf_stderr("Compositor: Layers update took %i ms (blocking gecko).\n", compositeTime);
   }
 #endif
 
   return true;
 }
 
 void
 LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent, CompositableParent* aCompositable)
 {
-  LayerComposite* layer = aLayerParent->AsLayer()->AsLayerComposite();
+  ShadowLayer* layer = aLayerParent->AsLayer()->AsShadowLayer();
   MOZ_ASSERT(layer);
   LayerComposite* layerComposite = aLayerParent->AsLayer()->AsLayerComposite();
 
   Compositor* compositor
     = static_cast<LayerManagerComposite*>(aLayerParent->AsLayer()->Manager())->GetCompositor();
 
   CompositableHost* compositable = aCompositable->GetCompositableHost();
   MOZ_ASSERT(compositable);
--- a/gfx/layers/ipc/LayerTransactionParent.h
+++ b/gfx/layers/ipc/LayerTransactionParent.h
@@ -17,36 +17,36 @@ namespace mozilla {
 
 namespace layout {
 class RenderFrameParent;
 }
 
 namespace layers {
 
 class Layer;
-class LayerManagerComposite;
+class ShadowLayerManager;
 class ShadowLayerParent;
 class CompositableParent;
 
 class LayerTransactionParent : public PLayerTransactionParent,
                                public CompositableParentManager
 {
   typedef mozilla::layout::RenderFrameParent RenderFrameParent;
   typedef InfallibleTArray<Edit> EditArray;
   typedef InfallibleTArray<EditReply> EditReplyArray;
 
 public:
-  LayerTransactionParent(LayerManagerComposite* aManager,
+  LayerTransactionParent(ShadowLayerManager* aManager,
                          ShadowLayersManager* aLayersManager,
                          uint64_t aId);
   ~LayerTransactionParent();
 
   void Destroy();
 
-  LayerManagerComposite* layer_manager() const { return mLayerManager; }
+  ShadowLayerManager* layer_manager() const { return mLayerManager; }
 
   uint64_t GetId() const { return mId; }
   ContainerLayer* GetRoot() const { return mRoot; }
 
   // ISurfaceAllocator
   virtual bool AllocShmem(size_t aSize,
                           ipc::SharedMemory::SharedMemoryType aType,
                           ipc::Shmem* aShmem) {
@@ -83,21 +83,21 @@ protected:
   virtual bool
   DeallocPGrallocBuffer(PGrallocBufferParent* actor) MOZ_OVERRIDE;
 
   virtual PLayerParent* AllocPLayer() MOZ_OVERRIDE;
   virtual bool DeallocPLayer(PLayerParent* actor) 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<LayerManagerComposite> mLayerManager;
+  nsRefPtr<ShadowLayerManager> mLayerManager;
   ShadowLayersManager* mShadowLayersManager;
   // Hold the root because it might be grafted under various
   // containers in the "real" layer tree
   nsRefPtr<ContainerLayer> mRoot;
   // When this is nonzero, it refers to a layer tree owned by the
   // compositor thread.  It is always true that
   //   mId != 0 => mRoot == null
   // because the "real tree" is owned by the compositor.
--- a/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
@@ -3,17 +3,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 <d3d10_1.h>
 #include <dxgi.h>
 
-#include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/layers/PLayerTransaction.h"
 #include "ShadowLayers.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
@@ -74,31 +73,31 @@ ShadowLayerForwarder::PlatformSyncBefore
 
 bool
 ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
 {
   return false;
 }
 
 /*static*/ already_AddRefed<TextureImage>
-LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
-                                                        const SurfaceDescriptor&,
-                                                        GLenum)
+ShadowLayerManager::OpenDescriptorForDirectTexturing(GLContext*,
+                                                     const SurfaceDescriptor&,
+                                                     GLenum)
 {
   return nullptr;
 }
 
 /*static*/ bool
-LayerManagerComposite::SupportsDirectTexturing()
+ShadowLayerManager::SupportsDirectTexturing()
 {
   return true;
 }
 
 /*static*/ void
-LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
+ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
 {
 }
 
 bool
 GetDescriptor(ID3D10Texture2D* aTexture, SurfaceDescriptorD3D10* aDescr)
 {
   NS_ABORT_IF_FALSE(aTexture && aDescr, "Params must be nonnull");
 
--- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
@@ -6,18 +6,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/DebugOnly.h"
 
 #include "mozilla/layers/PGrallocBufferChild.h"
 #include "mozilla/layers/PGrallocBufferParent.h"
 #include "mozilla/layers/PLayerTransactionChild.h"
 #include "mozilla/layers/ShadowLayers.h"
-#include "mozilla/layers/LayerManagerComposite.h"
-#include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/unused.h"
 #include "nsXULAppAPI.h"
 
 #include "ShadowLayerUtilsGralloc.h"
 
 #include "nsIMemoryReporter.h"
 
 #include "gfxImageSurface.h"
@@ -217,36 +215,36 @@ GrallocBufferActor::Create(const gfxIntS
   sCurrentAlloc += actor->mAllocBytes;
 
   actor->mGraphicBuffer = buffer;
   *aOutHandle = MagicGrallocBufferHandle(buffer);
   return actor;
 }
 
 /*static*/ already_AddRefed<TextureImage>
-LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext* aGL,
-                                                        const SurfaceDescriptor& aDescriptor,
-                                                        GLenum aWrapMode)
+ShadowLayerManager::OpenDescriptorForDirectTexturing(GLContext* aGL,
+                                                     const SurfaceDescriptor& aDescriptor,
+                                                     GLenum aWrapMode)
 {
-  PROFILER_LABEL("LayerManagerComposite", "OpenDescriptorForDirectTexturing");
+  PROFILER_LABEL("ShadowLayerManager", "OpenDescriptorForDirectTexturing");
   if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) {
     return nullptr;
   }
   sp<GraphicBuffer> buffer = GrallocBufferActor::GetFrom(aDescriptor);
   return aGL->CreateDirectTextureImage(buffer.get(), aWrapMode);
 }
 
 /*static*/ bool
-LayerManagerComposite::SupportsDirectTexturing()
+ShadowLayerManager::SupportsDirectTexturing()
 {
   return true;
 }
 
 /*static*/ void
-LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
+ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
 {
   // Nothing to be done for gralloc.
 }
 
 /*static*/ PGrallocBufferParent*
 GrallocBufferActor::Create(const gfxIntSize& aSize,
                            const uint32_t& aFormat,
                            const uint32_t& aUsage,
--- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.h
+++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.h
@@ -55,17 +55,17 @@ struct MagicGrallocBufferHandle {
  * GrallocBufferActor is an "IPC wrapper" for an underlying
  * GraphicBuffer (pmem region).  It allows us to cheaply and
  * conveniently share gralloc handles between processes.
  */
 class GrallocBufferActor : public PGrallocBufferChild
                          , public PGrallocBufferParent
 {
   friend class ShadowLayerForwarder;
-  friend class LayerManagerComposite;
+  friend class ShadowLayerManager;
   friend class ImageBridgeChild;
   typedef android::GraphicBuffer GraphicBuffer;
 
 public:
   virtual ~GrallocBufferActor();
 
   static PGrallocBufferParent*
   Create(const gfxIntSize& aSize, const gfxContentType& aContent,
--- a/gfx/layers/ipc/ShadowLayerUtilsMac.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsMac.cpp
@@ -2,18 +2,16 @@
  * 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 "mozilla/layers/PLayerTransaction.h"
 #include "mozilla/layers/ShadowLayers.h"
-#include "mozilla/layers/LayerManagerComposite.h"
-#include "mozilla/layers/CompositorTypes.h"
 
 #include "gfxPlatform.h"
 
 #include "gfxSharedQuartzSurface.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
@@ -69,35 +67,35 @@ ShadowLayerForwarder::PlatformDestroySha
 }
 
 /*static*/ void
 ShadowLayerForwarder::PlatformSyncBeforeUpdate()
 {
 }
 
 /*static*/ void
-LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
+ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
 {
 }
 
 bool
 ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
 {
   return false;
 }
 
 /*static*/ already_AddRefed<TextureImage>
-LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
-                                                        const SurfaceDescriptor&,
-                                                        GLenum)
+ShadowLayerManager::OpenDescriptorForDirectTexturing(GLContext*,
+                                                     const SurfaceDescriptor&,
+                                                     GLenum)
 {
   return nullptr;
 }
 
 /*static*/ bool
-LayerManagerComposite::SupportsDirectTexturing()
+ShadowLayerManager::SupportsDirectTexturing()
 {
   return false;
 }
 
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
@@ -1,21 +1,18 @@
 /* -*- 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 "mozilla/layers/PLayerTransaction.h"
-#include "mozilla/layers/LayerManagerComposite.h"
-#include "mozilla/layers/CompositorTypes.h"
-#include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/layers/ShadowLayers.h"
-
+ 
 #include "gfxPlatform.h"
 
 #include "gfxXlibSurface.h"
 #include "mozilla/X11Util.h"
 #include "cairo-xlib.h"
 
 using namespace mozilla::gl;
 
@@ -182,39 +179,39 @@ ShadowLayerForwarder::PlatformSyncBefore
     // operations on the back buffers before handing them to the
     // parent, otherwise the surface might be used by the parent's
     // Display in between two operations queued by our Display.
     FinishX(DefaultXDisplay());
   }
 }
 
 /*static*/ void
-LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
+ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
 {
   if (UsingXCompositing()) {
     // If we're using X surfaces, we need to finish all pending
     // operations on the *front buffers* before handing them back to
     // the child, even though they will be read operations.
     // Otherwise, the child might start scribbling on new back buffers
     // that are still participating in requests as old front buffers.
     FinishX(DefaultXDisplay());
   }
 }
 
 /*static*/ already_AddRefed<TextureImage>
-LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
-                                                        const SurfaceDescriptor&,
-                                                        GLenum)
+ShadowLayerManager::OpenDescriptorForDirectTexturing(GLContext*,
+                                                     const SurfaceDescriptor&,
+                                                     GLenum)
 {
   // FIXME/bug XXXXXX: implement this using texture-from-pixmap
   return nullptr;
 }
 
 /*static*/ bool
-LayerManagerComposite::SupportsDirectTexturing()
+ShadowLayerManager::SupportsDirectTexturing()
 {
   return false;
 }
 
 bool
 ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
 {
   if (SurfaceDescriptor::TSurfaceDescriptorX11 != aSurface->type()) {
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -586,16 +586,35 @@ ShadowLayerForwarder::PlatformSyncBefore
 }
 
 bool
 ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
 {
   return false;
 }
 
+/*static*/ already_AddRefed<TextureImage>
+ShadowLayerManager::OpenDescriptorForDirectTexturing(GLContext*,
+                                                     const SurfaceDescriptor&,
+                                                     GLenum)
+{
+  return nullptr;
+}
+
+/*static*/ bool
+ShadowLayerManager::SupportsDirectTexturing()
+{
+  return false;
+}
+
+/*static*/ void
+ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
+{
+}
+
 #endif  // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
 
 AutoOpenSurface::AutoOpenSurface(OpenMode aMode,
                                  const SurfaceDescriptor& aDescriptor)
   : mDescriptor(aDescriptor)
   , mMode(aMode)
 {
   MOZ_ASSERT(IsSurfaceDescriptorValid(mDescriptor));
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -13,17 +13,16 @@
 
 #include "ImageLayers.h"
 #include "mozilla/layers/Compositor.h"
 #include "mozilla/ipc/SharedMemory.h"
 #include "mozilla/WidgetUtils.h"
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/dom/ScreenOrientation.h"
 #include "mozilla/layers/CompositableForwarder.h"
-#include "mozilla/layers/CompositorTypes.h"
 
 class gfxSharedImageSurface;
 
 namespace mozilla {
 
 namespace gl {
 class GLContext;
 class TextureImage;
@@ -34,35 +33,41 @@ namespace layers {
 class CompositableClient;
 class Edit;
 class EditReply;
 class OptionalThebesBuffer;
 class PLayerChild;
 class PLayerTransactionChild;
 class PLayerTransactionParent;
 class ShadowableLayer;
-class ThebesLayerComposite;
-class ContainerLayerComposite;
-class ImageLayerComposite;
-class ColorLayerComposite;
-class CanvasLayerComposite;
-class RefLayerComposite;
+class ShadowThebesLayer;
+class ShadowContainerLayer;
+class ShadowImageLayer;
+class ShadowColorLayer;
+class ShadowCanvasLayer;
+class ShadowRefLayer;
 class SurfaceDescriptor;
 class ThebesBuffer;
 class TiledLayerComposer;
 class Transaction;
 class SurfaceDescriptor;
 class CanvasSurface;
 class TextureClientShmem;
 class ContentClientRemote;
 class CompositableChild;
 class ImageClient;
 class CanvasClient;
 class ContentClient;
 
+enum OpenMode {
+  OPEN_READ_ONLY,
+  OPEN_READ_WRITE
+};
+
+
 
 /**
  * We want to share layer trees across thread contexts and address
  * spaces for several reasons; chief among them
  *
  *  - a parent process can paint a child process's layer tree while
  *    the child process is blocked, say on content script.  This is
  *    important on mobile devices where UI responsiveness is key.
@@ -81,23 +86,23 @@ class ContentClient;
  * safely "share" layer trees.  The ShadowLayers API extends Layers to
  * allow a remote, parent process to access a child process's layer
  * tree.
  *
  * ShadowLayerForwarder publishes a child context's layer tree to a
  * parent context.  This comprises recording layer-tree modifications
  * into atomic transactions and pushing them over IPC.
  *
- * LayerManagerComposite grafts layer subtrees published by child-context
+ * ShadowLayerManager grafts layer subtrees published by child-context
  * ShadowLayerForwarder(s) into a parent-context layer tree.
  *
  * (Advanced note: because our process tree may have a height >2, a
  * non-leaf subprocess may both receive updates from child processes
  * and publish them to parent processes.  Put another way,
- * LayerManagers may be both LayerManagerComposites and
+ * LayerManagers may be both ShadowLayerManagers and
  * ShadowLayerForwarders.)
  *
  * There are only shadow types for layers that have different shadow
  * vs. not-shadow behavior.  ColorLayers and ContainerLayers behave
  * the same way in both regimes (so far).
  *
  *
  * The mecanism to shadow the layer tree on the compositor through IPC works as
@@ -118,17 +123,17 @@ class ContentClient;
  * PXParent comes out in the other side. we use this property a lot to dispatch
  * messages to the right layers and compositable, each of which have their own
  * ipdl actor on both side.
  *
  * Most of the synchronization logic happens in layer transactions and
  * compositable transactions.
  * A transaction is a set of changes to the layers and/or the compositables
  * that are sent and applied together to the compositor thread to keep the
- * LayerComposite in a coherent state.
+ * ShadowLayer in a coherent state.
  * Layer transactions maintain the shape of the shadow layer tree, and
  * synchronize the texture data held by compositables. Layer transactions
  * are always between the content thread and the compositor thread.
  * Compositable transactions are subset of a layer transaction with which only
  * compositables and textures can be manipulated, and does not always originate
  * from the content thread. (See CompositableForwarder.h and ImageBridgeChild.h)
  */
 
@@ -176,17 +181,17 @@ public:
    * the compositable or it's IPDL actor here, so we use an ID instead, that
    * is matched on the compositor side.
    */
   void AttachAsyncCompositable(uint64_t aCompositableID,
                                ShadowableLayer* aLayer);
 
   /**
    * Begin recording a transaction to be forwarded atomically to a
-   * LayerManagerComposite.
+   * ShadowLayerManager.
    */
   void BeginTransaction(const nsIntRect& aTargetBounds,
                         ScreenRotation aRotation,
                         const nsIntRect& aClientBounds,
                         mozilla::dom::ScreenOrientation aOrientation);
 
   /**
    * The following methods may only be called after BeginTransaction()
@@ -283,81 +288,81 @@ public:
 
   /**
    * Communicate the picture rect of an image to the compositor
    */
   void UpdatePictureRect(CompositableClient* aCompositable,
                          const nsIntRect& aRect);
 
   /**
-   * End the current transaction and forward it to LayerManagerComposite.
-   * |aReplies| are directions from the LayerManagerComposite to the
+   * End the current transaction and forward it to ShadowLayerManager.
+   * |aReplies| are directions from the ShadowLayerManager to the
    * caller of EndTransaction().
    */
   bool EndTransaction(InfallibleTArray<EditReply>* aReplies);
 
   /**
    * Set an actor through which layer updates will be pushed.
    */
   void SetShadowManager(PLayerTransactionChild* aShadowManager)
   {
     mShadowManager = aShadowManager;
   }
 
   /**
-   * True if this is forwarding to a LayerManagerComposite.
+   * True if this is forwarding to a ShadowLayerManager.
    */
   bool HasShadowManager() const { return !!mShadowManager; }
   PLayerTransactionChild* GetShadowManager() const { return mShadowManager; }
 
   /**
    * The following Alloc/Open/Destroy interfaces abstract over the
    * details of working with surfaces that are shared across
    * processes.  They provide the glue between C++ Layers and the
-   * LayerComposite IPC system.
+   * ShadowLayer IPC system.
    *
    * The basic lifecycle is
    *
    *  - a Layer needs a buffer.  Its ShadowableLayer subclass calls
    *    AllocBuffer(), then calls one of the Created*Buffer() methods
    *    above to transfer the (temporary) front buffer to its
-   *    LayerComposite in the other process.  The Layer needs a
+   *    ShadowLayer in the other process.  The Layer needs a
    *    gfxASurface to paint, so the ShadowableLayer uses
    *    OpenDescriptor(backBuffer) to get that surface, and hands it
    *    out to the Layer.
    *
    * - a Layer has painted new pixels.  Its ShadowableLayer calls one
    *   of the Painted*Buffer() methods above with the back buffer
-   *   descriptor.  This notification is forwarded to the LayerComposite,
+   *   descriptor.  This notification is forwarded to the ShadowLayer,
    *   which uses OpenDescriptor() to access the newly-painted pixels.
-   *   The LayerComposite then updates its front buffer in a Layer- and
+   *   The ShadowLayer then updates its front buffer in a Layer- and
    *   platform-dependent way, and sends a surface descriptor back to
    *   the ShadowableLayer that becomes its new back back buffer.
    *
    * - a Layer wants to destroy its buffers.  Its ShadowableLayer
    *   calls Destroyed*Buffer(), which gives up control of the back
    *   buffer descriptor.  The actual back buffer surface is then
    *   destroyed using DestroySharedSurface() just before notifying
    *   the parent process.  When the parent process is notified, the
-   *   LayerComposite also calls DestroySharedSurface() on its front
+   *   ShadowLayer also calls DestroySharedSurface() on its front
    *   buffer, and the double-buffer pair is gone.
    */
 
   // ISurfaceAllocator
   virtual bool AllocUnsafeShmem(size_t aSize,
                                 ipc::SharedMemory::SharedMemoryType aType,
                                 ipc::Shmem* aShmem) MOZ_OVERRIDE;
   virtual bool AllocShmem(size_t aSize,
                           ipc::SharedMemory::SharedMemoryType aType,
                           ipc::Shmem* aShmem) MOZ_OVERRIDE;
   virtual void DeallocShmem(ipc::Shmem& aShmem) MOZ_OVERRIDE;
 
   /**
    * Construct a shadow of |aLayer| on the "other side", at the
-   * LayerManagerComposite.
+   * ShadowLayerManager.
    */
   PLayerChild* ConstructShadowFor(ShadowableLayer* aLayer);
 
   /**
    * Flag the next paint as the first for a document.
    */
   void SetIsFirstPaint() { mIsFirstPaint = true; }
 
@@ -422,16 +427,76 @@ private:
 
   bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
 
   Transaction* mTxn;
 
   bool mIsFirstPaint;
 };
 
+class ShadowLayerManager : public LayerManager
+{
+public:
+  virtual ~ShadowLayerManager() {}
+
+  virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Shadow"); }
+
+  /** CONSTRUCTION PHASE ONLY */
+  virtual already_AddRefed<ShadowThebesLayer> CreateShadowThebesLayer() = 0;
+  /** CONSTRUCTION PHASE ONLY */
+  virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer() = 0;
+  /** CONSTRUCTION PHASE ONLY */
+  virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer() = 0;
+  /** CONSTRUCTION PHASE ONLY */
+  virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer() = 0;
+  /** CONSTRUCTION PHASE ONLY */
+  virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer() = 0;
+  /** CONSTRUCTION PHASE ONLY */
+  virtual already_AddRefed<ShadowRefLayer> CreateShadowRefLayer() { return nullptr; }
+
+  virtual void NotifyShadowTreeTransaction() {}
+
+  /**
+   * Try to open |aDescriptor| for direct texturing.  If the
+   * underlying surface supports direct texturing, a non-null
+   * TextureImage is returned.  Otherwise null is returned.
+   */
+  static already_AddRefed<gl::TextureImage>
+  OpenDescriptorForDirectTexturing(gl::GLContext* aContext,
+                                   const SurfaceDescriptor& aDescriptor,
+                                   GLenum aWrapMode);
+
+  /**
+   * returns true if PlatformAllocBuffer will return a buffer that supports
+   * direct texturing
+   */
+  static bool SupportsDirectTexturing();
+
+  static void PlatformSyncBeforeReplyUpdate();
+
+  void SetCompositorID(uint32_t aID)
+  {
+    NS_ASSERTION(mCompositor, "No compositor");
+    mCompositor->SetCompositorID(aID);
+  }
+
+  Compositor* GetCompositor() const
+  {
+    return mCompositor;
+  }
+
+protected:
+  ShadowLayerManager()
+  : mCompositor(nullptr)
+  {}
+
+  bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
+  RefPtr<Compositor> mCompositor;
+};
+
 class CompositableClient;
 
 /**
  * A ShadowableLayer is a Layer can be shared with a parent context
  * through a ShadowLayerForwarder.  A ShadowableLayer maps to a
  * Shadow*Layer in a parent context.
  *
  * Note that ShadowLayers can themselves be ShadowableLayers.
@@ -456,12 +521,205 @@ public:
 
   virtual CompositableClient* GetCompositableClient() { return nullptr; }
 protected:
   ShadowableLayer() : mShadow(NULL) {}
 
   PLayerChild* mShadow;
 };
 
+/**
+ * A ShadowLayer is the representation of a child-context's Layer in a
+ * parent context.  They can be transformed, clipped,
+ * etc. independently of their origin Layers.
+ *
+ * Note that ShadowLayers can themselves have a shadow in a parent
+ * context.
+ */
+class ShadowLayer
+{
+public:
+  virtual ~ShadowLayer() {}
+
+  virtual void DestroyFrontBuffer() { }
+
+  /**
+   * The following methods are
+   *
+   * CONSTRUCTION PHASE ONLY
+   *
+   * They are analogous to the Layer interface.
+   */
+  void SetShadowVisibleRegion(const nsIntRegion& aRegion)
+  {
+    mShadowVisibleRegion = aRegion;
+  }
+
+  void SetShadowOpacity(float aOpacity)
+  {
+    mShadowOpacity = aOpacity;
+  }
+
+  void SetShadowClipRect(const nsIntRect* aRect)
+  {
+    mUseShadowClipRect = aRect != nullptr;
+    if (aRect) {
+      mShadowClipRect = *aRect;
+    }
+  }
+
+  void SetShadowTransform(const gfx3DMatrix& aMatrix)
+  {
+    mShadowTransform = aMatrix;
+  }
+
+  // These getters can be used anytime.
+  float GetShadowOpacity() { return mShadowOpacity; }
+  const nsIntRect* GetShadowClipRect() { return mUseShadowClipRect ? &mShadowClipRect : nullptr; }
+  const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; }
+  const gfx3DMatrix& GetShadowTransform() { return mShadowTransform; }
+
+protected:
+  ShadowLayer()
+    : mShadowOpacity(1.0f)
+    , mUseShadowClipRect(false)
+  {}
+
+  nsIntRegion mShadowVisibleRegion;
+  gfx3DMatrix mShadowTransform;
+  nsIntRect mShadowClipRect;
+  float mShadowOpacity;
+  bool mUseShadowClipRect;
+};
+
+
+class ShadowThebesLayer : public ShadowLayer,
+                          public ThebesLayer
+{
+public:
+  virtual void InvalidateRegion(const nsIntRegion& aRegion)
+  {
+    NS_RUNTIMEABORT("ShadowThebesLayers can't fill invalidated regions");
+  }
+
+  /**
+   * CONSTRUCTION PHASE ONLY
+   */
+  virtual void SetValidRegion(const nsIntRegion& aRegion)
+  {
+    MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
+    mValidRegion = aRegion;
+    Mutated();
+  }
+
+  const nsIntRegion& GetValidRegion() { return mValidRegion; }
+
+  virtual void
+  Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
+       OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
+       OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion) {
+    NS_RUNTIMEABORT("should not use layer swap");
+  };
+
+  virtual ShadowLayer* AsShadowLayer() { return this; }
+
+  MOZ_LAYER_DECL_NAME("ShadowThebesLayer", TYPE_SHADOW)
+
+protected:
+  ShadowThebesLayer(LayerManager* aManager, void* aImplData)
+    : ThebesLayer(aManager, aImplData)
+  {}
+};
+
+
+class ShadowContainerLayer : public ShadowLayer,
+                             public ContainerLayer
+{
+public:
+  virtual ShadowLayer* AsShadowLayer() { return this; }
+
+  MOZ_LAYER_DECL_NAME("ShadowContainerLayer", TYPE_SHADOW)
+
+protected:
+  ShadowContainerLayer(LayerManager* aManager, void* aImplData)
+    : ContainerLayer(aManager, aImplData)
+  {}
+};
+
+
+class ShadowCanvasLayer : public ShadowLayer,
+                          public CanvasLayer
+{
+public:
+  /**
+   * CONSTRUCTION PHASE ONLY
+   *
+   * Publish the remote layer's back surface to this shadow, swapping
+   * out the old front surface (the new back surface for the remote
+   * layer).
+   */
+  virtual void Swap(const SurfaceDescriptor& aNewFront, bool needYFlip,
+                    SurfaceDescriptor* aNewBack) = 0;
+
+  virtual ShadowLayer* AsShadowLayer() { return this; }
+
+  void SetBounds(nsIntRect aBounds) { mBounds = aBounds; }
+
+  MOZ_LAYER_DECL_NAME("ShadowCanvasLayer", TYPE_SHADOW)
+
+protected:
+  ShadowCanvasLayer(LayerManager* aManager, void* aImplData)
+    : CanvasLayer(aManager, aImplData)
+  {}
+};
+
+
+class ShadowImageLayer : public ShadowLayer,
+                         public ImageLayer
+{
+public:
+  /**
+   * CONSTRUCTION PHASE ONLY
+   * @see ShadowCanvasLayer::Swap
+   */
+  virtual ShadowLayer* AsShadowLayer() { return this; }
+
+  MOZ_LAYER_DECL_NAME("ShadowImageLayer", TYPE_SHADOW)
+
+protected:
+  ShadowImageLayer(LayerManager* aManager, void* aImplData)
+    : ImageLayer(aManager, aImplData)
+  {}
+};
+
+
+class ShadowColorLayer : public ShadowLayer,
+                         public ColorLayer
+{
+public:
+  virtual ShadowLayer* AsShadowLayer() { return this; }
+
+  MOZ_LAYER_DECL_NAME("ShadowColorLayer", TYPE_SHADOW)
+
+protected:
+  ShadowColorLayer(LayerManager* aManager, void* aImplData)
+    : ColorLayer(aManager, aImplData)
+  {}
+};
+
+class ShadowRefLayer : public ShadowLayer,
+                       public RefLayer
+{
+public:
+  virtual ShadowLayer* AsShadowLayer() { return this; }
+
+  MOZ_LAYER_DECL_NAME("ShadowRefLayer", TYPE_SHADOW)
+
+protected:
+  ShadowRefLayer(LayerManager* aManager, void* aImplData)
+    : RefLayer(aManager, aImplData)
+  {}
+};
+
 } // namespace layers
 } // namespace mozilla
 
 #endif // ifndef mozilla_layers_ShadowLayers_h
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -9,16 +9,17 @@ MODULE = 'thebes'
 EXPORTS += [
     'BasicCanvasLayer.h',
     'BasicImplData.h',
     'BasicLayers.h',
     'BasicLayersImpl.h',
     'BasicTiledThebesLayer.h',
     'BasicThebesLayer.h',
     'CompositableHost.h',
+    'LayerManagerComposite.h',
     'Composer2D.h',
     'GonkIOSurfaceImage.h',
     'FrameMetrics.h',
     'CompositorChild.h',
     'CompositorParent.h',
     'ImageContainer.h',
     'ImageLayers.h',
     'ImageLayerOGL.h',
@@ -56,56 +57,50 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
 EXPORTS.gfxipc += [
     'ShadowLayerUtils.h',
 ]
 
 EXPORTS.mozilla.layers += [
     'AsyncPanZoomController.h',
     'Axis.h',
     'CanvasClient.h',
-    'CanvasLayerComposite.h',
-    'ColorLayerComposite.h',
     'CompositableClient.h',
     'CompositableTransactionParent.h',
     'Compositor.h',
     'CompositorOGL.h',
     'CompositorTypes.h',
-    'ContainerLayerComposite.h',
     'ContentHost.h',
     'CompositingRenderTargetOGL.h',
     'CompositorCocoaWidgetHelper.h',
     'CompositorChild.h',
     'CompositorParent.h',
     'CompositableForwarder.h',
     'ContentClient.h',
     'Effects.h',
     'GeckoContentController.h',
     'GestureEventListener.h',
     'ImageBridgeChild.h',
     'ImageBridgeParent.h',
     'ImageClient.h',
-    'ImageLayerComposite.h',
     'ImageHost.h',
     'ISurfaceAllocator.h',
-    'LayerManagerComposite.h',
     'LayersTypes.h',
+    'ShadowLayers.h',
     'LayerTransactionChild.h',
     'LayerTransactionParent.h',
-    'ShadowLayers.h',
     'ShadowLayersManager.h',
     'RenderTrace.h',
     'SharedRGBImage.h',
     'SharedPlanarYCbCrImage.h',
     'ShmemYCbCrImage.h',
     'TaskThrottler.h',
     'TextureClient.h',
     'TextureHost.h',
     'TextureClientOGL.h',
     'TextureHostOGL.h',
-    'ThebesLayerComposite.h',
     'TiledContentClient.h',
 ]
 
 if CONFIG['MOZ_X11']:
     EXPORTS.mozilla.layers += [
         'ShadowLayerUtilsX11.h'
     ]
 
--- a/gfx/layers/opengl/GLManager.cpp
+++ b/gfx/layers/opengl/GLManager.cpp
@@ -1,12 +1,12 @@
 #include "GLManager.h"
 #include "LayerManagerOGL.h"
 #include "CompositorOGL.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "GLContext.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
 class GLManagerLayerManager : public GLManager
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -27,21 +27,21 @@
 namespace mozilla {
 namespace gl {
 class GLContext;
 }
 namespace layers {
 
 class Composer2D;
 class LayerOGL;
-class ThebesLayerComposite;
-class ContainerLayerComposite;
-class ImageLayerComposite;
-class CanvasLayerComposite;
-class ColorLayerComposite;
+class ShadowThebesLayer;
+class ShadowContainerLayer;
+class ShadowImageLayer;
+class ShadowCanvasLayer;
+class ShadowColorLayer;
 struct FPSState;
 
 /**
  * This is the LayerManager used for OpenGL 2.1 and OpenGL ES 2.0.
  * This should be used only on the main thread.
  */
 class THEBES_API LayerManagerOGL : public LayerManager
 {
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -249,17 +249,17 @@ BuildListForLayer(Layer* aLayer,
 // Go down shadow layer tree and apply transformations for scrollable layers.
 static void
 TransformShadowTree(nsDisplayListBuilder* aBuilder, nsFrameLoader* aFrameLoader,
                     nsIFrame* aFrame, Layer* aLayer,
                     const ViewTransform& aTransform,
                     float aTempScaleDiffX = 1.0,
                     float aTempScaleDiffY = 1.0)
 {
-  LayerComposite* shadow = aLayer->AsLayerComposite();
+  ShadowLayer* shadow = aLayer->AsShadowLayer();
   shadow->SetShadowClipRect(aLayer->GetClipRect());
   shadow->SetShadowVisibleRegion(aLayer->GetVisibleRegion());
   shadow->SetShadowOpacity(aLayer->GetOpacity());
 
   const FrameMetrics* metrics = GetFrameMetrics(aLayer);
 
   gfx3DMatrix shadowTransform = aLayer->GetTransform();
   ViewTransform layerTransform = aTransform;
@@ -430,17 +430,17 @@ BuildViewMap(ViewMap& oldContentViews, V
 static void
 BuildBackgroundPatternFor(ContainerLayer* aContainer,
                           ContainerLayer* aShadowRoot,
                           const ViewConfig& aConfig,
                           const gfxRGBA& aColor,
                           LayerManager* aManager,
                           nsIFrame* aFrame)
 {
-  LayerComposite* shadowRoot = aShadowRoot->AsLayerComposite();
+  ShadowLayer* shadowRoot = aShadowRoot->AsShadowLayer();
   gfxMatrix t;
   if (!shadowRoot->GetShadowTransform().Is2D(&t)) {
     return;
   }
 
   // Get the rect bounding the shadow content, transformed into the
   // same space as |aFrame|
   nsIntRect contentBounds = shadowRoot->GetShadowVisibleRegion().GetBounds();
@@ -598,17 +598,17 @@ RenderFrameParent::RenderFrameParent(nsF
 {
   mContentViews[FrameMetrics::ROOT_SCROLL_ID] =
     new nsContentView(aFrameLoader, FrameMetrics::ROOT_SCROLL_ID);
 
   *aId = 0;
 
   nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);
   // Perhaps the document containing this frame currently has no presentation?
-  if (lm && lm->AsLayerManagerComposite()) {
+  if (lm && lm->AsShadowManager()) {
     *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
   } else {
     *aTextureFactoryIdentifier = TextureFactoryIdentifier();
   }
 
   if (CompositorParent::CompositorLoop()) {
     // Our remote frame will push layers updates to the compositor,
     // and we'll keep an indirect reference to that tree.
@@ -848,17 +848,17 @@ RenderFrameParent::RecvDetectScrollableS
 
 PLayerTransactionParent*
 RenderFrameParent::AllocPLayerTransaction()
 {
   if (!mFrameLoader || mFrameLoaderDestroyed) {
     return nullptr;
   }
   nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);
-  return new LayerTransactionParent(lm->AsLayerManagerComposite(), this, 0);
+  return new LayerTransactionParent(lm->AsShadowManager(), this, 0);
 }
 
 bool
 RenderFrameParent::DeallocPLayerTransaction(PLayerTransactionParent* aLayers)
 {
   delete aLayers;
   return true;
 }
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -34,17 +34,17 @@ using mozilla::unused;
 #include "nsGfxCIID.h"
 
 #include "gfxImageSurface.h"
 #include "gfxContext.h"
 
 #include "Layers.h"
 #include "BasicLayers.h"
 #include "LayerManagerOGL.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "GLContext.h"
 #include "GLContextProvider.h"
 
 #include "nsTArray.h"
 
 #include "AndroidBridge.h"
 #include "android_npapi.h"
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -46,17 +46,17 @@
 #include "ComplexTextInputPanel.h"
 #endif
 
 #include "gfxContext.h"
 #include "gfxQuartzSurface.h"
 #include "nsRegion.h"
 #include "Layers.h"
 #include "LayerManagerOGL.h"
-#include "mozilla/layers/LayerManagerComposite.h"
+#include "LayerManagerComposite.h"
 #include "GLTextureImage.h"
 #include "mozilla/layers/GLManager.h"
 #include "mozilla/layers/CompositorCocoaWidgetHelper.h"
 #include "mozilla/layers/CompositorOGL.h"
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #include "mozilla/a11y/Platform.h"
 #endif
@@ -2837,17 +2837,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
       setupLayerManager(mGeckoChild, targetContext, BUFFER_NONE);
     painted = mGeckoChild->PaintWindow(region, aIsAlternate);
   }
 
   // Force OpenGL to refresh the very first time we draw. This works around a
   // Mac OS X bug that stops windows updating on OS X when we use OpenGL.
   LayerManager *layerManager = mGeckoChild->GetLayerManager(nullptr);
   if (mUsingOMTCompositor && painted && !mDidForceRefreshOpenGL &&
-      layerManager->AsLayerManagerComposite()) {
+      layerManager->AsShadowManager()) {
     if (!mDidForceRefreshOpenGL) {
       [self performSelector:@selector(forceRefreshOpenGL) withObject:nil afterDelay:0];
       mDidForceRefreshOpenGL = YES;
     }
   }
 
   if (!painted && [self isOpaque]) {
     // Gecko refused to draw, but we've claimed to be opaque, so we have to