Back out bug 648484
authorChris Jones <jones.chris.g@gmail.com>
Fri, 15 Jul 2011 11:35:55 -0700
changeset 72874 36828a0ab01090ec93801f374df18f2bc37252aa
parent 72815 a0ea3fd86f200e0c621b568d71f91ed4dc8acf5f
child 72875 d3f9f34116128fd9bc6356672945e74ebc7cc620
push idunknown
push userunknown
push dateunknown
bugs648484
milestone8.0a1
Back out bug 648484
dom/ipc/ContentParent.cpp
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/Makefile.in
gfx/layers/basic/BasicLayers.cpp
gfx/layers/basic/BasicLayers.h
gfx/layers/d3d10/CanvasLayerD3D10.cpp
gfx/layers/d3d10/ColorLayerD3D10.cpp
gfx/layers/d3d10/ColorLayerD3D10.h
gfx/layers/d3d10/ContainerLayerD3D10.cpp
gfx/layers/d3d10/ContainerLayerD3D10.h
gfx/layers/d3d10/LayerManagerD3D10.cpp
gfx/layers/d3d10/LayerManagerD3D10.h
gfx/layers/d3d10/ThebesLayerD3D10.cpp
gfx/layers/d3d10/ThebesLayerD3D10.h
gfx/layers/d3d9/LayerManagerD3D9.h
gfx/layers/ipc/PLayers.ipdl
gfx/layers/ipc/ShadowLayerUtils.h
gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
gfx/layers/ipc/ShadowLayerUtilsD3D10.h
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/opengl/LayerManagerOGL.h
gfx/thebes/gfxWindowsPlatform.cpp
ipc/glue/IPCMessageUtils.h
layout/ipc/PRenderFrame.ipdl
layout/ipc/RenderFrameChild.cpp
layout/ipc/RenderFrameChild.h
layout/ipc/RenderFrameParent.cpp
layout/ipc/RenderFrameParent.h
layout/ipc/test-ipcbrowser-chrome.js
widget/public/nsIWidget.h
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindow.h
widget/src/xpwidgets/Makefile.in
widget/src/xpwidgets/PuppetWidget.cpp
widget/src/xpwidgets/PuppetWidget.h
widget/src/xpwidgets/nsBaseWidget.cpp
widget/src/xpwidgets/nsBaseWidget.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -507,24 +507,22 @@ ContentParent::RecvGetClipboardText(cons
     NS_ENSURE_SUCCESS(rv, true);
 
     nsCOMPtr<nsITransferable> trans = do_CreateInstance("@mozilla.org/widget/transferable;1", &rv);
     NS_ENSURE_SUCCESS(rv, true);
     
     clipboard->GetData(trans, whichClipboard);
     nsCOMPtr<nsISupports> tmp;
     PRUint32 len;
-    rv = trans->GetTransferData(kUnicodeMime, getter_AddRefs(tmp), &len);
-    if (NS_FAILED(rv))
-        return false;
+    rv  = trans->GetTransferData(kUnicodeMime, getter_AddRefs(tmp), &len);
+    NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsISupportsString> supportsString = do_QueryInterface(tmp);
     // No support for non-text data
-    if (!supportsString)
-        return false;
+    NS_ENSURE_TRUE(supportsString, NS_ERROR_NOT_IMPLEMENTED);
     supportsString->GetData(*text);
     return true;
 }
 
 bool
 ContentParent::RecvEmptyClipboard()
 {
     nsresult rv;
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -455,76 +455,68 @@ TabChild::DestroyWindow()
         mRemoteFrame->Destroy();
         mRemoteFrame = nsnull;
     }
 }
 
 void
 TabChild::ActorDestroy(ActorDestroyReason why)
 {
-  if (mTabChildGlobal) {
-    // The messageManager relays messages via the TabChild which
-    // no longer exists.
-    static_cast<nsFrameMessageManager*>
-      (mTabChildGlobal->mMessageManager.get())->Disconnect();
-    mTabChildGlobal->mMessageManager = nsnull;
-  }
+  // The messageManager relays messages via the TabChild which
+  // no longer exists.
+  static_cast<nsFrameMessageManager*>
+    (mTabChildGlobal->mMessageManager.get())->Disconnect();
+  mTabChildGlobal->mMessageManager = nsnull;
 }
 
 TabChild::~TabChild()
 {
     nsCOMPtr<nsIWebBrowser> webBrowser = do_QueryInterface(mWebNav);
     if (webBrowser) {
       webBrowser->SetContainerWindow(nsnull);
     }
     if (mCx) {
       DestroyCx();
     }
     
-    if (mTabChildGlobal) {
-      nsEventListenerManager* elm = mTabChildGlobal->GetListenerManager(PR_FALSE);
-      if (elm) {
-        elm->Disconnect();
-      }
-      mTabChildGlobal->mTabChild = nsnull;
+    nsEventListenerManager* elm = mTabChildGlobal->GetListenerManager(PR_FALSE);
+    if (elm) {
+      elm->Disconnect();
     }
+    mTabChildGlobal->mTabChild = nsnull;
 }
 
 bool
 TabChild::RecvLoadURL(const nsCString& uri)
 {
     printf("loading %s, %d\n", uri.get(), NS_IsMainThread());
 
     nsresult rv = mWebNav->LoadURI(NS_ConvertUTF8toUTF16(uri).get(),
                                    nsIWebNavigation::LOAD_FLAGS_NONE,
                                    NULL, NULL, NULL);
     if (NS_FAILED(rv)) {
         NS_WARNING("mWebNav->LoadURI failed. Eating exception, what else can I do?");
     }
 
-    return true;
+    return NS_SUCCEEDED(rv);
 }
 
 bool
 TabChild::RecvShow(const nsIntSize& size)
 {
     printf("[TabChild] SHOW (w,h)= (%d, %d)\n", size.width, size.height);
 
     nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
     if (!baseWindow) {
         NS_ERROR("mWebNav doesn't QI to nsIBaseWindow");
         return false;
     }
 
     if (!InitWidget(size)) {
-        // We can fail to initialize our widget if the <browser
-        // remote> has already been destroyed, and we couldn't hook
-        // into the parent-process's layer system.  That's not a fatal
-        // error.
-        return true;
+        return false;
     }
 
     baseWindow->InitWindow(0, mWidget,
                            0, 0, size.width, size.height);
     baseWindow->Create();
     baseWindow->SetVisibility(PR_TRUE);
 
     // IPC uses a WebBrowser object for which DNS prefetching is turned off
@@ -540,19 +532,16 @@ TabChild::RecvShow(const nsIntSize& size
 
     return InitTabChildGlobal();
 }
 
 bool
 TabChild::RecvMove(const nsIntSize& size)
 {
     printf("[TabChild] RESIZE to (w,h)= (%ud, %ud)\n", size.width, size.height);
-    if (!mRemoteFrame) {
-        return true;
-    }
 
     mWidget->Resize(0, 0, size.width, size.height,
                     PR_TRUE);
 
     nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(mWebNav);
     baseWin->SetPositionAndSize(0, 0, size.width, size.height,
                                 PR_TRUE);
     return true;
@@ -781,19 +770,17 @@ TabChild::DeallocPOfflineCacheUpdate(POf
   delete offlineCacheUpdate;
   return true;
 }
 
 bool
 TabChild::RecvLoadRemoteScript(const nsString& aURL)
 {
   if (!mCx && !InitTabChildGlobal())
-    // This can happen if we're half-destroyed.  It's not a fatal
-    // error.
-    return true;
+    return false;
 
   LoadFrameScriptInternal(aURL);
   return true;
 }
 
 bool
 TabChild::RecvAsyncMessage(const nsString& aMessage,
                            const nsString& aJSON)
@@ -833,22 +820,20 @@ public:
 
   nsRefPtr<TabChild> mTabChild;
   TabChildGlobal* mTabChildGlobal;
 };
 
 bool
 TabChild::RecvDestroy()
 {
-  if (mTabChildGlobal) {
-    // Let the frame scripts know the child is being closed
-    nsContentUtils::AddScriptRunner(
-      new UnloadScriptEvent(this, mTabChildGlobal)
-    );
-  }
+  // Let the frame scripts know the child is being closed
+  nsContentUtils::AddScriptRunner(
+    new UnloadScriptEvent(this, mTabChildGlobal)
+  );
 
   // XXX what other code in ~TabChild() should we be running here?
   DestroyWindow();
 
   return Send__delete__(this);
 }
 
 PRenderFrameChild*
@@ -956,30 +941,32 @@ TabChild::InitWidget(const nsIntSize& si
         static_cast<RenderFrameChild*>(SendPRenderFrameConstructor());
     if (!remoteFrame) {
       NS_WARNING("failed to construct RenderFrame");
       return false;
     }
 
     NS_ABORT_IF_FALSE(0 == remoteFrame->ManagedPLayersChild().Length(),
                       "shouldn't have a shadow manager yet");
-    LayerManager::LayersBackend be;
-    PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor(&be);
+    PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor();
     if (!shadowManager) {
       NS_WARNING("failed to construct LayersChild");
       // This results in |remoteFrame| being deleted.
       PRenderFrameChild::Send__delete__(remoteFrame);
       return false;
     }
 
-    ShadowLayerForwarder* lf =
-        mWidget->GetLayerManager(shadowManager, be)->AsShadowForwarder();
-    NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(),
-                      "PuppetWidget should have shadow manager");
-    lf->SetParentBackendType(be);
+    LayerManager* lm = mWidget->GetLayerManager();
+    NS_ABORT_IF_FALSE(LayerManager::LAYERS_BASIC == lm->GetBackendType(),
+                      "content processes should only be using BasicLayers");
+
+    BasicShadowLayerManager* bslm = static_cast<BasicShadowLayerManager*>(lm);
+    NS_ABORT_IF_FALSE(!bslm->HasShadowManager(),
+                      "PuppetWidget shouldn't have shadow manager yet");
+    bslm->SetShadowManager(shadowManager);
 
     mRemoteFrame = remoteFrame;
     return true;
 }
 
 static bool
 SendSyncMessageToParent(void* aCallbackData,
                         const nsAString& aMessage,
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -739,17 +739,18 @@ TabParent::HandleDelayedDialogs()
                                          PR_TRUE, PR_TRUE);
   }
 }
 
 PRenderFrameParent*
 TabParent::AllocPRenderFrame()
 {
   nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
-  return new RenderFrameParent(frameLoader);
+  NS_WARN_IF_FALSE(frameLoader, "'message sent to unknown actor ID' coming up");
+  return frameLoader ? new RenderFrameParent(frameLoader) : nsnull;
 }
 
 bool
 TabParent::DeallocPRenderFrame(PRenderFrameParent* aFrame)
 {
   delete aFrame;
   return true;
 }
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -33,17 +33,16 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "mozilla/layers/PLayers.h"
 #include "mozilla/layers/ShadowLayers.h"
 
 #include "ImageLayers.h"
 #include "Layers.h"
 #include "gfxPlatform.h"
 #include "ReadbackLayer.h"
 #include "gfxUtils.h"
 #include "mozilla/Util.h"
@@ -385,22 +384,16 @@ Layer::GetEffectiveOpacity()
   float opacity = GetOpacity();
   for (ContainerLayer* c = GetParent(); c && !c->UseIntermediateSurface();
        c = c->GetParent()) {
     opacity *= c->GetOpacity();
   }
   return opacity;
 }
 
-void
-ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
-{
-  aAttrs = ContainerLayerAttributes(GetFrameMetrics());
-}
-
 PRBool
 ContainerLayer::HasMultipleChildren()
 {
   PRUint32 count = 0;
   for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
     const nsIntRect *clipRect = child->GetEffectiveClipRect();
     if (clipRect && clipRect->IsEmpty())
       continue;
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -74,21 +74,19 @@ namespace layers {
 
 class Layer;
 class ThebesLayer;
 class ContainerLayer;
 class ImageLayer;
 class ColorLayer;
 class ImageContainer;
 class CanvasLayer;
+class ShadowLayer;
 class ReadbackLayer;
 class ReadbackProcessor;
-class ShadowLayer;
-class ShadowLayerForwarder;
-class ShadowLayerManager;
 class SpecificLayerAttributes;
 
 /**
  * The viewport and displayport metrics for the painted frame at the
  * time of a layer-tree transaction.  These metrics are especially
  * useful for shadow layers, because the metrics values are updated
  * atomically with new pixels.
  */
@@ -112,20 +110,16 @@ public:
 
   PRBool operator==(const FrameMetrics& aOther) const
   {
     return (mViewport.IsEqualEdges(aOther.mViewport) &&
             mViewportScrollOffset == aOther.mViewportScrollOffset &&
             mDisplayPort.IsEqualEdges(aOther.mDisplayPort) &&
             mScrollId == aOther.mScrollId);
   }
-  PRBool operator!=(const FrameMetrics& aOther) const
-  { 
-    return !operator==(aOther);
-  }
 
   PRBool IsDefault() const
   {
     return (FrameMetrics() == *this);
   }
 
   PRBool IsRootScrollable() const
   {
@@ -284,22 +278,16 @@ public:
    * Release layers and resources held by this layer manager, and mark
    * it as destroyed.  Should do any cleanup necessary in preparation
    * for its widget going away.  After this call, only user data calls
    * are valid on the layer manager.
    */
   virtual void Destroy() { mDestroyed = PR_TRUE; mUserData.Clear(); }
   PRBool IsDestroyed() { return mDestroyed; }
 
-  virtual ShadowLayerForwarder* AsShadowForwarder()
-  { return nsnull; }
-
-  virtual ShadowLayerManager* AsShadowManager()
-  { return nsnull; }
-
   /**
    * Start a new transaction. Nested transactions are not allowed so
    * there must be no transaction currently in progress.
    * This transaction will update the state of the window from which
    * this LayerManager was obtained.
    */
   virtual void BeginTransaction() = 0;
   /**
@@ -1078,21 +1066,18 @@ public:
   /**
    * CONSTRUCTION PHASE ONLY
    * Set the (sub)document metrics used to render the Layer subtree
    * rooted at this.
    */
   void SetFrameMetrics(const FrameMetrics& aFrameMetrics)
   {
     mFrameMetrics = aFrameMetrics;
-    Mutated();
   }
 
-  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
-
   // These getters can be used anytime.
 
   virtual ContainerLayer* AsContainerLayer() { return this; }
 
   virtual Layer* GetFirstChild() { return mFirstChild; }
   virtual Layer* GetLastChild() { return mLastChild; }
   const FrameMetrics& GetFrameMetrics() { return mFrameMetrics; }
 
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -109,24 +109,23 @@ CPPSRCS += \
 endif
 ifdef MOZ_ENABLE_D3D10_LAYER
 EXPORTS += \
         LayerManagerD3D10.h \
         ReadbackManagerD3D10.h \
         $(NULL)
 
 CPPSRCS += \
-        CanvasLayerD3D10.cpp \
-        ColorLayerD3D10.cpp \
+        LayerManagerD3D10.cpp \
+        ThebesLayerD3D10.cpp \
         ContainerLayerD3D10.cpp \
         ImageLayerD3D10.cpp \
-        LayerManagerD3D10.cpp \
+        ColorLayerD3D10.cpp \
+        CanvasLayerD3D10.cpp \
         ReadbackManagerD3D10.cpp \
-	ShadowLayerUtilsD3D10.cpp \
-        ThebesLayerD3D10.cpp \
         $(NULL)
 endif
 endif
 
 EXPORTS_NAMESPACES = IPC mozilla/layers
 EXPORTS_IPC = ShadowLayerUtils.h
 EXPORTS_mozilla/layers =\
         ShadowLayers.h \
@@ -149,21 +148,16 @@ endif #}
 
 # Enable GLES2.0 under maemo
 ifdef MOZ_X11
 ifdef MOZ_PLATFORM_MAEMO
 DEFINES += -DUSE_GLES2
 endif
 endif
 
-ifdef MOZ_ENABLE_D3D10_LAYER
-EXPORTS_mozilla/layers += ShadowLayerUtilsD3D10.h
-DEFINES	+= -DMOZ_ENABLE_D3D10_LAYER
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 
 CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
 
 LayerManagerOGLShaders.h: LayerManagerOGLShaders.txt genshaders.py $(GLOBAL_DEPS)
 	$(PYTHON) $(srcdir)/opengl/genshaders.py $< $@
--- a/gfx/layers/basic/BasicLayers.cpp
+++ b/gfx/layers/basic/BasicLayers.cpp
@@ -1866,16 +1866,21 @@ public:
   virtual ~BasicShadowableContainerLayer()
   {
     MOZ_COUNT_DTOR(BasicShadowableContainerLayer);
   }
 
   virtual void InsertAfter(Layer* aChild, Layer* aAfter);
   virtual void RemoveChild(Layer* aChild);
 
+  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
+  {
+    aAttrs = ContainerLayerAttributes(GetFrameMetrics());
+  }
+
   virtual Layer* AsLayer() { return this; }
   virtual ShadowableLayer* AsShadowableLayer() { return this; }
 
   virtual void Disconnect()
   {
     BasicShadowableLayer::Disconnect();
   }
 
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -219,25 +219,16 @@ class BasicShadowLayerManager : public B
                                 public ShadowLayerForwarder
 {
   typedef nsTArray<nsRefPtr<Layer> > LayerRefArray;
 
 public:
   BasicShadowLayerManager(nsIWidget* aWidget);
   virtual ~BasicShadowLayerManager();
 
-  virtual ShadowLayerForwarder* AsShadowForwarder()
-  {
-    return this;
-  }
-  virtual ShadowLayerManager* AsShadowManager()
-  {
-    return this;
-  }
-
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
   virtual bool EndEmptyTransaction();
   virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData);
 
   virtual void SetRoot(Layer* aLayer);
 
   virtual void Mutated(Layer* aLayer);
@@ -251,16 +242,22 @@ public:
   virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer();
   virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer();
   virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer();
   virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer();
 
   ShadowableLayer* Hold(Layer* aLayer);
 
   bool HasShadowManager() const { return ShadowLayerForwarder::HasShadowManager(); }
+  PLayersChild* GetShadowManager() const { return mShadowManager; }
+
+  void SetShadowManager(PLayersChild* aShadowManager)
+  {
+    mShadowManager = aShadowManager;
+  }
 
   virtual PRBool IsCompositingCheap();
   virtual bool HasShadowManagerInternal() const { return HasShadowManager(); }
 
 private:
   /**
    * Forward transaction results to the parent context.
    */
--- a/gfx/layers/d3d10/CanvasLayerD3D10.cpp
+++ b/gfx/layers/d3d10/CanvasLayerD3D10.cpp
@@ -33,17 +33,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "CanvasLayerD3D10.h"
 
-#include "../d3d9/Nv3DVUtils.h"
 #include "gfxImageSurface.h"
 #include "gfxWindowsSurface.h"
 #include "gfxWindowsPlatform.h"
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
--- a/gfx/layers/d3d10/ColorLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ColorLayerD3D10.cpp
@@ -33,18 +33,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "ColorLayerD3D10.h"
 
-#include "../d3d9/Nv3DVUtils.h"
-
 namespace mozilla {
 namespace layers {
 
 ColorLayerD3D10::ColorLayerD3D10(LayerManagerD3D10 *aManager)
   : ColorLayer(aManager, NULL)
   , LayerD3D10(aManager)
 {
   mImplData = static_cast<LayerD3D10*>(this);
--- a/gfx/layers/d3d10/ColorLayerD3D10.h
+++ b/gfx/layers/d3d10/ColorLayerD3D10.h
@@ -33,16 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_COLORLAYERD3D10_H
 #define GFX_COLORLAYERD3D10_H
 
+#include "Layers.h"
 #include "LayerManagerD3D10.h"
 
 namespace mozilla {
 namespace layers {
 
 class ColorLayerD3D10 : public ColorLayer,
                         public LayerD3D10
 {
--- a/gfx/layers/d3d10/ContainerLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ContainerLayerD3D10.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -35,17 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "ContainerLayerD3D10.h"
 #include "nsAlgorithm.h"
 #include "gfxUtils.h"
 #include "nsRect.h"
 
-#include "../d3d9/Nv3DVUtils.h"
 #include "ThebesLayerD3D10.h"
 #include "ReadbackProcessor.h"
 
 namespace mozilla {
 namespace layers {
 
 ContainerLayerD3D10::ContainerLayerD3D10(LayerManagerD3D10 *aManager)
   : ContainerLayer(aManager, NULL)
@@ -370,60 +369,10 @@ ContainerLayerD3D10::Validate()
       static_cast<ThebesLayerD3D10*>(layer)->Validate(&readback);
     } else {
       static_cast<LayerD3D10*>(layer->ImplData())->Validate();
     }
     layer = layer->GetNextSibling();
   }
 }
 
-ShadowContainerLayerD3D10::ShadowContainerLayerD3D10(LayerManagerD3D10 *aManager) 
-  : ShadowContainerLayer(aManager, NULL)
-  , LayerD3D10(aManager)
-{
-  mImplData = static_cast<LayerD3D10*>(this);
-}
-
-ShadowContainerLayerD3D10::~ShadowContainerLayerD3D10() {}
-
-void
-ShadowContainerLayerD3D10::InsertAfter(Layer* aChild, Layer* aAfter)
-{
-  mFirstChild = aChild;
-}
-
-void
-ShadowContainerLayerD3D10::RemoveChild(Layer* aChild)
-{
-
-}
-
-void
-ShadowContainerLayerD3D10::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
-{
-  DefaultComputeEffectiveTransforms(aTransformToSurface);
-}
-
-LayerD3D10*
-ShadowContainerLayerD3D10::GetFirstChildD3D10()
-{
-  return static_cast<LayerD3D10*>(mFirstChild->ImplData());
-}
-
-void
-ShadowContainerLayerD3D10::RenderLayer()
-{
-  LayerD3D10* layerToRender = GetFirstChildD3D10();
-  layerToRender->RenderLayer();
-}
-
-void
-ShadowContainerLayerD3D10::Validate()
-{
-}
- 
-void
-ShadowContainerLayerD3D10::LayerManagerDestroyed()
-{
-}
-
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/d3d10/ContainerLayerD3D10.h
+++ b/gfx/layers/d3d10/ContainerLayerD3D10.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -33,16 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_CONTAINERLAYERD3D10_H
 #define GFX_CONTAINERLAYERD3D10_H
 
+#include "Layers.h"
 #include "LayerManagerD3D10.h"
 
 namespace mozilla {
 namespace layers {
 
 class ContainerLayerD3D10 : public ContainerLayer,
                             public LayerD3D10
 {
@@ -68,39 +69,12 @@ public:
   virtual void LayerManagerDestroyed();
 
   virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
   {
     DefaultComputeEffectiveTransforms(aTransformToSurface);
   }
 };
 
-// This is a bare-bones implementation of a container layer, only
-// enough to contain a shadow "window texture".  This impl doesn't
-// honor the transform/cliprect/etc. when rendering.
-class ShadowContainerLayerD3D10 : public ShadowContainerLayer,
-                                  public LayerD3D10
-{
-public:
-  ShadowContainerLayerD3D10(LayerManagerD3D10 *aManager);
-  ~ShadowContainerLayerD3D10();
-
-  void InsertAfter(Layer* aChild, Layer* aAfter);
-
-  void RemoveChild(Layer* aChild);
-
-  virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface);
-
-  /* LayerD3D10 implementation */
-  virtual LayerD3D10 *GetFirstChildD3D10();
-  virtual Layer* GetLayer() { return this; }
-  virtual void RenderLayer();
-  virtual void Validate();
-  virtual void LayerManagerDestroyed();
-
-private:
-    
-};
-
 } /* layers */
 } /* mozilla */
 
 #endif /* GFX_CONTAINERLAYERD3D10_H */
--- a/gfx/layers/d3d10/LayerManagerD3D10.cpp
+++ b/gfx/layers/d3d10/LayerManagerD3D10.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -30,39 +30,35 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include <algorithm>
-
 #include "LayerManagerD3D10.h"
 #include "LayerManagerD3D10Effect.h"
 #include "gfxWindowsPlatform.h"
 #include "gfxD2DSurface.h"
 #include "gfxFailure.h"
 #include "cairo-win32.h"
 #include "dxgi.h"
 
 #include "ContainerLayerD3D10.h"
 #include "ThebesLayerD3D10.h"
 #include "ColorLayerD3D10.h"
 #include "CanvasLayerD3D10.h"
 #include "ReadbackLayerD3D10.h"
 #include "ImageLayerD3D10.h"
-#include "mozilla/layers/PLayerChild.h"
 
 #include "../d3d9/Nv3DVUtils.h"
 
 #include "gfxCrashReporterUtils.h"
 
-using namespace std;
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 typedef HRESULT (WINAPI*D3D10CreateEffectFromMemoryFunc)(
     void *pData,
     SIZE_T DataLength,
@@ -226,21 +222,16 @@ LayerManagerD3D10::Initialize()
 
     attachments->mVertexBuffer = mVertexBuffer;
   } else {
     mEffect = attachments->mEffect;
     mVertexBuffer = attachments->mVertexBuffer;
     mInputLayout = attachments->mInputLayout;
   }
 
-  if (HasShadowManager()) {
-    reporter.SetSuccessful();
-    return true;
-  }
-
   nsRefPtr<IDXGIDevice> dxgiDevice;
   nsRefPtr<IDXGIAdapter> dxgiAdapter;
   nsRefPtr<IDXGIFactory> dxgiFactory;
 
   mDevice->QueryInterface(dxgiDevice.StartAssignment());
   dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter));
 
   dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
@@ -291,36 +282,29 @@ LayerManagerD3D10::Initialize()
 
 void
 LayerManagerD3D10::Destroy()
 {
   if (!IsDestroyed()) {
     if (mRoot) {
       static_cast<LayerD3D10*>(mRoot->ImplData())->LayerManagerDestroyed();
     }
-    mRootForShadowTree = nsnull;
-    // XXX need to be careful here about surface destruction
-    // racing with share-to-chrome message
   }
   LayerManager::Destroy();
 }
 
 void
 LayerManagerD3D10::SetRoot(Layer *aRoot)
 {
   mRoot = aRoot;
 }
 
 void
 LayerManagerD3D10::BeginTransaction()
 {
-#ifdef MOZ_LAYERS_HAVE_LOG
-  MOZ_LAYERS_LOG(("[----- BeginTransaction"));
-  Log();
-#endif
 }
 
 void
 LayerManagerD3D10::BeginTransactionWithTarget(gfxContext* aTarget)
 {
   mTarget = aTarget;
 }
 
@@ -341,62 +325,38 @@ LayerManagerD3D10::EndTransaction(DrawTh
   if (mRoot) {
     mCurrentCallbackInfo.Callback = aCallback;
     mCurrentCallbackInfo.CallbackData = aCallbackData;
 
     // The results of our drawing always go directly into a pixel buffer,
     // so we don't need to pass any global transform here.
     mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
 
-#ifdef MOZ_LAYERS_HAVE_LOG
-    MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
-    Log();
-#endif
-
     Render();
     mCurrentCallbackInfo.Callback = nsnull;
     mCurrentCallbackInfo.CallbackData = nsnull;
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
-  Log();
-  MOZ_LAYERS_LOG(("]----- EndTransaction"));
-#endif
-
   mTarget = nsnull;
 }
 
 already_AddRefed<ThebesLayer>
 LayerManagerD3D10::CreateThebesLayer()
 {
   nsRefPtr<ThebesLayer> layer = new ThebesLayerD3D10(this);
   return layer.forget();
 }
- 
-already_AddRefed<ShadowThebesLayer>
-LayerManagerD3D10::CreateShadowThebesLayer()
-{
-  nsRefPtr<ShadowThebesLayerD3D10> layer = new ShadowThebesLayerD3D10(this);
-  return layer.forget();
-}
 
 already_AddRefed<ContainerLayer>
 LayerManagerD3D10::CreateContainerLayer()
 {
   nsRefPtr<ContainerLayer> layer = new ContainerLayerD3D10(this);
   return layer.forget();
 }
 
-already_AddRefed<ShadowContainerLayer>
-LayerManagerD3D10::CreateShadowContainerLayer()
-{
-  nsRefPtr<ShadowContainerLayer> layer = new ShadowContainerLayerD3D10(this);
-  return layer.forget();
-}
-
 already_AddRefed<ImageLayer>
 LayerManagerD3D10::CreateImageLayer()
 {
   nsRefPtr<ImageLayer> layer = new ImageLayerD3D10(this);
   return layer.forget();
 }
 
 already_AddRefed<ColorLayer>
@@ -581,82 +541,49 @@ LayerManagerD3D10::UpdateRenderTarget()
   if (mRTView) {
     return;
   }
 
   HRESULT hr;
 
   nsRefPtr<ID3D10Texture2D> backBuf;
   
-  if (mSwapChain) {
-    hr = mSwapChain->GetBuffer(0, __uuidof(ID3D10Texture2D), (void**)backBuf.StartAssignment());
-    if (FAILED(hr)) {
-      return;
-    }
-  } else {
-    backBuf = mBackBuffer;
+  hr = mSwapChain->GetBuffer(0, __uuidof(ID3D10Texture2D), (void**)backBuf.StartAssignment());
+  if (FAILED(hr)) {
+    return;
   }
   
   mDevice->CreateRenderTargetView(backBuf, NULL, getter_AddRefs(mRTView));
 }
 
 void
 LayerManagerD3D10::VerifyBufferSize()
 {
+  DXGI_SWAP_CHAIN_DESC swapDesc;
+  mSwapChain->GetDesc(&swapDesc);
+
   nsIntRect rect;
   mWidget->GetClientBounds(rect);
 
-  HRESULT hr;
-  if (mSwapChain) {
-    DXGI_SWAP_CHAIN_DESC swapDesc;
-    mSwapChain->GetDesc(&swapDesc);
-
-    if (swapDesc.BufferDesc.Width == rect.width &&
-        swapDesc.BufferDesc.Height == rect.height) {
-      return;
-    }
+  if (swapDesc.BufferDesc.Width == rect.width &&
+      swapDesc.BufferDesc.Height == rect.height) {
+    return;
+  }
 
-    mRTView = nsnull;
-    if (gfxWindowsPlatform::IsOptimus()) {
-      mSwapChain->ResizeBuffers(1, rect.width, rect.height,
-                                DXGI_FORMAT_B8G8R8A8_UNORM,
-                                0);
-    } else {
-      mSwapChain->ResizeBuffers(1, rect.width, rect.height,
-                                DXGI_FORMAT_B8G8R8A8_UNORM,
-                                DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE);
-    }
+  mRTView = nsnull;
+  if (gfxWindowsPlatform::IsOptimus()) {
+    mSwapChain->ResizeBuffers(1, rect.width, rect.height,
+                              DXGI_FORMAT_B8G8R8A8_UNORM,
+                              0);
   } else {
-    D3D10_TEXTURE2D_DESC oldDesc;    
-    if (mBackBuffer) {
-        mBackBuffer->GetDesc(&oldDesc);
-    } else {
-        oldDesc.Width = oldDesc.Height = 0;
-    }
-    if (oldDesc.Width == rect.width &&
-        oldDesc.Height == rect.height) {
-      return;
-    }
+    mSwapChain->ResizeBuffers(1, rect.width, rect.height,
+                              DXGI_FORMAT_B8G8R8A8_UNORM,
+                              DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE);
+  }
 
-    CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM,
-                               rect.width, rect.height, 1, 1);
-    desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
-    desc.MiscFlags = D3D10_RESOURCE_MISC_SHARED
-                     // FIXME/bug 662109: synchronize using KeyedMutex
-                     /*D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX*/;
-    hr = device()->CreateTexture2D(&desc, nsnull, getter_AddRefs(mBackBuffer));
-    if (FAILED(hr)) {
-        ReportFailure(nsDependentCString("Failed to create shared texture"),
-                      hr);
-        NS_RUNTIMEABORT("Failed to create back buffer");
-    }
-
-    // XXX resize texture?
-    mRTView = nsnull;
-  }
 }
 
 void
 LayerManagerD3D10::EnsureReadbackManager()
 {
   if (mReadbackManager) {
     return;
   }
@@ -706,85 +633,16 @@ LayerManagerD3D10::Render()
     r.bottom = rect.height;
   }
   device()->RSSetScissorRects(1, &r);
 
   static_cast<LayerD3D10*>(mRoot->ImplData())->RenderLayer();
 
   if (mTarget) {
     PaintToTarget();
-  } else if (mBackBuffer) {
-    ShadowLayerForwarder::BeginTransaction();
-    
-    nsIntRect contentRect = nsIntRect(0, 0, rect.width, rect.height);
-    if (!mRootForShadowTree) {
-        mRootForShadowTree = new DummyRoot(this);
-        mRootForShadowTree->SetShadow(ConstructShadowFor(mRootForShadowTree));
-        CreatedContainerLayer(mRootForShadowTree);
-        ShadowLayerForwarder::SetRoot(mRootForShadowTree);
-    }
-
-    nsRefPtr<WindowLayer> windowLayer =
-        static_cast<WindowLayer*>(mRootForShadowTree->GetFirstChild());
-    if (!windowLayer) {
-        windowLayer = new WindowLayer(this);
-        windowLayer->SetShadow(ConstructShadowFor(windowLayer));
-        CreatedThebesLayer(windowLayer);
-        ShadowLayerForwarder::CreatedThebesBuffer(windowLayer,
-                                                  contentRect,
-                                                  contentRect,
-                                                  SurfaceDescriptor());
-
-        mRootForShadowTree->InsertAfter(windowLayer, nsnull);
-        ShadowLayerForwarder::InsertAfter(mRootForShadowTree, windowLayer);
-    }
-
-    if (!mRootForShadowTree->GetVisibleRegion().IsEqual(contentRect)) {
-        mRootForShadowTree->SetVisibleRegion(contentRect);
-        windowLayer->SetVisibleRegion(contentRect);
-
-        ShadowLayerForwarder::Mutated(mRootForShadowTree);
-        ShadowLayerForwarder::Mutated(windowLayer);
-    }
-
-    FrameMetrics m;
-    if (ContainerLayer* cl = mRoot->AsContainerLayer()) {
-        m = cl->GetFrameMetrics();
-    } else {
-        m.mScrollId = FrameMetrics::ROOT_SCROLL_ID;
-    }
-    if (m != mRootForShadowTree->GetFrameMetrics()) {
-        mRootForShadowTree->SetFrameMetrics(m);
-        ShadowLayerForwarder::Mutated(mRootForShadowTree);
-    }
-
-    SurfaceDescriptorD3D10 sd;
-    GetDescriptor(mBackBuffer, &sd);
-    ShadowLayerForwarder::PaintedThebesBuffer(windowLayer,
-                                              contentRect,
-                                              contentRect, nsIntPoint(),
-                                              sd);
-
-    // A source in the graphics pipeline can't also be a target.  So
-    // unbind here to avoid racing with the chrome process sourcing
-    // the back texture.
-    mDevice->OMSetRenderTargets(0, NULL, NULL);
-
-    // XXX revisit this Flush() in bug 662109.  It's not clear it's
-    // needed.
-    mDevice->Flush();
-
-    mRTView = NULL;
-
-    AutoInfallibleTArray<EditReply, 10> replies;
-    ShadowLayerForwarder::EndTransaction(&replies);
-    // We expect only 1 reply, but might get none if the parent
-    // process crashed
-
-    swap(mBackBuffer, mRemoteFrontBuffer);
   } else {
     mSwapChain->Present(0, 0);
   }
 }
 
 void
 LayerManagerD3D10::PaintToTarget()
 {
@@ -836,47 +694,10 @@ LayerManagerD3D10::ReportFailure(const n
   gfx::LogFailure(msg);
 }
 
 LayerD3D10::LayerD3D10(LayerManagerD3D10 *aManager)
   : mD3DManager(aManager)
 {
 }
 
-WindowLayer::WindowLayer(LayerManagerD3D10* aManager)
-  : ThebesLayer(aManager, nsnull)
-{
- }
-
-WindowLayer::~WindowLayer()
-{
-  PLayerChild::Send__delete__(GetShadow());
-}
-
-DummyRoot::DummyRoot(LayerManagerD3D10* aManager)
-  : ContainerLayer(aManager, nsnull)
-{
-}
-
-DummyRoot::~DummyRoot()
-{
-  RemoveChild(nsnull);
-  PLayerChild::Send__delete__(GetShadow());
-}
-
-void
-DummyRoot::InsertAfter(Layer* aLayer, Layer* aNull)
-{
-  NS_ABORT_IF_FALSE(!mFirstChild && !aNull,
-                    "Expect to append one child, once");
-  mFirstChild = nsRefPtr<Layer>(aLayer).forget().get();
-}
-
-void
-DummyRoot::RemoveChild(Layer* aNull)
-{
-  NS_ABORT_IF_FALSE(!aNull, "Unused argument should be null");
-  NS_IF_RELEASE(mFirstChild);
-}
-
-
 }
 }
--- a/gfx/layers/d3d10/LayerManagerD3D10.h
+++ b/gfx/layers/d3d10/LayerManagerD3D10.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -33,32 +33,29 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_LAYERMANAGERD3D10_H
 #define GFX_LAYERMANAGERD3D10_H
 
-#include "mozilla/layers/PLayers.h"
-#include "mozilla/layers/ShadowLayers.h"
 #include "Layers.h"
 
 #include <windows.h>
 #include <d3d10_1.h>
 
 #include "gfxContext.h"
 #include "nsIWidget.h"
 
 #include "ReadbackManagerD3D10.h"
 
 namespace mozilla {
 namespace layers {
 
-class DummyRoot;
 class Nv3DVUtils;
 
 /**
  * This structure is used to pass rectangles to our shader constant. We can use
  * this for passing rectangular areas to SetVertexShaderConstant. In the format
  * of a 4 component float(x,y,width,height). Our vertex shader can then use
  * this to construct rectangular positions from the 0,0-1,1 quad that we source
  * it with.
@@ -72,28 +69,21 @@ struct ShaderConstantRectD3D10
 
   // For easy passing to SetVertexShaderConstantF.
   operator float* () { return &mX; }
 };
 
 extern cairo_user_data_key_t gKeyD3D10Texture;
 
 /*
- * This is the LayerManager used for Direct3D 10. For now this will
- * render on the main thread.
- *
- * For the time being, LayerManagerD3D10 both forwards layers
- * transactions and receives forwarded transactions.  In the Azure
- * future, it will only be a ShadowLayerManager.
+ * This is the LayerManager used for Direct3D 9. For now this will render on
+ * the main thread.
  */
-class THEBES_API LayerManagerD3D10 : public ShadowLayerManager,
-                                     public ShadowLayerForwarder {
+class THEBES_API LayerManagerD3D10 : public LayerManager {
 public:
-  typedef LayerManager::LayersBackend LayersBackend;
-
   LayerManagerD3D10(nsIWidget *aWidget);
   virtual ~LayerManagerD3D10();
 
   /*
    * Initializes the layer manager, this is when the layer manager will
    * actually access the device and attempt to create the swap chain used
    * to draw to the window. If this method fails the device cannot be used.
    * This function is not threadsafe.
@@ -102,22 +92,16 @@ public:
    */
   bool Initialize();
 
   /*
    * LayerManager implementation.
    */
   virtual void Destroy();
 
-  virtual ShadowLayerForwarder* AsShadowForwarder()
-  { return this; }
-
-  virtual ShadowLayerManager* AsShadowManager()
-  { return this; }
-
   virtual void SetRoot(Layer *aLayer);
 
   virtual void BeginTransaction();
 
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
 
   virtual bool EndEmptyTransaction();
 
@@ -136,32 +120,24 @@ public:
     MAX_TEXTURE_SIZE = 8192
   };
   virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize)
   {
     return aSize <= gfxIntSize(MAX_TEXTURE_SIZE, MAX_TEXTURE_SIZE);
   }
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
-  virtual already_AddRefed<ShadowThebesLayer> CreateShadowThebesLayer();
 
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
-  virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer();
 
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
-  virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer()
-  { return nsnull; }
 
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
-  virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer()
-  { return nsnull; }
 
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
-  virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer()
-  { return nsnull; }
 
   virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
 
   virtual already_AddRefed<ImageContainer> CreateImageContainer();
 
   virtual already_AddRefed<gfxASurface>
     CreateOptimalSurface(const gfxIntSize &aSize,
                          gfxASurface::gfxImageFormat imageFormat);
@@ -224,38 +200,16 @@ private:
   nsAutoPtr<Nv3DVUtils> mNv3DVUtils; 
 
   /*
    * Context target, NULL when drawing directly to our swap chain.
    */
   nsRefPtr<gfxContext> mTarget;
 
   /*
-   * We use a double-buffered "window surface" to display our content
-   * in the compositor process, if we're remote.  The textures act
-   * like the backing store for an OS window --- we render the layer
-   * tree into the back texture and send it to the compositor, then
-   * swap back/front textures.  This means, obviously, that we've lost
-   * all layer tree information after rendering.
-   *
-   * The remote front buffer is the texture currently being displayed
-   * by chrome.  We keep a reference to it to simplify resource
-   * management; if we didn't, then there can be periods during IPC
-   * transport when neither process holds a "real" ref.  That's
-   * solvable but not worth the complexity.
-   */
-  nsRefPtr<ID3D10Texture2D> mBackBuffer;
-  nsRefPtr<ID3D10Texture2D> mRemoteFrontBuffer;
-  /*
-   * If we're remote content, this is the root of the shadowable tree
-   * we send to the compositor.
-   */
-  nsRefPtr<DummyRoot> mRootForShadowTree;
-
-  /*
    * Copies the content of our backbuffer to the set transaction target.
    */
   void PaintToTarget();
 };
 
 /*
  * General information and tree management for OGL layers.
  */
@@ -297,50 +251,12 @@ public:
     effect()->GetVariableByName("mLayerTransform")->SetRawValue(raw, 0, 64);
     effect()->GetVariableByName("fLayerOpacity")->AsScalar()->SetFloat(layer->GetEffectiveOpacity());
   }
 
 protected:
   LayerManagerD3D10 *mD3DManager;
 };
 
-/**
- * WindowLayer is a simple, special kinds of shadowable layer into
- * which layer trees are rendered.  It represents something like an OS
- * window.  It exists only to allow sharing textures with the
- * compositor while reusing existing shadow-layer machinery.
- *
- * WindowLayer being implemented as a thebes layer isn't an important
- * detail; other layer types could have been used.
- */
-class WindowLayer : public ThebesLayer, public ShadowableLayer {
-public:
-  WindowLayer(LayerManagerD3D10* aManager);
-  virtual ~WindowLayer();
-
-  void InvalidateRegion(const nsIntRegion&) {}
-  Layer* AsLayer() { return this; }
-
-  void SetShadow(PLayerChild* aChild) { mShadow = aChild; }
-};
-
-/**
- * DummyRoot is the root of the shadowable layer tree created by
- * remote content.  It exists only to contain WindowLayers.  It always
- * has exactly one child WindowLayer.
- */
-class DummyRoot : public ContainerLayer, public ShadowableLayer {
-public:
-  DummyRoot(LayerManagerD3D10* aManager);
-  virtual ~DummyRoot();
-
-  void ComputeEffectiveTransforms(const gfx3DMatrix&) {}
-  void InsertAfter(Layer*, Layer*);
-  void RemoveChild(Layer*);
-  Layer* AsLayer() { return this; }
-
-  void SetShadow(PLayerChild* aChild) { mShadow = aChild; }
-};
-
 } /* layers */
 } /* mozilla */
 
 #endif /* GFX_LAYERMANAGERD3D9_H */
--- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ThebesLayerD3D10.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -30,26 +30,24 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "mozilla/layers/PLayers.h"
 #include "ThebesLayerD3D10.h"
 #include "gfxPlatform.h"
 
 #include "gfxWindowsPlatform.h"
 #ifdef CAIRO_HAS_D2D_SURFACE
 #include "gfxD2DSurface.h"
 #endif
 
-#include "../d3d9/Nv3DVUtils.h"
 #include "gfxTeeSurface.h"
 #include "gfxUtils.h"
 #include "ReadbackLayer.h"
 #include "ReadbackProcessor.h"
 
 namespace mozilla {
 namespace layers {
 
@@ -281,17 +279,17 @@ ThebesLayerD3D10::Validate(ReadbackProce
                                  newTextureRect.width, newTextureRect.height,
                                  1, 1, 0, D3D10_USAGE_STAGING,
                                  D3D10_CPU_ACCESS_READ);
 
       nsRefPtr<ID3D10Texture2D> readbackTexture;
       device()->CreateTexture2D(&desc, NULL, getter_AddRefs(readbackTexture));
       device()->CopyResource(readbackTexture, mTexture);
 
-      for (PRUint32 i = 0; i < readbackUpdates.Length(); i++) {
+      for (int i = 0; i < readbackUpdates.Length(); i++) {
         mD3DManager->readbackManager()->PostTask(readbackTexture,
                                                  &readbackUpdates[i],
                                                  gfxPoint(newTextureRect.x, newTextureRect.y));
       }
     }
 
     mValidRegion = neededRegion;
   }
@@ -452,126 +450,11 @@ ThebesLayerD3D10::CreateNewTextures(cons
 
     if (!mD2DSurfaceOnWhite || mD2DSurfaceOnWhite->CairoStatus()) {
       NS_WARNING("Failed to create surface for ThebesLayerD3D10.");
       mD2DSurfaceOnWhite = nsnull;
       return;
     }
   }
 }
- 
-ShadowThebesLayerD3D10::ShadowThebesLayerD3D10(LayerManagerD3D10* aManager)
-  : ShadowThebesLayer(aManager, NULL)
-  , LayerD3D10(aManager)
-{
-  mImplData = static_cast<LayerD3D10*>(this);
-}
-
-ShadowThebesLayerD3D10::~ShadowThebesLayerD3D10()
-{
-}
-
-void
-ShadowThebesLayerD3D10::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
-                                       const nsIntRegion& aValidRegion)
-{
-  NS_ABORT_IF_FALSE(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
-                    "Expected dummy front buffer initially");
-}
-
-void
-ShadowThebesLayerD3D10::Swap(
-  const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
-  ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
-  OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion)
-{
-  nsRefPtr<ID3D10Texture2D> newBackBuffer = mTexture;
-
-  mTexture = OpenForeign(mD3DManager->device(), aNewFront.buffer());
-  NS_ABORT_IF_FALSE(mTexture, "Couldn't open foreign texture");
-
-  // The content process tracks back/front buffers on its own, so
-  // the newBack is in essence unused.
-  aNewBack->buffer() = aNewFront.buffer();
-
-  // The content process doesn't need to read back from the front
-  // buffer (yet).
-  *aReadOnlyFront = null_t();
-
-  // FIXME/bug 662109: synchronize using KeyedMutex
-}
-
-void
-ShadowThebesLayerD3D10::DestroyFrontBuffer()
-{
-}
-
-void
-ShadowThebesLayerD3D10::Disconnect()
-{
-}
-
-void
-ShadowThebesLayerD3D10::RenderLayer()
-{
-  if (!mTexture) {
-    return;
-  }
-
-  // FIXME/bug 662109: synchronize using KeyedMutex
-  
-  nsRefPtr<ID3D10ShaderResourceView> srView;
-  HRESULT hr = device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(srView));
-  if (FAILED(hr)) {
-      NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");
-  }
-
-
-  SetEffectTransformAndOpacity();
-
-  ID3D10EffectTechnique *technique =
-      effect()->GetTechniqueByName("RenderRGBLayerPremul");
-
-  effect()->GetVariableByName("tRGB")->AsShaderResource()->SetResource(srView);
-
-  nsIntRect textureRect = GetVisibleRegion().GetBounds();
-
-  nsIntRegionRectIterator iter(mVisibleRegion);
-  while (const nsIntRect *iterRect = iter.Next()) {
-    effect()->GetVariableByName("vLayerQuad")->AsVector()->SetFloatVector(
-      ShaderConstantRectD3D10(
-        (float)iterRect->x,
-        (float)iterRect->y,
-        (float)iterRect->width,
-        (float)iterRect->height)
-      );
-
-    effect()->GetVariableByName("vTextureCoords")->AsVector()->SetFloatVector(
-      ShaderConstantRectD3D10(
-        (float)(iterRect->x - textureRect.x) / (float)textureRect.width,
-        (float)(iterRect->y - textureRect.y) / (float)textureRect.height,
-        (float)iterRect->width / (float)textureRect.width,
-        (float)iterRect->height / (float)textureRect.height)
-      );
-
-    technique->GetPassByIndex(0)->Apply(0);
-    device()->Draw(4, 0);
-  }
-
-  // FIXME/bug 662109: synchronize using KeyedMutex
-
-  // Set back to default.
-  effect()->GetVariableByName("vTextureCoords")->AsVector()->
-    SetFloatVector(ShaderConstantRectD3D10(0, 0, 1.0f, 1.0f));
-}
-
-void
-ShadowThebesLayerD3D10::Validate()
-{
-}
-
-void
-ShadowThebesLayerD3D10::LayerManagerDestroyed()
-{
-}
 
 } /* namespace layers */
 } /* namespace mozilla */
--- a/gfx/layers/d3d10/ThebesLayerD3D10.h
+++ b/gfx/layers/d3d10/ThebesLayerD3D10.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -33,16 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_THEBESLAYERD3D10_H
 #define GFX_THEBESLAYERD3D10_H
 
+#include "Layers.h"
 #include "LayerManagerD3D10.h"
 
 namespace mozilla {
 namespace layers {
 
 class ThebesLayerD3D10 : public ThebesLayer,
                          public LayerD3D10
 {
@@ -96,40 +97,11 @@ private:
   void CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode);
 
   /* Copy a texture region */
   void CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset,
                   ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset,
                   const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion);
 };
 
-class ShadowThebesLayerD3D10 : public ShadowThebesLayer,
-                               public LayerD3D10
-{
-public:
-  ShadowThebesLayerD3D10(LayerManagerD3D10* aManager);
-  virtual ~ShadowThebesLayerD3D10();
-
-  // ShadowThebesLayer impl
-  virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
-                              const nsIntRegion& aValidRegion);
-  virtual void
-  Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
-       ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
-       OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
-  virtual void DestroyFrontBuffer();
-
-  virtual void Disconnect();
-
-  /* LayerD3D10 implementation */
-  virtual Layer* GetLayer() { return this; }
-  virtual void RenderLayer();
-  virtual void Validate();
-  virtual void LayerManagerDestroyed();
-
-private:
-  /* Texture with our surface data */
-  nsRefPtr<ID3D10Texture2D> mTexture;
-};
-
 } /* layers */
 } /* mozilla */
 #endif /* GFX_THEBESLAYERD3D10_H */
--- a/gfx/layers/d3d9/LayerManagerD3D9.h
+++ b/gfx/layers/d3d9/LayerManagerD3D9.h
@@ -116,19 +116,16 @@ public:
    */
   void SetClippingRegion(const nsIntRegion& aClippingRegion);
 
   /*
    * LayerManager implementation.
    */
   virtual void Destroy();
 
-  virtual ShadowLayerManager* AsShadowManager()
-  { return this; }
-
   virtual void BeginTransaction();
 
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
 
   void EndConstruction();
 
   virtual bool EndEmptyTransaction();
 
--- a/gfx/layers/ipc/PLayers.ipdl
+++ b/gfx/layers/ipc/PLayers.ipdl
@@ -49,17 +49,17 @@ using gfxRGBA;
 using nsIntPoint;
 using nsIntRect;
 using nsIntRegion;
 using nsIntSize;
 using mozilla::GraphicsFilterType;
 using mozilla::layers::FrameMetrics;
 using mozilla::layers::SurfaceDescriptorX11;
 using mozilla::null_t;
-using mozilla::WindowsHandle;
+using mozilla::LayersBackend;
 
 /**
  * The layers protocol is spoken between thread contexts that manage
  * layer (sub)trees.  The protocol comprises atomically publishing
  * layer subtrees to a "shadow" thread context (which grafts the
  * subtree into its own tree), and atomically updating a published
  * subtree.  ("Atomic" in this sense is wrt painting.)
  */
@@ -68,24 +68,23 @@ namespace mozilla {
 namespace layers {
 
 // Create a shadow layer for |layer|
 struct OpCreateThebesLayer     { PLayer layer; };
 struct OpCreateContainerLayer  { PLayer layer; };
 struct OpCreateImageLayer      { PLayer layer; };
 struct OpCreateColorLayer      { PLayer layer; };
 struct OpCreateCanvasLayer     { PLayer layer; };
-
-struct SurfaceDescriptorD3D10 {
-  WindowsHandle handle;
-};
+ 
+// For the "buffer creation" operations, we send an initial front
+// buffer that only contains (transparent) black pixels just so that
+// we can swap it back after the first OpPaint without a special case.
 
 union SurfaceDescriptor {
   Shmem;
-  SurfaceDescriptorD3D10;
   SurfaceDescriptorX11;
 };
 
 struct YUVImage {
   Shmem Ydata;
   Shmem Udata;
   Shmem Vdata;
   nsIntRect picture;
@@ -98,20 +97,16 @@ union SharedImage {
 
 struct ThebesBuffer {
   SurfaceDescriptor buffer;
   nsIntRect rect;
   nsIntPoint rotation; 
 };
 union OptionalThebesBuffer { ThebesBuffer; null_t; };
 
-// For the "buffer creation" operations, we send an initial front
-// buffer that only contains (transparent) black pixels just so that
-// we can swap it back after the first OpPaint without a special case.
-
 struct OpCreateThebesBuffer {
   PLayer layer;
   OptionalThebesBuffer initialFront;
   nsIntRegion frontValidRegion;
 };
 struct OpDestroyThebesFrontBuffer { PLayer layer; };
 
 struct OpCreateCanvasBuffer {
@@ -256,13 +251,16 @@ sync protocol PLayers {
   manages PLayer;
 
 parent:
   async PLayer();
 
   sync Update(Edit[] cset)
     returns (EditReply[] reply);
 
+  sync GetParentType()
+    returns (LayersBackend backend);
+
   async __delete__();
 };
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/ShadowLayerUtils.h
+++ b/gfx/layers/ipc/ShadowLayerUtils.h
@@ -39,22 +39,18 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef IPC_ShadowLayerUtils_h
 #define IPC_ShadowLayerUtils_h
 
 #include "IPC/IPCMessageUtils.h"
 #include "Layers.h"
 
-#if defined(MOZ_ENABLE_D3D10_LAYER)
-# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
-#endif
-
 #if defined(MOZ_X11)
-# include "mozilla/layers/ShadowLayerUtilsX11.h"
+#  include "mozilla/layers/ShadowLayerUtilsX11.h"
 #else
 namespace mozilla { namespace layers {
 struct SurfaceDescriptorX11 {
   bool operator==(const SurfaceDescriptorX11&) const { return false; }
 };
 } }
 #endif
 
deleted file mode 100644
--- a/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at:
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Code.
- *
- * The Initial Developer of the Original Code is
- *   The Mozilla Foundation
- * Portions created by the Initial Developer are Copyrigght (C) 2011
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Chris Jones <jones.chris.g@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <d3d10_1.h>
-#include <dxgi.h>
-
-#include "mozilla/layers/PLayers.h"
-#include "ShadowLayers.h"
-
-namespace mozilla {
-namespace layers {
-
-// Platform-specific shadow-layers interfaces.  See ShadowLayers.h.
-// D3D10 doesn't need all these yet.
-PRBool
-ShadowLayerForwarder::PlatformAllocDoubleBuffer(const gfxIntSize&,
-                                                gfxASurface::gfxContentType,
-                                                SurfaceDescriptor*,
-                                                SurfaceDescriptor*)
-{
-  return PR_FALSE;
-}
-
-PRBool
-ShadowLayerForwarder::PlatformAllocBuffer(const gfxIntSize&,
-                                          gfxASurface::gfxContentType,
-                                          SurfaceDescriptor*)
-{
-  return PR_FALSE;
-}
-
-/*static*/ already_AddRefed<gfxASurface>
-ShadowLayerForwarder::PlatformOpenDescriptor(const SurfaceDescriptor&)
-{
-  return nsnull;
-}
-
-PRBool
-ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*)
-{
-  return PR_FALSE;
-}
-
-/*static*/ void
-ShadowLayerForwarder::PlatformSyncBeforeUpdate()
-{
-}
-
-PRBool
-ShadowLayerManager::PlatformDestroySharedSurface(SurfaceDescriptor*)
-{
-  return PR_FALSE;
-}
-
-/*static*/ void
-ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
-{
-}
-
-bool
-GetDescriptor(ID3D10Texture2D* aTexture, SurfaceDescriptorD3D10* aDescr)
-{
-  NS_ABORT_IF_FALSE(aTexture && aDescr, "Params must be nonnull");
-
-  HRESULT hr;
-  IDXGIResource* dr = nsnull;
-  hr = aTexture->QueryInterface(__uuidof(IDXGIResource), (void**)&dr);
-  if (!SUCCEEDED(hr) || !dr)
-    return false;
-
-  hr = dr->GetSharedHandle(reinterpret_cast<HANDLE*>(&aDescr->handle()));
-  return !!SUCCEEDED(hr);
-}
-
-already_AddRefed<ID3D10Texture2D>
-OpenForeign(ID3D10Device* aDevice, const SurfaceDescriptorD3D10& aDescr)
-{
-  HRESULT hr;
-  ID3D10Texture2D* tex = nsnull;
-  hr = aDevice->OpenSharedResource(reinterpret_cast<HANDLE>(aDescr.handle()),
-                                   __uuidof(ID3D10Texture2D),
-                                   (void**)&tex);
-  if (!SUCCEEDED(hr) || !tex)
-    return nsnull;
-
-  // XXX FIXME TODO do we need this???
-  return nsRefPtr<ID3D10Texture2D>(tex).forget();
-}
-
-} // namespace layers
-} // namespace mozilla
deleted file mode 100644
--- a/gfx/layers/ipc/ShadowLayerUtilsD3D10.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at:
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Code.
- *
- * The Initial Developer of the Original Code is
- *   The Mozilla Foundation
- * Portions created by the Initial Developer are Copyright (C) 2011
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Chris Jones <jones.chris.g@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_layers_ShadowLayerUtilsD3D10_h
-#define mozilla_layers_ShadowLayerUtilsD3D10_h
-
-#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
-
-struct ID3D10Device;
-struct ID3D10Texture2D;
-
-namespace mozilla {
-namespace layers {
-
-class SurfaceDescriptorD3D10;
-
-/**
- * Write into |aDescr| a cross-process descriptor of |aTexture|, if
- * possible.  Return true iff |aDescr| was successfully set.
- */
-bool
-GetDescriptor(ID3D10Texture2D* aTexture, SurfaceDescriptorD3D10* aDescr);
-
-already_AddRefed<ID3D10Texture2D>
-OpenForeign(ID3D10Device* aDevice, const SurfaceDescriptorD3D10& aDescr);
-
-} // namespace layers
-} // namespace mozilla
-
-#endif  // mozilla_layers_ShadowLayerUtilsD3D10_h
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -44,17 +44,16 @@
 #include "gfxSharedImageSurface.h"
 
 #include "mozilla/ipc/SharedMemorySysV.h"
 #include "mozilla/layers/PLayerChild.h"
 #include "mozilla/layers/PLayersChild.h"
 #include "mozilla/layers/PLayersParent.h"
 #include "ShadowLayers.h"
 #include "ShadowLayerChild.h"
-#include "ShadowLayerUtils.h"
 
 using namespace mozilla::ipc;
 
 namespace mozilla {
 namespace layers {
 
 typedef nsTArray<SurfaceDescriptor> BufferArray; 
 typedef std::vector<Edit> EditVector;
@@ -375,16 +374,28 @@ ShadowLayerForwarder::EndTransaction(Inf
     MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
     return PR_FALSE;
   }
 
   MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
   return PR_TRUE;
 }
 
+LayersBackend
+ShadowLayerForwarder::GetParentBackendType()
+{
+  if (mParentBackend == LayerManager::LAYERS_NONE) {
+    LayersBackend backend;
+    if (mShadowManager->SendGetParentType(&backend)) {
+      mParentBackend = backend;
+    }
+  }
+  return mParentBackend;
+}
+
 static gfxASurface::gfxImageFormat
 OptimalFormatFor(gfxASurface::gfxContentType aContent)
 {
   switch (aContent) {
   case gfxASurface::CONTENT_COLOR:
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
     return gfxASurface::ImageFormatRGB16_565;
 #else
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -233,33 +233,19 @@ public:
   /**
    * End the current transaction and forward it to ShadowLayerManager.
    * |aReplies| are directions from the ShadowLayerManager to the
    * caller of EndTransaction().
    */
   PRBool EndTransaction(InfallibleTArray<EditReply>* aReplies);
 
   /**
-   * Set an actor through which layer updates will be pushed.
-   */
-  void SetShadowManager(PLayersChild* aShadowManager)
-  {
-    mShadowManager = aShadowManager;
-  }
-
-  void SetParentBackendType(LayersBackend aBackendType)
-  {
-    mParentBackend = aBackendType;
-  }
-
-  /**
    * True if this is forwarding to a ShadowLayerManager.
    */
   PRBool HasShadowManager() const { return !!mShadowManager; }
-  PLayersChild* 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
    * ShadowLayer IPC system.
    *
    * The basic lifecycle is
@@ -325,20 +311,17 @@ public:
   void DestroySharedSurface(SurfaceDescriptor* aSurface);
 
   /**
    * Construct a shadow of |aLayer| on the "other side", at the
    * ShadowLayerManager.
    */
   PLayerChild* ConstructShadowFor(ShadowableLayer* aLayer);
 
-  LayersBackend GetParentBackendType()
-  {
-    return mParentBackend;
-  }
+  LayersBackend GetParentBackendType();
 
   /*
    * No need to use double buffer in system memory with GPU rendering,
    * texture used as front buffer.
    */
   bool ShouldDoubleBuffer() { return GetParentBackendType() == LayerManager::LAYERS_BASIC; }
 
 protected:
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -121,21 +121,16 @@ public:
    * \param aClippingRegion Region to clip to. Setting an empty region
    * will disable clipping.
    */
   void SetClippingRegion(const nsIntRegion& aClippingRegion);
 
   /**
    * LayerManager implementation.
    */
-  virtual ShadowLayerManager* AsShadowManager()
-  {
-    return this;
-  }
-
   void BeginTransaction();
 
   void BeginTransactionWithTarget(gfxContext* aTarget);
 
   void EndConstruction();
 
   virtual bool EndEmptyTransaction();
   virtual void EndTransaction(DrawThebesLayerCallback aCallback,
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -74,17 +74,16 @@
 #include <string>
 
 using namespace mozilla::gfx;
 
 #ifdef CAIRO_HAS_D2D_SURFACE
 #include "gfxD2DSurface.h"
 
 #include <d3d10_1.h>
-#include <dxgi.h>
 
 #include "mozilla/gfx/2D.h"
 
 #include "nsIMemoryReporter.h"
 #include "nsMemory.h"
 #endif
 
 using namespace mozilla;
@@ -148,21 +147,16 @@ typedef HRESULT (WINAPI*D3D10CreateDevic
   IDXGIAdapter *pAdapter,
   D3D10_DRIVER_TYPE DriverType,
   HMODULE Software,
   UINT Flags,
   D3D10_FEATURE_LEVEL1 HardwareLevel,
   UINT SDKVersion,
   ID3D10Device1 **ppDevice
 );
-
-typedef HRESULT(WINAPI*CreateDXGIFactory1Func)(
-  REFIID riid,
-  void **ppFactory
-);
 #endif
 
 static __inline void
 BuildKeyNameFromFontName(nsAString &aName)
 {
     if (aName.Length() >= LF_FACESIZE)
         aName.Truncate(LF_FACESIZE - 1);
     ToLowerCase(aName);
@@ -319,60 +313,36 @@ gfxWindowsPlatform::VerifyD2DDevice(PRBo
     mozilla::ScopedGfxFeatureReporter reporter("D2D");
 
     HMODULE d3d10module = LoadLibraryA("d3d10_1.dll");
     D3D10CreateDevice1Func createD3DDevice = (D3D10CreateDevice1Func)
         GetProcAddress(d3d10module, "D3D10CreateDevice1");
     nsRefPtr<ID3D10Device1> device;
 
     if (createD3DDevice) {
-        HMODULE dxgiModule = LoadLibraryA("dxgi.dll");
-        CreateDXGIFactory1Func createDXGIFactory1 = (CreateDXGIFactory1Func)
-            GetProcAddress(dxgiModule, "CreateDXGIFactory1");
-
-        // Try to use a DXGI 1.1 adapter in order to share resources
-        // across processes.
-        nsRefPtr<IDXGIAdapter1> adapter1;
-        if (createDXGIFactory1) {
-            nsRefPtr<IDXGIFactory1> factory1;
-            HRESULT hr = createDXGIFactory1(__uuidof(IDXGIFactory1),
-                                            getter_AddRefs(factory1));
-    
-            nsRefPtr<IDXGIAdapter1> adapter1; 
-            hr = factory1->EnumAdapters1(0, getter_AddRefs(adapter1));
-
-            if (SUCCEEDED(hr) && adapter1) {
-                hr = adapter1->CheckInterfaceSupport(__uuidof(ID3D10Device1),
-                                                     nsnull);
-                if (FAILED(hr)) {
-                    adapter1 = nsnull;
-                }
-            }
-        }
-
         // We try 10.0 first even though we prefer 10.1, since we want to
         // fail as fast as possible if 10.x isn't supported.
         HRESULT hr = createD3DDevice(
-            adapter1, 
+            NULL, 
             D3D10_DRIVER_TYPE_HARDWARE,
             NULL,
             D3D10_CREATE_DEVICE_BGRA_SUPPORT |
             D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
             D3D10_FEATURE_LEVEL_10_0,
             D3D10_1_SDK_VERSION,
             getter_AddRefs(device));
 
         if (SUCCEEDED(hr)) {
             // We have 10.0, let's try 10.1.
             // XXX - This adds an additional 10-20ms for people who are
             // getting direct2d. We'd really like to do something more
             // clever.
             nsRefPtr<ID3D10Device1> device1;
             hr = createD3DDevice(
-                adapter1, 
+                NULL, 
                 D3D10_DRIVER_TYPE_HARDWARE,
                 NULL,
                 D3D10_CREATE_DEVICE_BGRA_SUPPORT |
                 D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
                 D3D10_FEATURE_LEVEL_10_1,
                 D3D10_1_SDK_VERSION,
                 getter_AddRefs(device1));
 
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -70,20 +70,16 @@ namespace base { class FileDescriptor { 
 
 using mozilla::layers::LayerManager;
 
 namespace mozilla {
 
 typedef gfxPattern::GraphicsFilter GraphicsFilterType;
 typedef gfxASurface::gfxSurfaceType gfxSurfaceType;
 typedef LayerManager::LayersBackend LayersBackend;
-typedef gfxASurface::gfxImageFormat PixelFormat;
-// This is a cross-platform approximation to HANDLE, which we expect
-// to be typedef'd to void* or thereabouts.
-typedef uintptr_t WindowsHandle;
 
 // XXX there are out of place and might be generally useful.  Could
 // move to nscore.h or something.
 struct void_t {
   bool operator==(const void_t&) const { return true; }
 };
 struct null_t {
   bool operator==(const null_t&) const { return true; }
@@ -503,79 +499,47 @@ struct ParamTraits<mozilla::gfxSurfaceTy
         filter < gfxASurface::SurfaceTypeMax) {
       *result = paramType(filter);
       return true;
     }
     return false;
   }
 };
 
-template<>
+ template<>
 struct ParamTraits<mozilla::LayersBackend>
 {
   typedef mozilla::LayersBackend paramType;
 
   static void Write(Message* msg, const paramType& param)
   {
-    if (LayerManager::LAYERS_NONE <= param &&
+    if (LayerManager::LAYERS_NONE < param &&
         param < LayerManager::LAYERS_LAST) {
       WriteParam(msg, int32(param));
       return;
     }
-    NS_RUNTIMEABORT("backend type not reached");
+    NS_RUNTIMEABORT("surface type not reached");
   }
 
   static bool Read(const Message* msg, void** iter, paramType* result)
   {
     int32 type;
     if (!ReadParam(msg, iter, &type))
       return false;
 
-    if (LayerManager::LAYERS_NONE <= type &&
+    if (LayerManager::LAYERS_NONE < type &&
         type < LayerManager::LAYERS_LAST) {
       *result = paramType(type);
       return true;
     }
     return false;
   }
 };
 
 template<>
-struct ParamTraits<mozilla::PixelFormat>
-{
-  typedef mozilla::PixelFormat paramType;
-
-  static bool IsLegalPixelFormat(const paramType& format)
-  {
-    return (gfxASurface::ImageFormatARGB32 <= format &&
-            format < gfxASurface::ImageFormatUnknown);
-  }
-
-  static void Write(Message* msg, const paramType& param)
-  {
-    if (!IsLegalPixelFormat(param)) {
-      NS_RUNTIMEABORT("Unknown pixel format");
-    }
-    WriteParam(msg, int32(param));
-    return;
-  }
-
-  static bool Read(const Message* msg, void** iter, paramType* result)
-  {
-    int32 format;
-    if (!ReadParam(msg, iter, &format) ||
-        !IsLegalPixelFormat(paramType(format))) {
-      return false;
-    }
-    *result = paramType(format);
-    return true;
-  }
-};
-
-template<>
 struct ParamTraits<gfxRGBA>
 {
   typedef gfxRGBA paramType;
 
   static void Write(Message* msg, const paramType& param)
   {
     WriteParam(msg, param.r);
     WriteParam(msg, param.g);
--- a/layout/ipc/PRenderFrame.ipdl
+++ b/layout/ipc/PRenderFrame.ipdl
@@ -36,18 +36,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 include protocol PBrowser;
 include protocol PLayers;
 
-using mozilla::LayersBackend;
-
 namespace mozilla {
 namespace layout {
 
 /**
  * PRenderFrame (in the layout sense of "frame") represents one web
  * "page".  It's used to graft content processes' layer trees into
  * chrome's rendering path.  The lifetime of a PRenderFrame is tied to
  * its PresShell in the child process.
@@ -56,19 +54,17 @@ namespace layout {
  * only makes sense wrt documents loaded by the child.
  */
 sync protocol PRenderFrame
 {
     manager PBrowser;
     manages PLayers;
 
 parent:
-    sync PLayers()
-      returns (LayersBackend backend);
-
+    async PLayers();
     async __delete__();
 
 state EMPTY:
     recv PLayers goto HAVE_CONTENT;
 state HAVE_CONTENT:
     recv __delete__;
 };
 
--- a/layout/ipc/RenderFrameChild.cpp
+++ b/layout/ipc/RenderFrameChild.cpp
@@ -61,17 +61,17 @@ RenderFrameChild::Destroy()
     // |layers| was just deleted, take care
   }
 
   Send__delete__(this);
   // WARNING: |this| is dead, hands off
 }
 
 PLayersChild*
-RenderFrameChild::AllocPLayers(LayerManager::LayersBackend* aBackendType)
+RenderFrameChild::AllocPLayers()
 {
   return new ShadowLayersChild();
 }
 
 bool
 RenderFrameChild::DeallocPLayers(PLayersChild* aLayers)
 {
   delete aLayers;
--- a/layout/ipc/RenderFrameChild.h
+++ b/layout/ipc/RenderFrameChild.h
@@ -51,17 +51,17 @@ class RenderFrameChild : public PRenderF
 public:
   RenderFrameChild() {}
   virtual ~RenderFrameChild() {}
 
   void Destroy();
 
 protected:
   NS_OVERRIDE
-  virtual PLayersChild* AllocPLayers(LayerManager::LayersBackend* aBackendType);
+  virtual PLayersChild* AllocPLayers();
   NS_OVERRIDE
   virtual bool DeallocPLayers(PLayersChild* aLayers);
 };
 
 } // namespace layout
 } // namespace mozilla
 
 #endif  // mozilla_dom_RenderFrameChild_h
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -560,21 +560,20 @@ BuildBackgroundPatternFor(ContainerLayer
   layer->SetVisibleRegion(bgRgn);
       
   aContainer->InsertAfter(layer, nsnull);
 }
 
 RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader)
   : mFrameLoader(aFrameLoader)
 {
-  if (aFrameLoader) {
-    mContentViews[FrameMetrics::ROOT_SCROLL_ID] =
-      new nsContentView(aFrameLoader->GetOwnerContent(),
-                        FrameMetrics::ROOT_SCROLL_ID);
-  }
+  NS_ABORT_IF_FALSE(aFrameLoader, "Need a frameloader here");
+  mContentViews[FrameMetrics::ROOT_SCROLL_ID] =
+    new nsContentView(aFrameLoader->GetOwnerContent(),
+                      FrameMetrics::ROOT_SCROLL_ID);
 }
 
 RenderFrameParent::~RenderFrameParent()
 {}
 
 void
 RenderFrameParent::Destroy()
 {
@@ -697,43 +696,52 @@ RenderFrameParent::OwnerContentChanged(n
   NS_ABORT_IF_FALSE(mFrameLoader->GetOwnerContent() == aContent,
                     "Don't build new map if owner is same!");
   BuildViewMap();
 }
 
 void
 RenderFrameParent::ActorDestroy(ActorDestroyReason why)
 {
-  if (mFrameLoader && mFrameLoader->GetCurrentRemoteFrame() == this) {
+  if (mFrameLoader->GetCurrentRemoteFrame() == this) {
     // XXX this might cause some weird issues ... we'll just not
     // redraw the part of the window covered by this until the "next"
     // remote frame has a layer-tree transaction.  For
     // why==NormalShutdown, we'll definitely want to do something
     // better, especially as nothing guarantees another Update() from
     // the "next" remote layer tree.
     mFrameLoader->SetCurrentRemoteFrame(nsnull);
   }
   mFrameLoader = nsnull;
 }
 
 PLayersParent*
-RenderFrameParent::AllocPLayers(LayerManager::LayersBackend* aBackendType)
+RenderFrameParent::AllocPLayers()
 {
-  if (!mFrameLoader) {
-    *aBackendType = LayerManager::LAYERS_NONE;
+  LayerManager* lm = GetLayerManager();
+  switch (lm->GetBackendType()) {
+  case LayerManager::LAYERS_BASIC: {
+    BasicShadowLayerManager* bslm = static_cast<BasicShadowLayerManager*>(lm);
+    return new ShadowLayersParent(bslm);
+  }
+  case LayerManager::LAYERS_OPENGL: {
+    LayerManagerOGL* lmo = static_cast<LayerManagerOGL*>(lm);
+    return new ShadowLayersParent(lmo);
+  }
+#ifdef MOZ_ENABLE_D3D9_LAYER
+  case LayerManager::LAYERS_D3D9: {
+    LayerManagerD3D9* lmd3d9 = static_cast<LayerManagerD3D9*>(lm);
+    return new ShadowLayersParent(lmd3d9);
+  }
+#endif //MOZ_ENABLE_D3D9_LAYER
+  default: {
+    NS_WARNING("shadow layers no sprechen D3D backend yet");
     return nsnull;
   }
-  LayerManager* lm = GetLayerManager();
-  ShadowLayerManager* slm = lm->AsShadowManager();
-  if (!slm) {
-    *aBackendType = LayerManager::LAYERS_NONE;
-     return nsnull;
   }
-  *aBackendType = lm->GetBackendType();
-  return new ShadowLayersParent(slm);
 }
 
 bool
 RenderFrameParent::DeallocPLayers(PLayersParent* aLayers)
 {
   delete aLayers;
   return true;
 }
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -94,17 +94,17 @@ public:
                                      LayerManager* aManager,
                                      const nsIntRect& aVisibleRect);
 
   void OwnerContentChanged(nsIContent* aContent);
 
 protected:
   NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
 
-  NS_OVERRIDE virtual PLayersParent* AllocPLayers(LayerManager::LayersBackend* aBackendType);
+  NS_OVERRIDE virtual PLayersParent* AllocPLayers();
   NS_OVERRIDE virtual bool DeallocPLayers(PLayersParent* aLayers);
 
 private:
   void BuildViewMap();
 
   LayerManager* GetLayerManager() const;
   ShadowLayersParent* GetShadowLayers() const;
   ContainerLayer* GetRootLayer() const;
--- a/layout/ipc/test-ipcbrowser-chrome.js
+++ b/layout/ipc/test-ipcbrowser-chrome.js
@@ -17,17 +17,17 @@ function viewManager() {
     return frameLoader().QueryInterface(Components.interfaces.nsIContentViewManager);
 }
 
 function rootView() {
     return viewManager().rootContentView;
 }
 
 function enableAsyncScrolling() {
-    frameLoader().renderMode = Components.interfaces.nsIFrameLoader.RENDER_MODE_ASYNC_SCROLL;
+    frameLoader().renderMode = Components.interfaces.nsIFrameLoaer.RENDER_MODE_ASYNC_SCROLL;
 }
 
 // Functions affecting the content window.
 
 function loadURL(url) {
     browser().setAttribute('src', url);
 }
 
--- a/widget/public/nsIWidget.h
+++ b/widget/public/nsIWidget.h
@@ -42,17 +42,16 @@
 #include "nsColor.h"
 #include "nsCoord.h"
 #include "nsRect.h"
 #include "nsPoint.h"
 #include "nsRegion.h"
 #include "nsStringGlue.h"
 
 #include "prthread.h"
-#include "Layers.h"
 #include "nsEvent.h"
 #include "nsCOMPtr.h"
 #include "nsITheme.h"
 #include "nsNativeWidget.h"
 #include "nsWidgetInitData.h"
 #include "nsTArray.h"
 #include "nsXULAppAPI.h"
 
@@ -67,22 +66,22 @@ class   nsIRollupListener;
 class   nsIMenuRollup;
 class   nsGUIEvent;
 class   imgIContainer;
 class   gfxASurface;
 class   nsIContent;
 class   ViewWrapper;
 
 namespace mozilla {
+namespace layers {
+class LayerManager;
+}
 namespace dom {
 class PBrowserChild;
 }
-namespace layers {
-class PLayersChild;
-}
 }
 
 /**
  * Callback function that processes events.
  *
  * The argument is actually a subtype (subclass) of nsEvent which carries
  * platform specific information about the event. Platform specific code
  * knows how to deal with it.
@@ -113,18 +112,18 @@ typedef nsEventStatus (* EVENT_CALLBACK)
 #endif
 #ifdef XP_WIN
 #define NS_NATIVE_TSF_THREAD_MGR       100
 #define NS_NATIVE_TSF_CATEGORY_MGR     101
 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
 #endif
 
 #define NS_IWIDGET_IID \
-  { 0xf43254ce, 0xd315, 0x458b, \
-    { 0xba, 0x72, 0xa8, 0xdf, 0x21, 0xcf, 0xa7, 0x2a } }
+  { 0xac809e35, 0x632c, 0x448d, \
+    { 0x9e, 0x34, 0x11, 0x62, 0x32, 0x60, 0x5e, 0xe6 } }
 
 /*
  * Window shadow styles
  * Also used for the -moz-window-shadow CSS property
  */
 
 #define NS_STYLE_WINDOW_SHADOW_NONE             0
 #define NS_STYLE_WINDOW_SHADOW_DEFAULT          1
@@ -270,18 +269,16 @@ struct IMEContext {
  * all basic and necessary functionality.
  */
 class nsIWidget : public nsISupports {
   protected:
     typedef mozilla::dom::PBrowserChild PBrowserChild;
 
   public:
     typedef mozilla::layers::LayerManager LayerManager;
-    typedef LayerManager::LayersBackend LayersBackend;
-    typedef mozilla::layers::PLayersChild PLayersChild;
 
     // Used in UpdateThemeGeometries.
     struct ThemeGeometry {
       // The -moz-appearance value for the themed widget
       PRUint8 mWidgetType;
       // The device-pixel rect within the window for the themed widget
       nsIntRect mRect;
 
@@ -892,50 +889,36 @@ class nsIWidget : public nsISupports {
      *
      * An AddRef has NOT been done for the caller.
      *
      * @return the toolkit this widget was created in. See nsToolkit.
      */
 
     virtual nsIToolkit* GetToolkit() = 0;    
 
-    enum LayerManagerPersistence
-    {
-      LAYER_MANAGER_CURRENT = 0,
-      LAYER_MANAGER_PERSISTENT
-    };
-
     /**
      * Return the widget's LayerManager. The layer tree for that
      * LayerManager is what gets rendered to the widget.
      *
      * @param aAllowRetaining an outparam that states whether the returned
      * layer manager should be used for retained layers
      */
     inline LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull)
     {
-        return GetLayerManager(nsnull, LayerManager::LAYERS_NONE,
-                               LAYER_MANAGER_CURRENT, aAllowRetaining);
+        return GetLayerManager(LAYER_MANAGER_CURRENT, aAllowRetaining);
     }
 
-    inline LayerManager* GetLayerManager(LayerManagerPersistence aPersistence,
-                                         bool* aAllowRetaining = nsnull)
-    {
-        return GetLayerManager(nsnull, LayerManager::LAYERS_NONE,
-                               aPersistence, aAllowRetaining);
-    }
 
-    /**
-     * Like GetLayerManager(), but prefers creating a layer manager of
-     * type |aBackendHint| instead of what would normally be created.
-     * LAYERS_NONE means "no hint".
-     */
-    virtual LayerManager* GetLayerManager(PLayersChild* aShadowManager,
-                                          LayersBackend aBackendHint,
-                                          LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
+    enum LayerManagerPersistence
+    {
+      LAYER_MANAGER_CURRENT = 0,
+      LAYER_MANAGER_PERSISTENT
+    };
+
+    virtual LayerManager *GetLayerManager(LayerManagerPersistence aPersistence,
                                           bool* aAllowRetaining = nsnull) = 0;
 
     /**
      * Called after the LayerManager draws the layer tree
      *
      * @param aManager The drawing LayerManager.
      * @param aRect Current widget rect that is being drawn.
      */
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -3168,21 +3168,18 @@ GetLayerManagerPrefs(LayerManagerPrefs* 
   PRBool safeMode = PR_FALSE;
   nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
   if (xr)
     xr->GetInSafeMode(&safeMode);
   aManagerPrefs->mDisableAcceleration =
     aManagerPrefs->mDisableAcceleration || safeMode;
 }
 
-LayerManager*
-nsWindow::GetLayerManager(PLayersChild* aShadowManager,
-                          LayersBackend aBackendHint,
-                          LayerManagerPersistence aPersistence,
-                          bool* aAllowRetaining)
+mozilla::layers::LayerManager*
+nsWindow::GetLayerManager(LayerManagerPersistence aPersistence, bool* aAllowRetaining)
 {
   if (aAllowRetaining) {
     *aAllowRetaining = true;
   }
 
 #ifdef MOZ_ENABLE_D3D10_LAYER
   if (mLayerManager) {
     if (mLayerManager->GetBackendType() ==
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -154,20 +154,17 @@ public:
   virtual nsIntSize       ClientToWindowSize(const nsIntSize& aClientSize);
   NS_IMETHOD              DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
   NS_IMETHOD              EnableDragDrop(PRBool aEnable);
   NS_IMETHOD              CaptureMouse(PRBool aCapture);
   NS_IMETHOD              CaptureRollupEvents(nsIRollupListener * aListener, nsIMenuRollup * aMenuRollup,
                                               PRBool aDoCapture, PRBool aConsumeRollupEvent);
   NS_IMETHOD              GetAttention(PRInt32 aCycleCount);
   virtual PRBool          HasPendingInputEvent();
-  virtual LayerManager*   GetLayerManager(PLayersChild* aShadowManager = nsnull,
-                                          LayersBackend aBackendHint = LayerManager::LAYERS_NONE,
-                                          LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
-                                          bool* aAllowRetaining = nsnull);
+  virtual LayerManager*   GetLayerManager(LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nsnull);
   gfxASurface             *GetThebesSurface();
   NS_IMETHOD              OnDefaultButtonLoaded(const nsIntRect &aButtonRect);
   NS_IMETHOD              OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta, PRBool aIsHorizontal, PRInt32 &aOverriddenDelta);
 
   virtual nsresult        SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
                                                    PRInt32 aNativeKeyCode,
                                                    PRUint32 aModifierFlags,
                                                    const nsAString& aCharacters,
--- a/widget/src/xpwidgets/Makefile.in
+++ b/widget/src/xpwidgets/Makefile.in
@@ -92,20 +92,16 @@ ifneq (,$(filter qt gtk2 windows cocoa,$
 CPPSRCS += nsNativeTheme.cpp
 endif
 
 SHARED_LIBRARY_LIBS = ../shared/$(LIB_PREFIX)widget_shared.$(LIB_SUFFIX)
 ifdef MOZ_X11
 SHARED_LIBRARY_LIBS += ../shared/x11/$(LIB_PREFIX)widget_shared_x11.$(LIB_SUFFIX)
 endif
 
-ifdef MOZ_ENABLE_D3D10_LAYER
-DEFINES		+= -DMOZ_ENABLE_D3D10_LAYER
-endif
-
 LOCAL_INCLUDES	+= \
 		-I$(srcdir)/../$(MOZ_WIDGET_TOOLKIT) \
 		-I$(srcdir)/../shared \
 		-I$(topsrcdir)/layout/forms \
 		-I$(topsrcdir)/layout/generic \
 		-I$(topsrcdir)/layout/xul/base/src \
 		-I$(srcdir) \
 		$(NULL)
--- a/widget/src/xpwidgets/PuppetWidget.cpp
+++ b/widget/src/xpwidgets/PuppetWidget.cpp
@@ -35,19 +35,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/dom/PBrowserChild.h"
 #include "BasicLayers.h"
-#if defined(MOZ_ENABLE_D3D10_LAYER)
-# include "LayerManagerD3D10.h"
-#endif
 
 #include "gfxPlatform.h"
 #include "PuppetWidget.h"
 
 using namespace mozilla::layers;
 using namespace mozilla::widget;
 using namespace mozilla::dom;
 
@@ -328,37 +325,20 @@ PuppetWidget::DispatchEvent(nsGUIEvent* 
   if (event->message == NS_COMPOSITION_END) {
     mIMEComposing = PR_FALSE;
   }
 
   return NS_OK;
 }
 
 LayerManager*
-PuppetWidget::GetLayerManager(PLayersChild* aShadowManager,
-                              LayersBackend aBackendHint,
-                              LayerManagerPersistence aPersistence,
-                              bool* aAllowRetaining)
+PuppetWidget::GetLayerManager(LayerManagerPersistence, bool* aAllowRetaining)
 {
   if (!mLayerManager) {
-    // The backend hint is a temporary placeholder until Azure, when
-    // all content-process layer managers will be BasicLayerManagers.
-#if defined(MOZ_ENABLE_D3D10_LAYER)
-    if (LayerManager::LAYERS_D3D10 == aBackendHint) {
-      nsRefPtr<LayerManagerD3D10> m = new LayerManagerD3D10(this);
-      m->AsShadowForwarder()->SetShadowManager(aShadowManager);
-      if (m->Initialize()) {
-        mLayerManager = m;
-      }
-    }
-#endif
-    if (!mLayerManager) {
-      mLayerManager = new BasicShadowLayerManager(this);
-      mLayerManager->AsShadowForwarder()->SetShadowManager(aShadowManager);
-    }
+    mLayerManager = new BasicShadowLayerManager(this);
   }
   if (aAllowRetaining) {
     *aAllowRetaining = true;
   }
   return mLayerManager;
 }
 
 gfxASurface*
@@ -553,25 +533,20 @@ PuppetWidget::DispatchPaintEvent()
 
   nsEventStatus status;
   {
 #ifdef DEBUG
     debug_DumpPaintEvent(stderr, this, &event,
                          nsCAutoString("PuppetWidget"), nsnull);
 #endif
 
-    LayerManager* lm = GetLayerManager();
-    if (LayerManager::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
-      DispatchEvent(&event, status);
-    } else {
-      nsRefPtr<gfxContext> ctx = new gfxContext(mSurface);
-      AutoLayerManagerSetup setupLayerManager(this, ctx,
-                                              BasicLayerManager::BUFFER_NONE);
-      DispatchEvent(&event, status);  
-    }
+    nsRefPtr<gfxContext> ctx = new gfxContext(mSurface);
+    AutoLayerManagerSetup setupLayerManager(this, ctx,
+                                            BasicLayerManager::BUFFER_NONE);
+    DispatchEvent(&event, status);  
   }
 
   nsPaintEvent didPaintEvent(PR_TRUE, NS_DID_PAINT, this);
   DispatchEvent(&didPaintEvent, status);
 
   return NS_OK;
 }
 
--- a/widget/src/xpwidgets/PuppetWidget.h
+++ b/widget/src/xpwidgets/PuppetWidget.h
@@ -159,21 +159,18 @@ public:
                                  PRBool aDoCapture, PRBool aConsumeRollupEvent)
   { return NS_ERROR_UNEXPECTED; }
 
   //
   // nsBaseWidget methods we override
   //
 
 //NS_IMETHOD              CaptureMouse(PRBool aCapture);
-  virtual LayerManager*
-  GetLayerManager(PLayersChild* aShadowManager = nsnull,
-                  LayersBackend aBackendHint = LayerManager::LAYERS_NONE,
-                  LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
-                  bool* aAllowRetaining = nsnull);
+  virtual LayerManager*     GetLayerManager(LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
+                                            bool* aAllowRetaining = nsnull);
 //  virtual nsDeviceContext* GetDeviceContext();
   virtual gfxASurface*      GetThebesSurface();
 
   NS_IMETHOD ResetInputState();
   NS_IMETHOD SetIMEOpenState(PRBool aState);
   NS_IMETHOD GetIMEOpenState(PRBool *aState);
   NS_IMETHOD SetInputMode(const IMEContext& aContext);
   NS_IMETHOD GetInputMode(IMEContext& aContext);
--- a/widget/src/xpwidgets/nsBaseWidget.cpp
+++ b/widget/src/xpwidgets/nsBaseWidget.cpp
@@ -847,27 +847,26 @@ nsBaseWidget::GetShouldAccelerate()
 
   if (accelerateByDefault)
     return PR_TRUE;
 
   /* use the window acceleration flag */
   return mUseAcceleratedRendering;
 }
 
-LayerManager* nsBaseWidget::GetLayerManager(PLayersChild* aShadowManager,
-                                            LayersBackend aBackendHint,
-                                            LayerManagerPersistence aPersistence,
+LayerManager* nsBaseWidget::GetLayerManager(LayerManagerPersistence,
                                             bool* aAllowRetaining)
 {
   if (!mLayerManager) {
 
     mUseAcceleratedRendering = GetShouldAccelerate();
 
     if (mUseAcceleratedRendering) {
-      nsRefPtr<LayerManagerOGL> layerManager = new LayerManagerOGL(this);
+      nsRefPtr<LayerManagerOGL> layerManager =
+        new mozilla::layers::LayerManagerOGL(this);
       /**
        * XXX - On several OSes initialization is expected to fail for now.
        * If we'd get a none-basic layer manager they'd crash. This is ok though
        * since on those platforms it will fail. Anyone implementing new
        * platforms on LayerManagerOGL should ensure their widget is able to
        * deal with it though!
        */
       if (layerManager->Initialize()) {
--- a/widget/src/xpwidgets/nsBaseWidget.h
+++ b/widget/src/xpwidgets/nsBaseWidget.h
@@ -110,19 +110,17 @@ public:
   virtual nsTransparencyMode GetTransparencyMode();
   virtual void            GetWindowClipRegion(nsTArray<nsIntRect>* aRects);
   NS_IMETHOD              SetWindowShadowStyle(PRInt32 aStyle);
   virtual void            SetShowsToolbarButton(PRBool aShow) {}
   NS_IMETHOD              HideWindowChrome(PRBool aShouldHide);
   NS_IMETHOD              MakeFullScreen(PRBool aFullScreen);
   virtual nsDeviceContext* GetDeviceContext();
   virtual nsIToolkit*     GetToolkit();
-  virtual LayerManager*   GetLayerManager(PLayersChild* aShadowManager,
-                                          LayersBackend aBackendHint,
-                                          LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
+  virtual LayerManager*   GetLayerManager(LayerManagerPersistence aPersistence,
                                           bool* aAllowRetaining = nsnull);
   using nsIWidget::GetLayerManager;
 
   virtual void            DrawOver(LayerManager* aManager, nsIntRect aRect) {}
   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {}
   virtual gfxASurface*    GetThebesSurface();
   NS_IMETHOD              SetModal(PRBool aModal); 
   NS_IMETHOD              SetWindowClass(const nsAString& xulWinType);