Back out 7 changesets (bug 1281998) for Windows Marionette crashes
authorPhil Ringnalda <philringnalda@gmail.com>
Wed, 29 Jun 2016 19:35:24 -0700
changeset 303220 48bd14a01b55464215c0bfe973f5657a7b5b7f9c
parent 303219 3d503858ee3347ad5361af51de16e8bf049de4de
child 303221 a7788974daac58f5d87049352f21982567f16cce
push id30382
push usercbook@mozilla.com
push dateThu, 30 Jun 2016 10:34:10 +0000
treeherdermozilla-central@bcf4ff0c3eef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1281998
milestone50.0a1
backs outd806fac2c856f7c7f08049eb0eefbabba7283939
b8d4fedfd7eb7354b34521b161d430cda684848f
a72929c0c3ec750dfb3127f51f54cbb2432d1a9d
74198f88fa3715d5f7a01b7186af341a540614b6
54a0e73f69069c1b5c180a88ead3e9e06f1ce72c
99d1da1293b7af8a5a42612a103d81b3b7edfc22
a5a9585754b1810fac7711d3ee1de8fe06016489
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out 7 changesets (bug 1281998) for Windows Marionette crashes Backed out changeset d806fac2c856 (bug 1281998) Backed out changeset b8d4fedfd7eb (bug 1281998) Backed out changeset a72929c0c3ec (bug 1281998) Backed out changeset 74198f88fa37 (bug 1281998) Backed out changeset 54a0e73f6906 (bug 1281998) Backed out changeset 99d1da1293b7 (bug 1281998) Backed out changeset a5a9585754b1 (bug 1281998)
gfx/ipc/CompositorSession.cpp
gfx/ipc/CompositorSession.h
gfx/ipc/GPUProcessManager.cpp
gfx/ipc/GPUProcessManager.h
gfx/layers/Compositor.cpp
gfx/layers/Compositor.h
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/basic/BasicCompositor.h
gfx/layers/basic/X11BasicCompositor.h
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/CompositorD3D11.h
gfx/layers/d3d9/CompositorD3D9.cpp
gfx/layers/d3d9/CompositorD3D9.h
gfx/layers/ipc/CompositorBridgeChild.cpp
gfx/layers/ipc/CompositorBridgeChild.h
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/ipc/CompositorBridgeParent.h
gfx/layers/ipc/PCompositorBridge.ipdl
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/CompositorOGL.h
gfx/tests/gtest/TestCompositor.cpp
widget/CompositorWidget.cpp
widget/CompositorWidget.h
widget/CompositorWidgetProxy.cpp
widget/CompositorWidgetProxy.h
widget/InProcessCompositorWidget.cpp
widget/InProcessCompositorWidget.h
widget/PCompositorWidget.ipdl
widget/PlatformWidgetTypes.ipdlh
widget/PuppetWidget.h
widget/cocoa/nsCocoaWindow.h
widget/moz.build
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIWidget.h
widget/windows/CompositorWidgetChild.cpp
widget/windows/CompositorWidgetChild.h
widget/windows/CompositorWidgetParent.cpp
widget/windows/CompositorWidgetParent.h
widget/windows/PCompositorWidget.ipdl
widget/windows/PlatformWidgetTypes.ipdlh
widget/windows/WinCompositorWidget.cpp
widget/windows/WinCompositorWidget.h
widget/windows/WinCompositorWidgetProxy.cpp
widget/windows/WinCompositorWidgetProxy.h
widget/windows/moz.build
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/windows/nsWindowGfx.cpp
--- a/gfx/ipc/CompositorSession.cpp
+++ b/gfx/ipc/CompositorSession.cpp
@@ -1,93 +1,83 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=99: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "CompositorSession.h"
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
-#include "mozilla/widget/PlatformWidgetTypes.h"
 #include "base/process_util.h"
 
 namespace mozilla {
 namespace layers {
 
-using namespace widget;
-
 class InProcessCompositorSession final : public CompositorSession
 {
 public:
   InProcessCompositorSession(
-    nsIWidget* aWidget,
+    widget::CompositorWidgetProxy* aWidgetProxy,
     ClientLayerManager* aLayerManager,
     CSSToLayoutDeviceScale aScale,
     bool aUseAPZ,
     bool aUseExternalSurfaceSize,
     const gfx::IntSize& aSurfaceSize);
 
   CompositorBridgeParent* GetInProcessBridge() const override;
   void SetContentController(GeckoContentController* aController) override;
   uint64_t RootLayerTreeId() const override;
   already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
   void Shutdown() override;
 
 private:
   RefPtr<CompositorBridgeParent> mCompositorBridgeParent;
-  RefPtr<CompositorWidget> mCompositorWidget;
 };
 
 already_AddRefed<CompositorSession>
-CompositorSession::CreateInProcess(nsIWidget* aWidget,
+CompositorSession::CreateInProcess(widget::CompositorWidgetProxy* aWidgetProxy,
                                    ClientLayerManager* aLayerManager,
                                    CSSToLayoutDeviceScale aScale,
                                    bool aUseAPZ,
                                    bool aUseExternalSurfaceSize,
                                    const gfx::IntSize& aSurfaceSize)
 {
   RefPtr<InProcessCompositorSession> session = new InProcessCompositorSession(
-    aWidget,
+    aWidgetProxy,
     aLayerManager,
     aScale,
     aUseAPZ,
     aUseExternalSurfaceSize,
     aSurfaceSize);
   return session.forget();
 }
 
 CompositorSession::CompositorSession()
- : mCompositorWidgetDelegate(nullptr)
 {
 }
 
 CompositorSession::~CompositorSession()
 {
 }
 
 CompositorBridgeChild*
 CompositorSession::GetCompositorBridgeChild()
 {
   return mCompositorBridgeChild;
 }
 
-InProcessCompositorSession::InProcessCompositorSession(nsIWidget* aWidget,
+InProcessCompositorSession::InProcessCompositorSession(widget::CompositorWidgetProxy* aWidgetProxy,
                                                        ClientLayerManager* aLayerManager,
                                                        CSSToLayoutDeviceScale aScale,
                                                        bool aUseAPZ,
                                                        bool aUseExternalSurfaceSize,
                                                        const gfx::IntSize& aSurfaceSize)
 {
-  CompositorWidgetInitData initData;
-  aWidget->GetCompositorWidgetInitData(&initData);
-  mCompositorWidget = CompositorWidget::CreateLocal(initData, aWidget);
-  mCompositorWidgetDelegate = mCompositorWidget->AsDelegate();
-
   mCompositorBridgeParent = new CompositorBridgeParent(
-    mCompositorWidget,
+    aWidgetProxy,
     aScale,
     aUseAPZ,
     aUseExternalSurfaceSize,
     aSurfaceSize);
   mCompositorBridgeChild = new CompositorBridgeChild(aLayerManager);
   mCompositorBridgeChild->OpenSameProcess(mCompositorBridgeParent);
   mCompositorBridgeParent->SetOtherProcessId(base::GetCurrentProcId());
 }
@@ -121,13 +111,12 @@ InProcessCompositorSession::Shutdown()
 {
   // Destroy will synchronously wait for the parent to acknowledge shutdown,
   // at which point CBP will defer a Release on the compositor thread. We
   // can safely release our reference now, and let the destructor run on either
   // thread.
   mCompositorBridgeChild->Destroy();
   mCompositorBridgeChild = nullptr;
   mCompositorBridgeParent = nullptr;
-  mCompositorWidget = nullptr;
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/ipc/CompositorSession.h
+++ b/gfx/ipc/CompositorSession.h
@@ -6,22 +6,19 @@
 #ifndef _include_mozilla_gfx_ipc_CompositorSession_h_
 #define _include_mozilla_gfx_ipc_CompositorSession_h_
 
 #include "base/basictypes.h"
 #include "Units.h"
 #include "nsISupportsImpl.h"
 #include "mozilla/gfx/Point.h"
 
-class nsIWidget;
-
 namespace mozilla {
 namespace widget {
-class CompositorWidget;
-class CompositorWidgetDelegate;
+class CompositorWidgetProxy;
 } // namespace widget
 namespace gfx {
 class GPUProcessManager;
 } // namespace gfx
 namespace layers {
 
 class GeckoContentController;
 class APZCTreeManager;
@@ -30,20 +27,16 @@ class CompositorBridgeChild;
 class ClientLayerManager;
 
 // A CompositorSession provides access to a compositor without exposing whether
 // or not it's in-process or out-of-process.
 class CompositorSession
 {
   friend class gfx::GPUProcessManager;
 
-protected:
-  typedef widget::CompositorWidget CompositorWidget;
-  typedef widget::CompositorWidgetDelegate CompositorWidgetDelegate;
-
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorSession)
 
   virtual void Shutdown() = 0;
 
   // This returns a CompositorBridgeParent if the compositor resides in the same process.
   virtual CompositorBridgeParent* GetInProcessBridge() const = 0;
 
@@ -54,36 +47,30 @@ public:
   virtual uint64_t RootLayerTreeId() const = 0;
 
   // Return the Async Pan/Zoom Tree Manager for this compositor.
   virtual already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const = 0;
 
   // Return the child end of the compositor IPC bridge.
   CompositorBridgeChild* GetCompositorBridgeChild();
 
-  // Return the proxy for accessing the compositor's widget.
-  CompositorWidgetDelegate* GetCompositorWidgetDelegate() {
-    return mCompositorWidgetDelegate;
-  }
-
 protected:
   CompositorSession();
   virtual ~CompositorSession();
 
   static already_AddRefed<CompositorSession> CreateInProcess(
-    nsIWidget* aWidget,
+    widget::CompositorWidgetProxy* aWidgetProxy,
     ClientLayerManager* aLayerManager,
     CSSToLayoutDeviceScale aScale,
     bool aUseAPZ,
     bool aUseExternalSurfaceSize,
     const gfx::IntSize& aSurfaceSize);
 
 protected:
   RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
-  CompositorWidgetDelegate* mCompositorWidgetDelegate;
 
 private:
   DISALLOW_COPY_AND_ASSIGN(CompositorSession);
 };
 
 } // namespace layers
 } // namespace mozilla
 
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -145,25 +145,25 @@ GPUProcessManager::DestroyProcess()
   }
 
   mProcess->Shutdown();
   mProcess = nullptr;
   mGPUChild = nullptr;
 }
 
 already_AddRefed<CompositorSession>
-GPUProcessManager::CreateTopLevelCompositor(nsIWidget* aWidget,
+GPUProcessManager::CreateTopLevelCompositor(widget::CompositorWidgetProxy* aProxy,
                                             ClientLayerManager* aLayerManager,
                                             CSSToLayoutDeviceScale aScale,
                                             bool aUseAPZ,
                                             bool aUseExternalSurfaceSize,
                                             const gfx::IntSize& aSurfaceSize)
 {
   return CompositorSession::CreateInProcess(
-    aWidget,
+    aProxy,
     aLayerManager,
     aScale,
     aUseAPZ,
     aUseExternalSurfaceSize,
     aSurfaceSize);
 }
 
 PCompositorBridgeParent*
--- a/gfx/ipc/GPUProcessManager.h
+++ b/gfx/ipc/GPUProcessManager.h
@@ -19,17 +19,17 @@ namespace mozilla {
 namespace layers {
 class APZCTreeManager;
 class CompositorSession;
 class ClientLayerManager;
 class CompositorUpdateObserver;
 class PCompositorBridgeParent;
 } // namespace layers
 namespace widget {
-class CompositorWidget;
+class CompositorWidgetProxy;
 } // namespace widget
 namespace dom {
 class ContentParent;
 class TabParent;
 } // namespace dom
 namespace ipc {
 class GeckoChildProcessHost;
 } // namespace ipc
@@ -56,17 +56,17 @@ public:
   void EnableGPUProcess();
 
   // Ensure that GPU-bound methods can be used. If no GPU process is being
   // used, or one is launched and ready, this function returns immediately.
   // Otherwise it blocks until the GPU process has finished launching.
   void EnsureGPUReady();
 
   already_AddRefed<layers::CompositorSession> CreateTopLevelCompositor(
-    nsIWidget* aWidget,
+    widget::CompositorWidgetProxy* aProxy,
     layers::ClientLayerManager* aLayerManager,
     CSSToLayoutDeviceScale aScale,
     bool aUseAPZ,
     bool aUseExternalSurfaceSize,
     const gfx::IntSize& aSurfaceSize);
 
   layers::PCompositorBridgeParent* CreateTabCompositorBridge(
     ipc::Transport* aTransport,
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -20,17 +20,17 @@
 #include "nsWindow.h"
 #include "nsScreenManagerGonk.h"
 #endif
 
 namespace mozilla {
 
 namespace layers {
 
-Compositor::Compositor(widget::CompositorWidget* aWidget,
+Compositor::Compositor(widget::CompositorWidgetProxy* aWidget,
                       CompositorBridgeParent* aParent)
   : mCompositorID(0)
   , mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
   , mParent(aParent)
   , mPixelsPerFrame(0)
   , mPixelsFilled(0)
   , mScreenRotation(ROTATION_0)
   , mWidget(aWidget)
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -12,21 +12,21 @@
 #include "mozilla/gfx/2D.h"             // for DrawTarget
 #include "mozilla/gfx/MatrixFwd.h"      // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for IntSize, Point
 #include "mozilla/gfx/Rect.h"           // for Rect, IntRect
 #include "mozilla/gfx/Types.h"          // for Float
 #include "mozilla/layers/CompositorTypes.h"  // for DiagnosticTypes, etc
 #include "mozilla/layers/FenceUtils.h"  // for FenceHandle
 #include "mozilla/layers/LayersTypes.h"  // for LayersBackend
-#include "mozilla/widget/CompositorWidget.h"
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsRegion.h"
 #include <vector>
 #include "mozilla/WidgetUtils.h"
+#include "CompositorWidgetProxy.h"
 
 /**
  * Different elements of a web pages are rendered into separate "layers" before
  * they are flattened into the final image that is brought to the screen.
  * See Layers.h for more informations about layers and why we use retained
  * structures.
  * Most of the documentation for layers is directly in the source code in the
  * form of doc comments. An overview can also be found in the the wiki:
@@ -187,17 +187,17 @@ enum SurfaceInitMode
 class Compositor
 {
 protected:
   virtual ~Compositor();
 
 public:
   NS_INLINE_DECL_REFCOUNTING(Compositor)
 
-  explicit Compositor(widget::CompositorWidget* aWidget,
+  explicit Compositor(widget::CompositorWidgetProxy* aWidget,
                       CompositorBridgeParent* aParent = nullptr);
 
   virtual already_AddRefed<DataTextureSource> CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) = 0;
 
   virtual already_AddRefed<DataTextureSource>
   CreateDataTextureSourceAround(gfx::DataSourceSurface* aSurface) { return nullptr; }
 
   virtual bool Initialize() = 0;
@@ -469,17 +469,17 @@ public:
   /**
    * Call before rendering begins to ensure the compositor is ready to
    * composite. Returns false if rendering should be aborted.
    */
   virtual bool Ready() { return true; }
 
   virtual void ForcePresent() { }
 
-  widget::CompositorWidget* GetWidget() const { return mWidget; }
+  widget::CompositorWidgetProxy* GetWidget() const { return mWidget; }
 
   virtual bool HasImageHostOverlays() { return false; }
 
   virtual void AddImageHostOverlay(ImageHostOverlay* aOverlay) {}
 
   virtual void RemoveImageHostOverlay(ImageHostOverlay* aOverlay) {}
 
   /**
@@ -613,17 +613,17 @@ protected:
   size_t mPixelsPerFrame;
   size_t mPixelsFilled;
 
   ScreenRotation mScreenRotation;
 
   RefPtr<gfx::DrawTarget> mTarget;
   gfx::IntRect mTargetBounds;
 
-  widget::CompositorWidget* mWidget;
+  widget::CompositorWidgetProxy* mWidget;
 
   bool mIsDestroyed;
 
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
   FenceHandle mReleaseFenceHandle;
 #endif
 
 private:
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -75,17 +75,17 @@ public:
     SetUpdateSerial(0);
   }
 
 public:
   RefPtr<gfx::DataSourceSurface> mSurface;
   bool mWrappingExistingData;
 };
 
-BasicCompositor::BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
+BasicCompositor::BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidgetProxy* aWidget)
   : Compositor(aWidget, aParent)
   , mDidExternalComposition(false)
 {
   MOZ_COUNT_CTOR(BasicCompositor);
 
   mMaxTextureSize =
     Factory::GetMaxSurfaceSize(gfxPlatform::GetPlatform()->GetContentBackendFor(LayersBackend::LAYERS_BASIC));
 }
--- a/gfx/layers/basic/BasicCompositor.h
+++ b/gfx/layers/basic/BasicCompositor.h
@@ -36,17 +36,17 @@ public:
 
   RefPtr<gfx::DrawTarget> mDrawTarget;
   gfx::IntSize mSize;
 };
 
 class BasicCompositor : public Compositor
 {
 public:
-  explicit BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget);
+  explicit BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidgetProxy *aWidget);
 
 protected:
   virtual ~BasicCompositor();
 
 public:
 
   virtual BasicCompositor* AsBasicCompositor() override { return this; }
 
--- a/gfx/layers/basic/X11BasicCompositor.h
+++ b/gfx/layers/basic/X11BasicCompositor.h
@@ -41,17 +41,17 @@ public:
 private:
   // We are going to buffer layer content on this xlib draw target
   RefPtr<mozilla::gfx::DrawTarget> mBufferDrawTarget;
 };
 
 class X11BasicCompositor : public BasicCompositor
 {
 public:
-  explicit X11BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
+  explicit X11BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidgetProxy* aWidget)
     : BasicCompositor(aParent, aWidget)
   {}
 
   virtual already_AddRefed<DataTextureSource>
   CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) override;
 
   virtual already_AddRefed<DataTextureSource>
   CreateDataTextureSourceAround(gfx::DataSourceSurface* aSurface) override { return nullptr; }
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -17,17 +17,17 @@
 #include "mozilla/layers/Effects.h"
 #include "nsWindowsHelpers.h"
 #include "gfxPrefs.h"
 #include "gfxConfig.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxVR.h"
 #include "mozilla/gfx/StackArray.h"
 #include "mozilla/Services.h"
-#include "mozilla/widget/WinCompositorWidget.h"
+#include "mozilla/widget/WinCompositorWidgetProxy.h"
 
 #include "mozilla/EnumeratedArray.h"
 #include "mozilla/Telemetry.h"
 #include "BlendShaderConstants.h"
 
 #include <dxgi1_2.h>
 
 namespace mozilla {
@@ -155,17 +155,17 @@ private:
     return true;
   }
 
   // Only used during initialization.
   RefPtr<ID3D11Device> mDevice;
   bool mInitOkay;
 };
 
-CompositorD3D11::CompositorD3D11(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
+CompositorD3D11::CompositorD3D11(CompositorBridgeParent* aParent, widget::CompositorWidgetProxy* aWidget)
   : Compositor(aWidget, aParent)
   , mAttachments(nullptr)
   , mHwnd(nullptr)
   , mDisableSequenceForNextFrame(false)
   , mVerifyBuffersFailed(false)
 {
 }
 
@@ -211,17 +211,17 @@ CompositorD3D11::Initialize()
 
   if (!mContext) {
     gfxCriticalNote << "[D3D11] failed to get immediate context";
     return false;
   }
 
   mFeatureLevel = mDevice->GetFeatureLevel();
 
-  mHwnd = mWidget->AsWindows()->GetHwnd();
+  mHwnd = mWidget->AsWindowsProxy()->GetHwnd();
 
   memset(&mVSConstants, 0, sizeof(VertexShaderConstants));
 
   int referenceCount = 0;
   UINT size = sizeof(referenceCount);
   // If this isn't there yet it'll fail, count will remain 0, which is correct.
   mDevice->GetPrivateData(sLayerManagerCount, &size, &referenceCount);
   referenceCount++;
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -37,17 +37,17 @@ struct PixelShaderConstants
   int blendConfig[4];
 };
 
 struct DeviceAttachmentsD3D11;
 
 class CompositorD3D11 : public Compositor
 {
 public:
-  CompositorD3D11(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget);
+  CompositorD3D11(CompositorBridgeParent* aParent, widget::CompositorWidgetProxy* aWidget);
   ~CompositorD3D11();
 
   virtual CompositorD3D11* AsCompositorD3D11() override { return this; }
 
   virtual bool Initialize() override;
 
   virtual TextureFactoryIdentifier
     GetTextureFactoryIdentifier() override;
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -12,24 +12,24 @@
 #include "mozilla/layers/Effects.h"
 #include "nsWindowsHelpers.h"
 #include "Nv3DVUtils.h"
 #include "gfxFailure.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "gfxPrefs.h"
 #include "gfxCrashReporterUtils.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
-#include "mozilla/widget/WinCompositorWidget.h"
+#include "mozilla/widget/WinCompositorWidgetProxy.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 
-CompositorD3D9::CompositorD3D9(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
+CompositorD3D9::CompositorD3D9(CompositorBridgeParent* aParent, widget::CompositorWidgetProxy* aWidget)
   : Compositor(aWidget, aParent)
   , mDeviceResetCount(0)
   , mFailedResetAttempts(0)
 {
 }
 
 CompositorD3D9::~CompositorD3D9()
 {
@@ -42,17 +42,17 @@ CompositorD3D9::Initialize()
 {
   ScopedGfxFeatureReporter reporter("D3D9 Layers");
 
   mDeviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
   if (!mDeviceManager) {
     return false;
   }
 
-  mSwapChain = mDeviceManager->CreateSwapChain(mWidget->AsWindows()->GetHwnd());
+  mSwapChain = mDeviceManager->CreateSwapChain(mWidget->AsWindowsProxy()->GetHwnd());
   if (!mSwapChain) {
     return false;
   }
 
   if (!mWidget->InitCompositor(this)) {
     return false;
   }
 
@@ -585,17 +585,17 @@ CompositorD3D9::SetMask(const EffectChai
  */
 
 bool
 CompositorD3D9::EnsureSwapChain()
 {
   MOZ_ASSERT(mDeviceManager, "Don't call EnsureSwapChain without a device manager");
 
   if (!mSwapChain) {
-    mSwapChain = mDeviceManager->CreateSwapChain(mWidget->AsWindows()->GetHwnd());
+    mSwapChain = mDeviceManager->CreateSwapChain(mWidget->AsWindowsProxy()->GetHwnd());
     // We could not create a swap chain, return false
     if (!mSwapChain) {
       // Check the state of the device too
       DeviceManagerState state = mDeviceManager->VerifyReadyForRendering();
       if (state == DeviceMustRecreate) {
         mDeviceManager = nullptr;
       }
       mParent->InvalidateRemoteLayers();
--- a/gfx/layers/d3d9/CompositorD3D9.h
+++ b/gfx/layers/d3d9/CompositorD3D9.h
@@ -16,17 +16,17 @@
 class nsWidget;
 
 namespace mozilla {
 namespace layers {
 
 class CompositorD3D9 : public Compositor
 {
 public:
-  CompositorD3D9(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget);
+  CompositorD3D9(CompositorBridgeParent* aParent, widget::CompositorWidgetProxy* aWidget);
   ~CompositorD3D9();
 
   virtual CompositorD3D9* AsCompositorD3D9() override { return this; }
 
   virtual bool Initialize() override;
 
   virtual TextureFactoryIdentifier
     GetTextureFactoryIdentifier() override;
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -24,20 +24,16 @@
 #include "nsXULAppAPI.h"                // for XRE_GetIOMessageLoop, etc
 #include "FrameLayerBuilder.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/unused.h"
 #include "mozilla/DebugOnly.h"
 #if defined(XP_WIN)
 #include "WinUtils.h"
 #endif
-#include "mozilla/widget/CompositorWidget.h"
-#ifdef MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING
-# include "mozilla/widget/CompositorWidgetChild.h"
-#endif
 
 using mozilla::layers::LayerTransactionChild;
 using mozilla::dom::TabChildBase;
 using mozilla::Unused;
 
 namespace mozilla {
 namespace layers {
 
@@ -952,36 +948,11 @@ CompositorBridgeChild::AllocShmem(size_t
 }
 
 void
 CompositorBridgeChild::DeallocShmem(ipc::Shmem& aShmem)
 {
     PCompositorBridgeChild::DeallocShmem(aShmem);
 }
 
-widget::PCompositorWidgetChild*
-CompositorBridgeChild::AllocPCompositorWidgetChild(const CompositorWidgetInitData& aInitData)
-{
-  // We send the constructor manually.
-  MOZ_CRASH("Should not be called");
-  return nullptr;
-}
-
-bool
-CompositorBridgeChild::DeallocPCompositorWidgetChild(PCompositorWidgetChild* aActor)
-{
-#ifdef MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING
-  delete aActor;
-  return true;
-#else
-  return false;
-#endif
-}
-
-void
-CompositorBridgeChild::ProcessingError(Result aCode, const char* aReason)
-{
-  MOZ_CRASH("Processing error in CompositorBridgeChild");
-}
-
 } // namespace layers
 } // namespace mozilla
 
--- a/gfx/layers/ipc/CompositorBridgeChild.h
+++ b/gfx/layers/ipc/CompositorBridgeChild.h
@@ -188,23 +188,18 @@ public:
   virtual bool AllocUnsafeShmem(size_t aSize,
                                 mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
                                 mozilla::ipc::Shmem* aShmem) override;
   virtual bool AllocShmem(size_t aSize,
                           mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
                           mozilla::ipc::Shmem* aShmem) override;
   virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) override;
 
-  PCompositorWidgetChild* AllocPCompositorWidgetChild(const CompositorWidgetInitData& aInitData) override;
-  bool DeallocPCompositorWidgetChild(PCompositorWidgetChild* aActor) override;
-
   virtual ShmemAllocator* AsShmemAllocator() override { return this; }
 
-  void ProcessingError(Result aCode, const char* aReason) override;
-
 private:
   // Private destructor, to discourage deletion outside of Release():
   virtual ~CompositorBridgeChild();
 
   virtual PLayerTransactionChild*
     AllocPLayerTransactionChild(const nsTArray<LayersBackend>& aBackendHints,
                                 const uint64_t& aId,
                                 TextureFactoryIdentifier* aTextureFactoryIdentifier,
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -71,20 +71,16 @@
 #include "mozilla/unused.h"
 #include "mozilla/Hal.h"
 #include "mozilla/HalTypes.h"
 #include "mozilla/StaticPtr.h"
 #ifdef MOZ_ENABLE_PROFILER_SPS
 #include "ProfilerMarkers.h"
 #endif
 #include "mozilla/VsyncDispatcher.h"
-#include "mozilla/widget/CompositorWidget.h"
-#ifdef MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING
-# include "mozilla/widget/CompositorWidgetParent.h"
-#endif
 
 #ifdef MOZ_WIDGET_GONK
 #include "GeckoTouchDispatcher.h"
 #include "nsScreenManagerGonk.h"
 #endif
 
 #ifdef MOZ_ANDROID_APZ
 #include "AndroidBridge.h"
@@ -232,23 +228,23 @@ CompositorVsyncScheduler::Observer::Noti
 void
 CompositorVsyncScheduler::Observer::Destroy()
 {
   MutexAutoLock lock(mMutex);
   mOwner = nullptr;
 }
 
 CompositorVsyncScheduler::CompositorVsyncScheduler(CompositorBridgeParent* aCompositorBridgeParent,
-                                                   widget::CompositorWidget* aWidget)
+                                                   widget::CompositorWidgetProxy* aWidgetProxy)
   : mCompositorBridgeParent(aCompositorBridgeParent)
   , mLastCompose(TimeStamp::Now())
   , mIsObservingVsync(false)
   , mNeedsComposite(0)
   , mVsyncNotificationsSkipped(0)
-  , mCompositorVsyncDispatcher(aWidget->GetCompositorVsyncDispatcher())
+  , mCompositorVsyncDispatcher(aWidgetProxy->GetCompositorVsyncDispatcher())
   , mCurrentCompositeTaskMonitor("CurrentCompositeTaskMonitor")
   , mCurrentCompositeTask(nullptr)
   , mSetNeedsCompositeMonitor("SetNeedsCompositeMonitor")
   , mSetNeedsCompositeTask(nullptr)
 #ifdef MOZ_WIDGET_GONK
 #if ANDROID_VERSION >= 19
   , mDisplayEnabled(false)
   , mSetDisplayMonitor("SetDisplayMonitor")
@@ -581,23 +577,23 @@ CompositorVsyncScheduler::ComposeToTarge
 }
 
 static inline MessageLoop*
 CompositorLoop()
 {
   return CompositorThreadHolder::Loop();
 }
 
-CompositorBridgeParent::CompositorBridgeParent(widget::CompositorWidget* aWidget,
+CompositorBridgeParent::CompositorBridgeParent(widget::CompositorWidgetProxy* aWidget,
                                                CSSToLayoutDeviceScale aScale,
                                                bool aUseAPZ,
                                                bool aUseExternalSurfaceSize,
                                                const gfx::IntSize& aSurfaceSize)
   : CompositorBridgeParentIPCAllocator("CompositorBridgeParent")
-  , mWidget(aWidget)
+  , mWidgetProxy(aWidget)
   , mIsTesting(false)
   , mPendingTransaction(0)
   , mPaused(false)
   , mUseExternalSurfaceSize(aUseExternalSurfaceSize)
   , mEGLSurfaceSize(aSurfaceSize)
   , mPauseCompositionMonitor("PauseCompositionMonitor")
   , mResumeCompositionMonitor("ResumeCompositionMonitor")
   , mResetCompositorMonitor("ResetCompositorMonitor")
@@ -698,17 +694,17 @@ CompositorBridgeParent::StopAndClearReso
 
   if (mCompositor) {
     mCompositor->DetachWidget();
     mCompositor->Destroy();
     mCompositor = nullptr;
   }
 
   // After this point, it is no longer legal to access the widget.
-  mWidget = nullptr;
+  mWidgetProxy = nullptr;
 }
 
 bool
 CompositorBridgeParent::RecvWillClose()
 {
   StopAndClearResources();
   return true;
 }
@@ -1148,17 +1144,17 @@ CompositorBridgeParent::CompositeToTarge
                                &hasRemoteContent,
                                &updatePluginsFlag);
 
 #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
   // We do not support plugins in local content. When switching tabs
   // to local pages, hide every plugin associated with the window.
   if (!hasRemoteContent && BrowserTabsRemoteAutostart() &&
       mCachedPluginData.Length()) {
-    Unused << SendHideAllPlugins(GetWidget()->GetWidgetKey());
+    Unused << SendHideAllPlugins(GetWidgetProxy()->GetWidgetKey());
     mCachedPluginData.Clear();
   }
 #endif
 
   if (aTarget) {
     mLayerManager->BeginTransactionWithDrawTarget(aTarget, *aRect);
   } else {
     mLayerManager->BeginTransaction();
@@ -1494,34 +1490,34 @@ CompositorBridgeParent::InitializeLayerM
 
 RefPtr<Compositor>
 CompositorBridgeParent::NewCompositor(const nsTArray<LayersBackend>& aBackendHints)
 {
   for (size_t i = 0; i < aBackendHints.Length(); ++i) {
     RefPtr<Compositor> compositor;
     if (aBackendHints[i] == LayersBackend::LAYERS_OPENGL) {
       compositor = new CompositorOGL(this,
-                                     mWidget,
+                                     mWidgetProxy,
                                      mEGLSurfaceSize.width,
                                      mEGLSurfaceSize.height,
                                      mUseExternalSurfaceSize);
     } else if (aBackendHints[i] == LayersBackend::LAYERS_BASIC) {
 #ifdef MOZ_WIDGET_GTK
       if (gfxPlatformGtk::GetPlatform()->UseXRender()) {
-        compositor = new X11BasicCompositor(this, mWidget);
+        compositor = new X11BasicCompositor(this, mWidgetProxy);
       } else
 #endif
       {
-        compositor = new BasicCompositor(this, mWidget);
+        compositor = new BasicCompositor(this, mWidgetProxy);
       }
 #ifdef XP_WIN
     } else if (aBackendHints[i] == LayersBackend::LAYERS_D3D11) {
-      compositor = new CompositorD3D11(this, mWidget);
+      compositor = new CompositorD3D11(this, mWidgetProxy);
     } else if (aBackendHints[i] == LayersBackend::LAYERS_D3D9) {
-      compositor = new CompositorD3D9(this, mWidget);
+      compositor = new CompositorD3D9(this, mWidgetProxy);
 #endif
     }
 
     if (compositor && compositor->Initialize()) {
       compositor->SetCompositorID(mCompositorID);
       return compositor;
     }
   }
@@ -1802,48 +1798,16 @@ CompositorBridgeParent::RequestNotifyLay
 /* static */ void
 CompositorBridgeParent::RequestNotifyLayerTreeCleared(uint64_t aLayersId, CompositorUpdateObserver* aObserver)
 {
   EnsureLayerTreeMapReady();
   MonitorAutoLock lock(*sIndirectLayerTreesLock);
   sIndirectLayerTrees[aLayersId].mLayerTreeClearedObserver = aObserver;
 }
 
-widget::PCompositorWidgetParent*
-CompositorBridgeParent::AllocPCompositorWidgetParent(const CompositorWidgetInitData& aInitData)
-{
-#if defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
-  if (mWidget) {
-    // Should not create two widgets on the same compositor.
-    return nullptr;
-  }
-
-  widget::CompositorWidgetParent* widget =
-    new widget::CompositorWidgetParent(aInitData);
-  widget->AddRef();
-
-  // Sending the constructor acts as initialization as well.
-  mWidget = widget;
-  return widget;
-#else
-  return nullptr;
-#endif
-}
-
-bool
-CompositorBridgeParent::DeallocPCompositorWidgetParent(PCompositorWidgetParent* aActor)
-{
-#if defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
-  static_cast<widget::CompositorWidgetParent*>(aActor)->Release();
-  return true;
-#else
-  return false;
-#endif
-}
-
 /**
  * This class handles layer updates pushed directly from child processes to
  * the compositor thread. It's associated with a CompositorBridgeParent on the
  * compositor thread. While it uses the PCompositorBridge protocol to manage
  * these updates, it doesn't actually drive compositing itself. For that it
  * hands off work to the CompositorBridgeParent it's associated with.
  */
 class CrossProcessCompositorBridgeParent final : public PCompositorBridgeParent,
@@ -2013,25 +1977,16 @@ public:
     return OtherPid();
   }
 
   virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override
   {
     Unused << SendParentAsyncMessages(aMessage);
   }
 
-  PCompositorWidgetParent* AllocPCompositorWidgetParent(const CompositorWidgetInitData& aInitData) override {
-    // Not allowed.
-    return nullptr;
-  }
-  bool DeallocPCompositorWidgetParent(PCompositorWidgetParent* aActor) override {
-    // Not allowed.
-    return false;
-  }
-
   virtual CompositorBridgeParentIPCAllocator* AsCompositorBridgeParentIPCAllocator() override { return this; }
 
 protected:
   void OnChannelConnected(int32_t pid) override {
     mCompositorThreadHolder = CompositorThreadHolder::GetSingleton();
   }
 private:
   // Private destructor, to discourage deletion outside of Release():
@@ -2505,17 +2460,17 @@ CompositorBridgeParent::UpdatePluginWind
 
   if (!lts.mPluginData.Length()) {
     // Don't hide plugins if the previous remote layer tree didn't contain any.
     if (!mCachedPluginData.Length()) {
       PLUGINS_LOG("[%" PRIu64 "] nothing to hide", aId);
       return false;
     }
 
-    uintptr_t parentWidget = GetWidget()->GetWidgetKey();
+    uintptr_t parentWidget = GetWidgetProxy()->GetWidgetKey();
 
     // We will pass through here in cases where the previous shadow layer
     // tree contained visible plugins and the new tree does not. All we need
     // to do here is hide the plugins for the old tree, so don't waste time
     // calculating clipping.
     mPluginsLayerOffset = nsIntPoint(0,0);
     mPluginsLayerVisibleRegion.SetEmpty();
     Unused << lts.mParent->SendHideAllPlugins(parentWidget);
@@ -2590,17 +2545,17 @@ CompositorBridgeParent::HideAllPluginWin
 {
   MOZ_ASSERT(!NS_IsMainThread());
   // No plugins in the cache implies no plugins to manage
   // in this content.
   if (!mCachedPluginData.Length() || mDeferPluginWindows) {
     return;
   }
 
-  uintptr_t parentWidget = GetWidget()->GetWidgetKey();
+  uintptr_t parentWidget = GetWidgetProxy()->GetWidgetKey();
 
   mDeferPluginWindows = true;
   mPluginWindowsHidden = true;
   Unused << SendHideAllPlugins(parentWidget);
   ScheduleComposition();
 }
 #endif // #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
 
--- a/gfx/layers/ipc/CompositorBridgeParent.h
+++ b/gfx/layers/ipc/CompositorBridgeParent.h
@@ -28,20 +28,20 @@
 #include "mozilla/ipc/ProtocolUtils.h"
 #include "mozilla/ipc/SharedMemory.h"
 #include "mozilla/layers/GeckoContentController.h"
 #include "mozilla/layers/ISurfaceAllocator.h" // for ShmemAllocator
 #include "mozilla/layers/LayersMessages.h"  // for TargetConfig
 #include "mozilla/layers/PCompositorBridgeParent.h"
 #include "mozilla/layers/ShadowLayersManager.h" // for ShadowLayersManager
 #include "mozilla/layers/APZTestData.h"
-#include "mozilla/widget/CompositorWidget.h"
 #include "nsISupportsImpl.h"
 #include "ThreadSafeRefcountingWithMainThreadDestruction.h"
 #include "mozilla/VsyncDispatcher.h"
+#include "CompositorWidgetProxy.h"
 
 class MessageLoop;
 class nsIWidget;
 
 namespace mozilla {
 
 class CancelableRunnable;
 
@@ -85,17 +85,17 @@ private:
  * Turns vsync notifications into scheduled composites.
  **/
 class CompositorVsyncScheduler
 {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorVsyncScheduler)
 
 public:
   explicit CompositorVsyncScheduler(CompositorBridgeParent* aCompositorBridgeParent,
-                                    widget::CompositorWidget* aWidget);
+                                    widget::CompositorWidgetProxy* aWidgetProxy);
 
 #ifdef MOZ_WIDGET_GONK
   // emulator-ics never trigger the display on/off, so compositor will always
   // skip composition request at that device. Only check the display status
   // with kk device and upon.
 #if ANDROID_VERSION >= 19
   // SetDisplay() and CancelSetDisplayTask() are used for the display on/off.
   // It will clear all composition related task and flag, and skip another
@@ -207,17 +207,17 @@ class CompositorBridgeParent final : pub
                                      public ShmemAllocator
 {
   friend class CompositorVsyncScheduler;
   friend class CompositorThreadHolder;
   friend class InProcessCompositorSession;
   friend class gfx::GPUProcessManager;
 
 public:
-  explicit CompositorBridgeParent(widget::CompositorWidget* aWidget,
+  explicit CompositorBridgeParent(widget::CompositorWidgetProxy* aWidget,
                                   CSSToLayoutDeviceScale aScale,
                                   bool aUseAPZ,
                                   bool aUseExternalSurfaceSize,
                                   const gfx::IntSize& aSurfaceSize);
 
   virtual bool RecvGetFrameUniformity(FrameUniformityData* aOutData) override;
   virtual bool RecvRequestOverfill() override;
   virtual bool RecvWillClose() override;
@@ -300,19 +300,16 @@ public:
                           mozilla::ipc::Shmem* aShmem) override;
 
   virtual bool AllocUnsafeShmem(size_t aSize,
                                 mozilla::ipc::SharedMemory::SharedMemoryType aType,
                                 mozilla::ipc::Shmem* aShmem) override;
 
   virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) override;
 
-  PCompositorWidgetParent* AllocPCompositorWidgetParent(const CompositorWidgetInitData& aInitData) override;
-  bool DeallocPCompositorWidgetParent(PCompositorWidgetParent* aActor) override;
-
   virtual base::ProcessId GetChildProcessId() override
   {
     return OtherPid();
   }
 
   virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override;
 
   virtual CompositorBridgeParentIPCAllocator* AsCompositorBridgeParentIPCAllocator() override { return this; }
@@ -462,17 +459,17 @@ public:
 
   /**
    * Used by the profiler to denote when a vsync occured
    */
   static void PostInsertVsyncProfilerMarker(mozilla::TimeStamp aVsyncTimestamp);
 
   float ComputeRenderIntegrity();
 
-  widget::CompositorWidget* GetWidget() { return mWidget; }
+  widget::CompositorWidgetProxy* GetWidgetProxy() { return mWidgetProxy; }
 
   void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr);
 
   bool AsyncPanZoomEnabled() const {
     return !!mApzcTreeManager;
   }
 
 private:
@@ -584,17 +581,17 @@ protected:
   // The indirect layer tree lock must be held before calling this function.
   // Callback should take (LayerTreeState* aState, const uint64_t& aLayersId)
   template <typename Lambda>
   inline void ForEachIndirectLayerTree(const Lambda& aCallback);
 
   RefPtr<LayerManagerComposite> mLayerManager;
   RefPtr<Compositor> mCompositor;
   RefPtr<AsyncCompositionManager> mCompositionManager;
-  widget::CompositorWidget* mWidget;
+  widget::CompositorWidgetProxy* mWidgetProxy;
   TimeStamp mTestTime;
   bool mIsTesting;
 
   uint64_t mPendingTransaction;
 
   bool mPaused;
 
   bool mUseExternalSurfaceSize;
--- a/gfx/layers/ipc/PCompositorBridge.ipdl
+++ b/gfx/layers/ipc/PCompositorBridge.ipdl
@@ -2,20 +2,18 @@
  * vim: sw=2 ts=8 et :
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include LayersSurfaces;
 include LayersMessages;
-include PlatformWidgetTypes;
 include protocol PBrowser;
 include protocol PCompositable;
-include protocol PCompositorWidget;
 include protocol PImageContainer;
 include protocol PLayer;
 include protocol PLayerTransaction;
 include protocol PTexture;
 include "mozilla/GfxMessageUtils.h";
 
 using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
 using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
@@ -44,17 +42,16 @@ namespace layers {
  * the main thread and the compositor thread context. It's primary
  * purpose is to manage the PLayerTransaction sub protocol.
  */
 sync protocol PCompositorBridge
 {
   // A Compositor manages a single Layer Manager (PLayerTransaction)
   manages PLayerTransaction;
   manages PTexture;
-  manages PCompositorWidget;
 
 child:
   // The child should invalidate retained layers. This is used for local
   // compositor device resets, such as in CompositorD3D9, and ensures that
   // TextureSources are recreated.
   async InvalidateLayers(uint64_t layersId);
 
   // The compositor type or device has changed, and a new texture factory
@@ -101,18 +98,16 @@ child:
    * Drop any buffers that might be retained on the child compositor
    * side.
    */
   async ClearCachedResources(uint64_t id);
 
   async ParentAsyncMessages(AsyncParentMessageData[] aMessages);
 
 parent:
-  async PCompositorWidget(CompositorWidgetInitData aInitData);
-
   /**
    * Confirmation callback for UpdatePluginConfigurations and HideAllPlugins.
    */
   async RemotePluginsReady();
 
   // Confirmation that the child has invalidated all its layers, and will not
   // request layers against an old compositor.
   async AcknowledgeCompositorUpdate(uint64_t id);
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -79,17 +79,17 @@ CompositorOGL::BindBackdrop(ShaderProgra
   mGLContext->fActiveTexture(aTexUnit);
   mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, aBackdrop);
   mGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
   mGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
   aProgram->SetBackdropTextureUnit(aTexUnit - LOCAL_GL_TEXTURE0);
 }
 
 CompositorOGL::CompositorOGL(CompositorBridgeParent* aParent,
-                             widget::CompositorWidget* aWidget,
+                             widget::CompositorWidgetProxy* aWidget,
                              int aSurfaceWidth, int aSurfaceHeight,
                              bool aUseExternalSurfaceSize)
   : Compositor(aWidget, aParent)
   , mWidgetSize(-1, -1)
   , mSurfaceSize(aSurfaceWidth, aSurfaceHeight)
   , mHasBGRA(0)
   , mUseExternalSurfaceSize(aUseExternalSurfaceSize)
   , mFrameInProgress(false)
@@ -613,17 +613,17 @@ CompositingRenderTarget*
 CompositorOGL::GetCurrentRenderTarget() const
 {
   return mCurrentRenderTarget;
 }
 
 static GLenum
 GetFrameBufferInternalFormat(GLContext* gl,
                              GLuint aFrameBuffer,
-                             mozilla::widget::CompositorWidget* aWidget)
+                             mozilla::widget::CompositorWidgetProxy* aWidget)
 {
   if (aFrameBuffer == 0) { // default framebuffer
     return aWidget->GetGLFrameBufferFormat();
   }
   return LOCAL_GL_RGBA;
 }
 
 void
--- a/gfx/layers/opengl/CompositorOGL.h
+++ b/gfx/layers/opengl/CompositorOGL.h
@@ -188,17 +188,17 @@ class CompositorOGL final : public Compo
   typedef mozilla::gl::GLContext GLContext;
 
   friend class GLManagerCompositor;
   friend class CompositingRenderTargetOGL;
 
   std::map<ShaderConfigOGL, ShaderProgramOGL*> mPrograms;
 public:
   explicit CompositorOGL(CompositorBridgeParent* aParent,
-                         widget::CompositorWidget* aWidget,
+                         widget::CompositorWidgetProxy* aWidget,
                          int aSurfaceWidth = -1, int aSurfaceHeight = -1,
                          bool aUseExternalSurfaceSize = false);
 
 protected:
   virtual ~CompositorOGL();
 
 public:
   virtual CompositorOGL* AsCompositorOGL() override { return this; }
--- a/gfx/tests/gtest/TestCompositor.cpp
+++ b/gfx/tests/gtest/TestCompositor.cpp
@@ -10,17 +10,16 @@
 #include "TestLayers.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/layers/BasicCompositor.h"  // for BasicCompositor
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/CompositorOGL.h"  // for CompositorOGL
 #include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/layers/LayerManagerComposite.h"
-#include "mozilla/widget/InProcessCompositorWidget.h"
 #include "nsBaseWidget.h"
 #include "GLContext.h"
 #include "GLContextProvider.h"
 #include <vector>
 
 const int gCompWidth = 256;
 const int gCompHeight = 256;
 
@@ -95,31 +94,31 @@ private:
   ~MockWidget() {}
 };
 
 NS_IMPL_ISUPPORTS_INHERITED0(MockWidget, nsBaseWidget)
 
 struct LayerManagerData {
   RefPtr<MockWidget> mWidget;
   RefPtr<Compositor> mCompositor;
-  RefPtr<widget::CompositorWidget> mCompositorWidget;
+  RefPtr<widget::CompositorWidgetProxy> mCompositorWidgetProxy;
   RefPtr<LayerManagerComposite> mLayerManager;
 
   LayerManagerData(Compositor* compositor,
                    MockWidget* widget,
-                   widget::CompositorWidget* aWidget,
+                   widget::CompositorWidgetProxy* aProxy,
                    LayerManagerComposite* layerManager)
     : mWidget(widget)
     , mCompositor(compositor)
-    , mCompositorWidget(aWidget)
+    , mCompositorWidgetProxy(aProxy)
     , mLayerManager(layerManager)
   {}
 };
 
-static already_AddRefed<Compositor> CreateTestCompositor(LayersBackend backend, widget::CompositorWidget* widget)
+static already_AddRefed<Compositor> CreateTestCompositor(LayersBackend backend, widget::CompositorWidgetProxy* widget)
 {
   gfxPrefs::GetSingleton();
 
   RefPtr<Compositor> compositor;
 
   if (backend == LayersBackend::LAYERS_OPENGL) {
     compositor = new CompositorOGL(nullptr,
                                    widget,
@@ -153,17 +152,17 @@ static already_AddRefed<Compositor> Crea
 static std::vector<LayerManagerData> GetLayerManagers(std::vector<LayersBackend> aBackends)
 {
   std::vector<LayerManagerData> managers;
 
   for (size_t i = 0; i < aBackends.size(); i++) {
     auto backend = aBackends[i];
 
     RefPtr<MockWidget> widget = new MockWidget();
-    RefPtr<widget::CompositorWidget> proxy = new widget::InProcessCompositorWidget(widget);
+    RefPtr<widget::CompositorWidgetProxy> proxy = widget->NewCompositorWidgetProxy();
     RefPtr<Compositor> compositor = CreateTestCompositor(backend, proxy);
 
     RefPtr<LayerManagerComposite> layerManager = new LayerManagerComposite(compositor);
 
     managers.push_back(LayerManagerData(compositor, widget, proxy, layerManager));
   }
 
   return managers;
rename from widget/CompositorWidget.cpp
rename to widget/CompositorWidgetProxy.cpp
--- a/widget/CompositorWidget.cpp
+++ b/widget/CompositorWidgetProxy.cpp
@@ -1,40 +1,40 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "CompositorWidget.h"
+#include "CompositorWidgetProxy.h"
 #include "GLConsts.h"
 #include "nsBaseWidget.h"
 #include "VsyncDispatcher.h"
 
 namespace mozilla {
 namespace widget {
 
-CompositorWidget::~CompositorWidget()
+CompositorWidgetProxy::~CompositorWidgetProxy()
 {
 }
 
 already_AddRefed<gfx::DrawTarget>
-CompositorWidget::StartRemoteDrawing()
+CompositorWidgetProxy::StartRemoteDrawing()
 {
   return nullptr;
 }
 
 void
-CompositorWidget::CleanupRemoteDrawing()
+CompositorWidgetProxy::CleanupRemoteDrawing()
 {
   mLastBackBuffer = nullptr;
 }
 
 already_AddRefed<gfx::DrawTarget>
-CompositorWidget::GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
-                                          const LayoutDeviceIntRect& aRect,
-                                          const LayoutDeviceIntRect& aClearRect)
+CompositorWidgetProxy::GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
+                                               const LayoutDeviceIntRect& aRect,
+                                               const LayoutDeviceIntRect& aClearRect)
 {
   MOZ_ASSERT(aScreenTarget);
   gfx::SurfaceFormat format =
     aScreenTarget->GetFormat() == gfx::SurfaceFormat::B8G8R8X8 ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::B8G8R8A8;
   gfx::IntSize size = aRect.ToUnknownRect().Size();
   gfx::IntSize clientSize(GetClientSize().ToUnknownSize());
 
   RefPtr<gfx::DrawTarget> target;
@@ -53,22 +53,134 @@ CompositorWidget::GetBackBufferDrawTarge
   } else {
     target = aScreenTarget->CreateSimilarDrawTarget(size, format);
     mLastBackBuffer = target;
   }
   return target.forget();
 }
 
 already_AddRefed<gfx::SourceSurface>
-CompositorWidget::EndBackBufferDrawing()
+CompositorWidgetProxy::EndBackBufferDrawing()
 {
   RefPtr<gfx::SourceSurface> surface = mLastBackBuffer ? mLastBackBuffer->Snapshot() : nullptr;
   return surface.forget();
 }
 
 uint32_t
-CompositorWidget::GetGLFrameBufferFormat()
+CompositorWidgetProxy::GetGLFrameBufferFormat()
 {
   return LOCAL_GL_RGBA;
 }
 
+CompositorWidgetProxyWrapper::CompositorWidgetProxyWrapper(nsBaseWidget* aWidget)
+ : mWidget(aWidget)
+{
+}
+
+bool
+CompositorWidgetProxyWrapper::PreRender(layers::LayerManagerComposite* aManager)
+{
+  return mWidget->PreRender(aManager);
+}
+
+void
+CompositorWidgetProxyWrapper::PostRender(layers::LayerManagerComposite* aManager)
+{
+  mWidget->PostRender(aManager);
+}
+
+void
+CompositorWidgetProxyWrapper::DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
+                                                 LayoutDeviceIntRect aRect)
+{
+  mWidget->DrawWindowUnderlay(aManager, aRect);
+}
+
+void
+CompositorWidgetProxyWrapper::DrawWindowOverlay(layers::LayerManagerComposite* aManager,
+                                                LayoutDeviceIntRect aRect)
+{
+  mWidget->DrawWindowOverlay(aManager, aRect);
+}
+
+already_AddRefed<gfx::DrawTarget>
+CompositorWidgetProxyWrapper::StartRemoteDrawing()
+{
+  return mWidget->StartRemoteDrawing();
+}
+
+already_AddRefed<gfx::DrawTarget>
+CompositorWidgetProxyWrapper::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
+                                                         layers::BufferMode* aBufferMode)
+{
+  return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
+}
+
+void
+CompositorWidgetProxyWrapper::EndRemoteDrawing()
+{
+  mWidget->EndRemoteDrawing();
+}
+
+void
+CompositorWidgetProxyWrapper::EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
+                                                       LayoutDeviceIntRegion& aInvalidRegion)
+{
+  mWidget->EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
+}
+
+void
+CompositorWidgetProxyWrapper::CleanupRemoteDrawing()
+{
+  mWidget->CleanupRemoteDrawing();
+}
+
+void
+CompositorWidgetProxyWrapper::CleanupWindowEffects()
+{
+  mWidget->CleanupWindowEffects();
+}
+
+bool
+CompositorWidgetProxyWrapper::InitCompositor(layers::Compositor* aCompositor)
+{
+  return mWidget->InitCompositor(aCompositor);
+}
+
+LayoutDeviceIntSize
+CompositorWidgetProxyWrapper::GetClientSize()
+{
+  return mWidget->GetClientSize();
+}
+
+uint32_t
+CompositorWidgetProxyWrapper::GetGLFrameBufferFormat()
+{
+  return mWidget->GetGLFrameBufferFormat();
+}
+
+layers::Composer2D*
+CompositorWidgetProxyWrapper::GetComposer2D()
+{
+  return mWidget->GetComposer2D();
+}
+
+uintptr_t
+CompositorWidgetProxyWrapper::GetWidgetKey()
+{
+  return reinterpret_cast<uintptr_t>(mWidget);
+}
+
+nsIWidget*
+CompositorWidgetProxyWrapper::RealWidget()
+{
+  return mWidget;
+}
+
+already_AddRefed<CompositorVsyncDispatcher>
+CompositorWidgetProxyWrapper::GetCompositorVsyncDispatcher()
+{
+  RefPtr<CompositorVsyncDispatcher> cvd = mWidget->GetCompositorVsyncDispatcher();
+  return cvd.forget();
+}
+
 } // namespace widget
 } // namespace mozilla
rename from widget/CompositorWidget.h
rename to widget/CompositorWidgetProxy.h
--- a/widget/CompositorWidget.h
+++ b/widget/CompositorWidgetProxy.h
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_widget_CompositorWidget_h__
-#define mozilla_widget_CompositorWidget_h__
+#ifndef mozilla_widget_CompositorWidgetProxy_h__
+#define mozilla_widget_CompositorWidgetProxy_h__
 
 #include "nsISupports.h"
 #include "mozilla/RefPtr.h"
 #include "Units.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/layers/LayersTypes.h"
 
 class nsIWidget;
@@ -23,52 +23,25 @@ class Compositor;
 class Composer2D;
 } // namespace layers
 namespace gfx {
 class DrawTarget;
 class SourceSurface;
 } // namespace gfx
 namespace widget {
 
-class WinCompositorWidget;
-class CompositorWidgetInitData;
-
-// Gecko widgets usually need to communicate with the CompositorWidget with
-// platform-specific messages (for example to update the window size or
-// transparency). This functionality is controlled through a "host". Since
-// this functionality is platform-dependent, it is only forward declared
-// here.
-class CompositorWidgetDelegate;
-
-// Platforms that support out-of-process widgets.
-#if defined(XP_WIN)
-// CompositorWidgetParent should implement CompositorWidget and
-// PCompositorWidgetParent.
-class CompositorWidgetParent;
-
-// CompositorWidgetChild should implement CompositorWidgetDelegate and
-// PCompositorWidgetChild.
-class CompositorWidgetChild;
-
-# define MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING
-#endif
+class WinCompositorWidgetProxy;
 
 /**
  * Access to a widget from the compositor is restricted to these methods.
  */
-class CompositorWidget
+class CompositorWidgetProxy
 {
 public:
-  NS_INLINE_DECL_REFCOUNTING(mozilla::widget::CompositorWidget)
-
-  /**
-   * Create an in-process compositor widget. aWidget may be ignored if the
-   * platform does not require it.
-   */
-  static RefPtr<CompositorWidget> CreateLocal(const CompositorWidgetInitData& aInitData, nsIWidget* aWidget);
+  NS_INLINE_DECL_REFCOUNTING(mozilla::widget::CompositorWidgetProxy)
 
   /**
    * Called before rendering using OMTC. Returns false when the widget is
    * not ready to be rendered (for example while the window is closed).
    *
    * Always called from the compositing thread, which may be the main-thread if
    * OMTC is not enabled.
    */
@@ -222,30 +195,59 @@ public:
    */
   virtual already_AddRefed<gfx::SourceSurface> EndBackBufferDrawing();
 
   /**
    * Return a compositor vsync dispatcher for this widget.
    */
   virtual already_AddRefed<CompositorVsyncDispatcher> GetCompositorVsyncDispatcher() = 0;
 
-  virtual WinCompositorWidget* AsWindows() {
-    return nullptr;
-  }
-
-  /**
-   * Return the platform-specific delegate for the widget, if any.
-   */
-  virtual CompositorWidgetDelegate* AsDelegate() {
+  virtual WinCompositorWidgetProxy* AsWindowsProxy() {
     return nullptr;
   }
 
 protected:
-  virtual ~CompositorWidget();
+  virtual ~CompositorWidgetProxy();
 
   // Back buffer of BasicCompositor
   RefPtr<gfx::DrawTarget> mLastBackBuffer;
 };
 
+// This version of CompositorWidgetProxy implements a wrapper around
+// nsBaseWidget.
+class CompositorWidgetProxyWrapper : public CompositorWidgetProxy
+{
+public:
+  explicit CompositorWidgetProxyWrapper(nsBaseWidget* aWidget);
+
+  virtual bool PreRender(layers::LayerManagerComposite* aManager) override;
+  virtual void PostRender(layers::LayerManagerComposite* aManager) override;
+  virtual void DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
+                                  LayoutDeviceIntRect aRect) override;
+  virtual void DrawWindowOverlay(layers::LayerManagerComposite* aManager,
+                                 LayoutDeviceIntRect aRect) override;
+  virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
+  virtual already_AddRefed<gfx::DrawTarget>
+  StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
+                             layers::BufferMode* aBufferMode) override;
+  virtual void EndRemoteDrawing() override;
+  virtual void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
+                                        LayoutDeviceIntRegion& aInvalidRegion) override;
+  virtual void CleanupRemoteDrawing() override;
+  virtual void CleanupWindowEffects() override;
+  virtual bool InitCompositor(layers::Compositor* aCompositor) override;
+  virtual LayoutDeviceIntSize GetClientSize() override;
+  virtual uint32_t GetGLFrameBufferFormat() override;
+  virtual layers::Composer2D* GetComposer2D() override;
+  virtual already_AddRefed<CompositorVsyncDispatcher> GetCompositorVsyncDispatcher() override;
+  virtual uintptr_t GetWidgetKey() override;
+
+  // If you can override this method, inherit from CompositorWidgetProxy instead.
+  nsIWidget* RealWidget() override;
+
+private:
+  nsBaseWidget* mWidget;
+};
+
 } // namespace widget
 } // namespace mozilla
 
 #endif
deleted file mode 100644
--- a/widget/InProcessCompositorWidget.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "InProcessCompositorWidget.h"
-#include "nsBaseWidget.h"
-
-namespace mozilla {
-namespace widget {
-
-// Platforms with no OOP compositor process support use
-// InProcessCompositorWidget by default.
-#if !defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
-/* static */ RefPtr<CompositorWidget>
-CompositorWidget::CreateLocal(const CompositorWidgetInitData& aInitData, nsIWidget* aWidget)
-{
-  MOZ_ASSERT(aWidget);
-  return new InProcessCompositorWidget(static_cast<nsBaseWidget*>(aWidget));
-}
-#endif
-
-InProcessCompositorWidget::InProcessCompositorWidget(nsBaseWidget* aWidget)
- : mWidget(aWidget)
-{
-}
-
-bool
-InProcessCompositorWidget::PreRender(layers::LayerManagerComposite* aManager)
-{
-  return mWidget->PreRender(aManager);
-}
-
-void
-InProcessCompositorWidget::PostRender(layers::LayerManagerComposite* aManager)
-{
-  mWidget->PostRender(aManager);
-}
-
-void
-InProcessCompositorWidget::DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
-                                          LayoutDeviceIntRect aRect)
-{
-  mWidget->DrawWindowUnderlay(aManager, aRect);
-}
-
-void
-InProcessCompositorWidget::DrawWindowOverlay(layers::LayerManagerComposite* aManager,
-                                         LayoutDeviceIntRect aRect)
-{
-  mWidget->DrawWindowOverlay(aManager, aRect);
-}
-
-already_AddRefed<gfx::DrawTarget>
-InProcessCompositorWidget::StartRemoteDrawing()
-{
-  return mWidget->StartRemoteDrawing();
-}
-
-already_AddRefed<gfx::DrawTarget>
-InProcessCompositorWidget::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
-                                                  layers::BufferMode* aBufferMode)
-{
-  return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
-}
-
-void
-InProcessCompositorWidget::EndRemoteDrawing()
-{
-  mWidget->EndRemoteDrawing();
-}
-
-void
-InProcessCompositorWidget::EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
-                                                LayoutDeviceIntRegion& aInvalidRegion)
-{
-  mWidget->EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
-}
-
-void
-InProcessCompositorWidget::CleanupRemoteDrawing()
-{
-  mWidget->CleanupRemoteDrawing();
-}
-
-void
-InProcessCompositorWidget::CleanupWindowEffects()
-{
-  mWidget->CleanupWindowEffects();
-}
-
-bool
-InProcessCompositorWidget::InitCompositor(layers::Compositor* aCompositor)
-{
-  return mWidget->InitCompositor(aCompositor);
-}
-
-LayoutDeviceIntSize
-InProcessCompositorWidget::GetClientSize()
-{
-  return mWidget->GetClientSize();
-}
-
-uint32_t
-InProcessCompositorWidget::GetGLFrameBufferFormat()
-{
-  return mWidget->GetGLFrameBufferFormat();
-}
-
-layers::Composer2D*
-InProcessCompositorWidget::GetComposer2D()
-{
-  return mWidget->GetComposer2D();
-}
-
-uintptr_t
-InProcessCompositorWidget::GetWidgetKey()
-{
-  return reinterpret_cast<uintptr_t>(mWidget);
-}
-
-nsIWidget*
-InProcessCompositorWidget::RealWidget()
-{
-  return mWidget;
-}
-
-already_AddRefed<CompositorVsyncDispatcher>
-InProcessCompositorWidget::GetCompositorVsyncDispatcher()
-{
-  RefPtr<CompositorVsyncDispatcher> cvd = mWidget->GetCompositorVsyncDispatcher();
-  return cvd.forget();
-}
-
-} // namespace widget
-} // namespace mozilla
-
deleted file mode 100644
--- a/widget/InProcessCompositorWidget.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_widget_InProcessCompositorWidget_h__
-#define mozilla_widget_InProcessCompositorWidget_h__
-
-#include "CompositorWidget.h"
-
-namespace mozilla {
-namespace widget {
-
-// This version of CompositorWidget implements a wrapper around
-// nsBaseWidget.
-class InProcessCompositorWidget : public CompositorWidget
-{
-public:
-  explicit InProcessCompositorWidget(nsBaseWidget* aWidget);
-
-  virtual bool PreRender(layers::LayerManagerComposite* aManager) override;
-  virtual void PostRender(layers::LayerManagerComposite* aManager) override;
-  virtual void DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
-                                  LayoutDeviceIntRect aRect) override;
-  virtual void DrawWindowOverlay(layers::LayerManagerComposite* aManager,
-                                 LayoutDeviceIntRect aRect) override;
-  virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
-  virtual already_AddRefed<gfx::DrawTarget>
-  StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
-                             layers::BufferMode* aBufferMode) override;
-  virtual void EndRemoteDrawing() override;
-  virtual void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
-                                        LayoutDeviceIntRegion& aInvalidRegion) override;
-  virtual void CleanupRemoteDrawing() override;
-  virtual void CleanupWindowEffects() override;
-  virtual bool InitCompositor(layers::Compositor* aCompositor) override;
-  virtual LayoutDeviceIntSize GetClientSize() override;
-  virtual uint32_t GetGLFrameBufferFormat() override;
-  virtual layers::Composer2D* GetComposer2D() override;
-  virtual already_AddRefed<CompositorVsyncDispatcher> GetCompositorVsyncDispatcher() override;
-  virtual uintptr_t GetWidgetKey() override;
-
-  // If you can override this method, inherit from CompositorWidget instead.
-  nsIWidget* RealWidget() override;
-
-private:
-  nsBaseWidget* mWidget;
-};
-
-} // namespace widget
-} // namespace mozilla
-
-#endif
deleted file mode 100644
--- a/widget/PCompositorWidget.ipdl
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=99: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PCompositorBridge;
-
-// This file is a stub, for platforms that do not yet support out-of-process
-// compositing or do not need specialized types to do so.
-
-namespace mozilla {
-namespace widget {
-
-sync protocol PCompositorWidget
-{
-  manager PCompositorBridge;
-
-parent:
-  async __delete__();
-};
-
-} // namespace widget
-} // namespace mozilla
deleted file mode 100644
--- a/widget/PlatformWidgetTypes.ipdlh
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=99: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This file is a stub, for platforms that do not yet support out-of-process
-// compositing or do not need specialized types to do so.
-
-namespace mozilla {
-namespace widget {
-
-struct CompositorWidgetInitData
-{
-};
-
-} // namespace widget
-} // namespace mozilla
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -275,16 +275,22 @@ public:
                  const nsTArray<mozilla::FontRange>& aFontRangeArray,
                  const bool aIsVertical,
                  const LayoutDeviceIntPoint& aPoint) override;
 
 protected:
   virtual nsresult NotifyIMEInternal(
                      const IMENotification& aIMENotification) override;
 
+  // PuppetWidgets do not create compositors.
+  widget::CompositorWidgetProxy* NewCompositorWidgetProxy() override {
+    MOZ_ASSERT_UNREACHABLE("PuppetWidgets should not have widget proxies");
+    return nullptr;
+  }
+
 private:
   nsresult Paint();
 
   void SetChild(PuppetWidget* aChild);
 
   nsresult RequestIMEToCommitComposition(bool aCancel);
   nsresult NotifyIMEOfFocusChange(const IMENotification& aIMENotification);
   nsresult NotifyIMEOfSelectionChange(const IMENotification& aIMENotification);
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -349,16 +349,20 @@ public:
                         const mozilla::WidgetKeyboardEvent& aEvent,
                         DoCommandCallback aCallback,
                         void* aCallbackData) override;
 
     void SetPopupWindowLevel();
 
     NS_IMETHOD         ReparentNativeWidget(nsIWidget* aNewParent) override;
 
+    CompositorWidgetProxy* NewCompositorWidgetProxy() override {
+      return nullptr;
+    }
+
 protected:
   virtual ~nsCocoaWindow();
 
   nsresult             CreateNativeWindow(const NSRect &aRect,
                                           nsBorderStyle aBorderStyle,
                                           bool aRectIsFrameRect);
   nsresult             CreatePopupContentView(const LayoutDeviceIntRect &aRect);
   void                 DestroyNativeWindow();
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -83,16 +83,17 @@ XPIDL_SOURCES += [
     'nsIScreenManager.idl',
     'nsISound.idl',
     'nsITransferable.idl',
 ]
 
 XPIDL_MODULE = 'widget'
 
 EXPORTS += [
+    'CompositorWidgetProxy.h',
     'GfxDriverInfo.h',
     'GfxInfoBase.h',
     'GfxInfoCollector.h',
     'InputData.h',
     'nsBaseScreen.h',
     'nsBaseWidget.h',
     'nsIDeviceContextSpec.h',
     'nsIKeyEventInPluginCallback.h',
@@ -123,31 +124,28 @@ EXPORTS.mozilla += [
     'TextEvents.h',
     'TextRange.h',
     'TouchEvents.h',
     'VsyncDispatcher.h',
     'WidgetUtils.h',
 ]
 
 EXPORTS.mozilla.widget += [
-    'CompositorWidget.h',
     'IMEData.h',
-    'InProcessCompositorWidget.h',
     'PuppetBidiKeyboard.h',
     'WidgetMessageUtils.h',
 ]
 
 UNIFIED_SOURCES += [
-    'CompositorWidget.cpp',
+    'CompositorWidgetProxy.cpp',
     'ContentCache.cpp',
     'GfxDriverInfo.cpp',
     'GfxInfoBase.cpp',
     'GfxInfoCollector.cpp',
     'GfxInfoWebGL.cpp',
-    'InProcessCompositorWidget.cpp',
     'InputData.cpp',
     'nsBaseAppShell.cpp',
     'nsBaseScreen.cpp',
     'nsClipboardHelper.cpp',
     'nsClipboardProxy.cpp',
     'nsColorPickerProxy.cpp',
     'nsContentProcessWidgetFactory.cpp',
     'nsDatePickerProxy.cpp',
@@ -237,27 +235,16 @@ LOCAL_INCLUDES += [
     '/layout/base',
     '/layout/forms',
     '/layout/generic',
     '/layout/xul',
     '/view',
     '/widget',
 ]
 
-if toolkit == 'windows':
-    IPDL_SOURCES = [
-        'windows/PCompositorWidget.ipdl',
-        'windows/PlatformWidgetTypes.ipdlh',
-    ]
-else:
-    IPDL_SOURCES = [
-        'PCompositorWidget.ipdl',
-        'PlatformWidgetTypes.ipdlh',
-    ]
-
 widget_dir = toolkit
 if widget_dir in ('gtk3', 'gtk2'):
     # gtk3 shares includes with gtk2
     widget_dir = 'gtk'
 
 LOCAL_INCLUDES += [
     '/widget/%s' % widget_dir,
 ]
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -166,17 +166,16 @@ nsBaseWidget::nsBaseWidget()
 , mCursor(eCursor_standard)
 , mBorderStyle(eBorderStyle_none)
 , mBounds(0,0,0,0)
 , mOriginalBounds(nullptr)
 , mClipRectCount(0)
 , mSizeMode(nsSizeMode_Normal)
 , mPopupLevel(ePopupLevelTop)
 , mPopupType(ePopupTypeAny)
-, mCompositorWidgetDelegate(nullptr)
 , mUpdateCursor(true)
 , mUseAttachedEvents(false)
 , mIMEHasFocus(false)
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
 , mAccessibilityInUseFlag(false)
 #endif
 {
 #ifdef NOISY_WIDGET_LEAKS
@@ -269,23 +268,26 @@ void nsBaseWidget::DestroyCompositor()
   //  6. Step 5 will schedule DeferredDestroy on the compositor thread, which
   //     releases the reference CompositorBridgeParent holds to itself.
   //
   // When CompositorSession::Shutdown returns, we assume the compositor is gone
   // or will be gone very soon.
   if (mCompositorSession) {
     ReleaseContentController();
     mAPZC = nullptr;
-    mCompositorWidgetDelegate = nullptr;
     mCompositorBridgeChild = nullptr;
 
     // XXX CompositorBridgeChild and CompositorBridgeParent might be re-created in
     // ClientLayerManager destructor. See bug 1133426.
     RefPtr<CompositorSession> session = mCompositorSession.forget();
     session->Shutdown();
+
+    // Widget is used in CompositorBridgeParent, so we can't release it until
+    // it has acknowledged shutdown.
+    mCompositorWidgetProxy = nullptr;
   }
 
   // Can have base widgets that are things like tooltips
   // which don't have CompositorVsyncDispatchers
   if (mCompositorVsyncDispatcher) {
     mCompositorVsyncDispatcher->Shutdown();
     mCompositorVsyncDispatcher = nullptr;
   }
@@ -1299,28 +1301,31 @@ void nsBaseWidget::CreateCompositor(int 
   // If we've already received a shutdown notification, don't try
   // create a new compositor.
   if (!mShutdownObserver) {
     return;
   }
 
   CreateCompositorVsyncDispatcher();
 
+  if (!mCompositorWidgetProxy) {
+    mCompositorWidgetProxy = NewCompositorWidgetProxy();
+  }
+
   RefPtr<ClientLayerManager> lm = new ClientLayerManager(this);
 
   gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
   mCompositorSession = gpu->CreateTopLevelCompositor(
-    this,
+    mCompositorWidgetProxy,
     lm,
     GetDefaultScale(),
     UseAPZ(),
     UseExternalCompositingSurface(),
     gfx::IntSize(aWidth, aHeight));
   mCompositorBridgeChild = mCompositorSession->GetCompositorBridgeChild();
-  mCompositorWidgetDelegate = mCompositorSession->GetCompositorWidgetDelegate();
 
   mAPZC = mCompositorSession->GetAPZCTreeManager();
   if (mAPZC) {
     ConfigureAPZCTreeManager();
   }
 
   if (mInitialZoomConstraints) {
     UpdateZoomConstraints(mInitialZoomConstraints->mPresShellID,
@@ -1414,16 +1419,22 @@ nsBaseWidget::StartRemoteDrawing()
 }
 
 uint32_t
 nsBaseWidget::GetGLFrameBufferFormat()
 {
   return LOCAL_GL_RGBA;
 }
 
+mozilla::widget::CompositorWidgetProxy*
+nsBaseWidget::NewCompositorWidgetProxy()
+{
+  return new mozilla::widget::CompositorWidgetProxyWrapper(this);
+}
+
 //-------------------------------------------------------------------------
 //
 // Destroy the window
 //
 //-------------------------------------------------------------------------
 void nsBaseWidget::OnDestroy()
 {
   if (mTextEventDispatcher) {
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -16,16 +16,17 @@
 #include "nsIFile.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIRollupListener.h"
 #include "nsIObserver.h"
 #include "nsIWidgetListener.h"
 #include "nsPIDOMWindow.h"
 #include "nsWeakReference.h"
+#include "CompositorWidgetProxy.h"
 #include <algorithm>
 class nsIContent;
 class nsAutoRollup;
 class gfxContext;
 
 namespace mozilla {
 class CompositorVsyncDispatcher;
 #ifdef ACCESSIBILITY
@@ -44,21 +45,16 @@ class CompositorBridgeChild;
 class CompositorBridgeParent;
 class APZCTreeManager;
 class GeckoContentController;
 class APZEventState;
 class CompositorSession;
 struct ScrollableLayerGuid;
 } // namespace layers
 
-namespace widget {
-class CompositorWidgetDelegate;
-class InProcessCompositorWidget;
-} // namespace widget
-
 class CompositorVsyncDispatcher;
 } // namespace mozilla
 
 namespace base {
 class Thread;
 } // namespace base
 
 // Windows specific constant indicating the maximum number of touch points the
@@ -94,34 +90,34 @@ public:
  * (Note: widget implementations are not required to use this
  * class, but it gives them a head start.)
  */
 
 class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference
 {
   friend class nsAutoRollup;
   friend class DispatchWheelEventOnMainThread;
-  friend class mozilla::widget::InProcessCompositorWidget;
+  friend class mozilla::widget::CompositorWidgetProxyWrapper;
 
 protected:
   typedef base::Thread Thread;
   typedef mozilla::gfx::DrawTarget DrawTarget;
   typedef mozilla::layers::BasicLayerManager BasicLayerManager;
   typedef mozilla::layers::BufferMode BufferMode;
   typedef mozilla::layers::CompositorBridgeChild CompositorBridgeChild;
   typedef mozilla::layers::CompositorBridgeParent CompositorBridgeParent;
   typedef mozilla::layers::APZCTreeManager APZCTreeManager;
   typedef mozilla::layers::GeckoContentController GeckoContentController;
   typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
   typedef mozilla::layers::APZEventState APZEventState;
   typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
   typedef mozilla::CSSIntRect CSSIntRect;
   typedef mozilla::CSSRect CSSRect;
   typedef mozilla::ScreenRotation ScreenRotation;
-  typedef mozilla::widget::CompositorWidgetDelegate CompositorWidgetDelegate;
+  typedef mozilla::widget::CompositorWidgetProxy CompositorWidgetProxy;
   typedef mozilla::layers::CompositorSession CompositorSession;
 
   virtual ~nsBaseWidget();
 
 public:
   nsBaseWidget();
 
   NS_DECL_ISUPPORTS
@@ -350,18 +346,21 @@ public:
   friend class AutoLayerManagerSetup;
 
   virtual bool            ShouldUseOffMainThreadCompositing();
 
   static nsIRollupListener* GetActiveRollupListener();
 
   void Shutdown();
 
+  // Return a new CompositorWidgetProxy for this widget.
+  virtual CompositorWidgetProxy* NewCompositorWidgetProxy();
+
 protected:
-  // These are methods for CompositorWidgetWrapper, and should only be
+  // These are methods for CompositorWidgetProxyWrapper, and should only be
   // accessed from that class. Derived widgets can choose which methods to
   // implement, or none if supporting out-of-process compositing.
   virtual bool PreRender(mozilla::layers::LayerManagerComposite* aManager) {
     return true;
   }
   virtual void PostRender(mozilla::layers::LayerManagerComposite* aManager)
   {}
   virtual void DrawWindowUnderlay(mozilla::layers::LayerManagerComposite* aManager,
@@ -584,17 +583,17 @@ protected:
   // When this pointer is null, the widget is not clipped
   mozilla::UniquePtr<LayoutDeviceIntRect[]> mClipRects;
   uint32_t          mClipRectCount;
   nsSizeMode        mSizeMode;
   nsPopupLevel      mPopupLevel;
   nsPopupType       mPopupType;
   SizeConstraints   mSizeConstraints;
 
-  CompositorWidgetDelegate* mCompositorWidgetDelegate;
+  RefPtr<CompositorWidgetProxy> mCompositorWidgetProxy;
 
   bool              mUpdateCursor;
   bool              mUseAttachedEvents;
   bool              mIMEHasFocus;
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
   bool              mAccessibilityInUseFlag;
 #endif
   static nsIRollupListener* gRollupListener;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -60,18 +60,16 @@ struct ScrollableLayerGuid;
 } // namespace layers
 namespace gfx {
 class DrawTarget;
 class SourceSurface;
 } // namespace gfx
 namespace widget {
 class TextEventDispatcher;
 class TextEventDispatcherListener;
-class CompositorWidget;
-class CompositorWidgetInitData;
 } // namespace widget
 } // namespace mozilla
 
 /**
  * Callback function that processes events.
  *
  * The argument is actually a subtype (subclass) of WidgetEvent which carries
  * platform specific information about the event. Platform specific code
@@ -1628,21 +1626,16 @@ class nsIWidget : public nsISupports
      * digitizer state when this call is made.
      * @param aObserver The observer that will get notified once the touch
      * sequence has been cleared.
      */
     virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver);
 
     virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) = 0;
 
-    // If this widget supports out-of-process compositing, it can override
-    // this method to provide additional information to the compositor.
-    virtual void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData)
-    {}
-
 private:
   class LongTapInfo
   {
   public:
     LongTapInfo(int32_t aPointerId, LayoutDeviceIntPoint& aPoint,
                 mozilla::TimeDuration aDuration,
                 nsIObserver* aObserver) :
       mPointerId(aPointerId),
deleted file mode 100644
--- a/widget/windows/CompositorWidgetChild.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "CompositorWidgetChild.h"
-#include "mozilla/unused.h"
-
-namespace mozilla {
-namespace widget {
-
-CompositorWidgetChild::CompositorWidgetChild(nsIWidget* aWidget)
-{
-}
-
-CompositorWidgetChild::~CompositorWidgetChild()
-{
-}
-
-void
-CompositorWidgetChild::EnterPresentLock()
-{
-  Unused << SendEnterPresentLock();
-}
-
-void
-CompositorWidgetChild::LeavePresentLock()
-{
-  Unused << SendLeavePresentLock();
-}
-
-void
-CompositorWidgetChild::OnDestroyWindow()
-{
-}
-
-void
-CompositorWidgetChild::UpdateTransparency(nsTransparencyMode aMode)
-{
-  Unused << SendUpdateTransparency(static_cast<int32_t>(aMode));
-}
-
-void
-CompositorWidgetChild::ClearTransparentWindow()
-{
-  Unused << SendClearTransparentWindow();
-}
-
-void
-CompositorWidgetChild::ResizeTransparentWindow(const gfx::IntSize& aSize)
-{
-  Unused << SendResizeTransparentWindow(aSize);
-}
-
-HDC CompositorWidgetChild::GetTransparentDC() const
-{
-  // Not supported in out-of-process mode.
-  return nullptr;
-}
-
-} // namespace widget
-} // namespace mozilla
deleted file mode 100644
--- a/widget/windows/CompositorWidgetChild.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef widget_windows_CompositorWidgetChild_h
-#define widget_windows_CompositorWidgetChild_h
-
-#include "WinCompositorWidget.h"
-#include "mozilla/widget/PCompositorWidgetChild.h"
-
-namespace mozilla {
-namespace widget {
-
-class CompositorWidgetChild final
- : public PCompositorWidgetChild,
-   public CompositorWidgetDelegate
-{
-public:
-  CompositorWidgetChild(nsIWidget* aWidget);
-  ~CompositorWidgetChild() override;
-
-  void EnterPresentLock() override;
-  void LeavePresentLock() override;
-  void OnDestroyWindow() override;
-  void UpdateTransparency(nsTransparencyMode aMode) override;
-  void ClearTransparentWindow() override;
-  void ResizeTransparentWindow(const gfx::IntSize& aSize) override;
-  HDC GetTransparentDC() const override;
-};
-
-} // namespace widget
-} // namespace mozilla
-
-#endif // widget_windows_CompositorWidgetChild_h
deleted file mode 100644
--- a/widget/windows/CompositorWidgetParent.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "CompositorWidgetParent.h"
-
-namespace mozilla {
-namespace widget {
-
-CompositorWidgetParent::CompositorWidgetParent(const CompositorWidgetInitData& aInitData)
- : WinCompositorWidget(aInitData)
-{
-}
-
-CompositorWidgetParent::~CompositorWidgetParent()
-{
-}
-
-bool
-CompositorWidgetParent::RecvEnterPresentLock()
-{
-  EnterPresentLock();
-  return true;
-}
-
-bool
-CompositorWidgetParent::RecvLeavePresentLock()
-{
-  LeavePresentLock();
-  return true;
-}
-
-bool
-CompositorWidgetParent::RecvUpdateTransparency(const int32_t& aMode)
-{
-  UpdateTransparency(static_cast<nsTransparencyMode>(aMode));
-  return true;
-}
-
-bool
-CompositorWidgetParent::RecvClearTransparentWindow()
-{
-  ClearTransparentWindow();
-  return true;
-}
-
-bool
-CompositorWidgetParent::RecvResizeTransparentWindow(const IntSize& aSize)
-{
-  ResizeTransparentWindow(aSize);
-  return true;
-}
-
-void
-CompositorWidgetParent::ActorDestroy(ActorDestroyReason aWhy)
-{
-}
-
-} // namespace widget
-} // namespace mozilla
deleted file mode 100644
--- a/widget/windows/CompositorWidgetParent.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _widget_windows_WinCompositorWidget_h__
-#define _widget_windows_WinCompositorWidget_h__
-
-#include "WinCompositorWidget.h"
-#include "mozilla/widget/PCompositorWidgetParent.h"
-
-namespace mozilla {
-namespace widget {
-
-class CompositorWidgetParent final
- : public PCompositorWidgetParent,
-   public WinCompositorWidget
-{
-public:
-  CompositorWidgetParent(const CompositorWidgetInitData& aInitData);
-  ~CompositorWidgetParent() override;
-
-  bool RecvEnterPresentLock() override;
-  bool RecvLeavePresentLock() override;
-  bool RecvUpdateTransparency(const int32_t& aMode) override;
-  bool RecvClearTransparentWindow() override;
-  bool RecvResizeTransparentWindow(const IntSize& aSize) override;
-  void ActorDestroy(ActorDestroyReason aWhy) override;
-};
-
-} // namespace widget
-} // namespace mozilla
-
-#endif // _widget_windows_WinCompositorWidget_h__
deleted file mode 100644
--- a/widget/windows/PCompositorWidget.ipdl
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=99: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PCompositorBridge;
-
-using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
-
-namespace mozilla {
-namespace widget {
-
-sync protocol PCompositorWidget
-{
-  manager PCompositorBridge;
-
-parent:
-  sync EnterPresentLock();
-  sync LeavePresentLock();
-  async UpdateTransparency(int32_t aMode);
-  sync ClearTransparentWindow();
-  sync ResizeTransparentWindow(IntSize aSize);
-  async __delete__();
-};
-
-} // namespace widget
-} // namespace mozilla
deleted file mode 100644
--- a/widget/windows/PlatformWidgetTypes.ipdlh
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=99: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This file is a stub, for platforms that do not yet support out-of-process
-// compositing or do not need specialized types to do so.
-
-using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
-
-namespace mozilla {
-namespace widget {
-
-struct CompositorWidgetInitData
-{
-  WindowsHandle hWnd;
-  uintptr_t widgetKey;
-  int32_t transparencyMode;
-};
-
-} // namespace widget
-} // namespace mozilla
rename from widget/windows/WinCompositorWidget.cpp
rename to widget/windows/WinCompositorWidgetProxy.cpp
--- a/widget/windows/WinCompositorWidget.cpp
+++ b/widget/windows/WinCompositorWidgetProxy.cpp
@@ -1,88 +1,81 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "WinCompositorWidget.h"
+#include "WinCompositorWidgetProxy.h"
 #include "nsWindow.h"
 #include "VsyncDispatcher.h"
 #include "mozilla/gfx/Point.h"
-#include "mozilla/widget/PlatformWidgetTypes.h"
 
 namespace mozilla {
 namespace widget {
 
 using namespace mozilla::gfx;
 
-/* static */ RefPtr<CompositorWidget>
-CompositorWidget::CreateLocal(const CompositorWidgetInitData& aInitData, nsIWidget* aWidget)
-{
-  return new WinCompositorWidget(aInitData, static_cast<nsWindow*>(aWidget));
-}
-
-WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitData,
-                                         nsWindow* aWindow)
+WinCompositorWidgetProxy::WinCompositorWidgetProxy(nsWindow* aWindow)
  : mWindow(aWindow),
-   mWidgetKey(aInitData.widgetKey()),
-   mWnd(reinterpret_cast<HWND>(aInitData.hWnd())),
-   mTransparencyMode(static_cast<nsTransparencyMode>(aInitData.transparencyMode())),
+   mWidgetKey(reinterpret_cast<uintptr_t>(aWindow)),
+   mWnd(reinterpret_cast<HWND>(aWindow->GetNativeData(NS_NATIVE_WINDOW))),
+   mTransparencyMode(aWindow->GetTransparencyMode()),
    mMemoryDC(nullptr),
    mCompositeDC(nullptr),
    mLockedBackBufferData(nullptr)
 {
+  MOZ_ASSERT(aWindow);
+  MOZ_ASSERT(!aWindow->Destroyed());
   MOZ_ASSERT(mWnd && ::IsWindow(mWnd));
 }
 
 void
-WinCompositorWidget::OnDestroyWindow()
+WinCompositorWidgetProxy::OnDestroyWindow()
 {
   mTransparentSurface = nullptr;
   mMemoryDC = nullptr;
 }
 
 bool
-WinCompositorWidget::PreRender(layers::LayerManagerComposite* aManager)
+WinCompositorWidgetProxy::PreRender(layers::LayerManagerComposite* aManager)
 {
   // This can block waiting for WM_SETTEXT to finish
   // Using PreRender is unnecessarily pessimistic because
   // we technically only need to block during the present call
   // not all of compositor rendering
   mPresentLock.Enter();
   return true;
 }
 
 void
-WinCompositorWidget::PostRender(layers::LayerManagerComposite* aManager)
+WinCompositorWidgetProxy::PostRender(layers::LayerManagerComposite* aManager)
 {
   mPresentLock.Leave();
 }
 
 nsIWidget*
-WinCompositorWidget::RealWidget()
+WinCompositorWidgetProxy::RealWidget()
 {
-  MOZ_ASSERT(mWindow);
   return mWindow;
 }
 
 LayoutDeviceIntSize
-WinCompositorWidget::GetClientSize()
+WinCompositorWidgetProxy::GetClientSize()
 {
   RECT r;
   if (!::GetClientRect(mWnd, &r)) {
     return LayoutDeviceIntSize();
   }
   return LayoutDeviceIntSize(
     r.right - r.left,
     r.bottom - r.top);
 }
 
 already_AddRefed<gfx::DrawTarget>
-WinCompositorWidget::StartRemoteDrawing()
+WinCompositorWidgetProxy::StartRemoteDrawing()
 {
   MOZ_ASSERT(!mCompositeDC);
 
   RefPtr<gfxASurface> surf;
   if (mTransparencyMode == eTransparencyTransparent) {
     surf = EnsureTransparentSurface();
   }
 
@@ -108,39 +101,39 @@ WinCompositorWidget::StartRemoteDrawing(
 
   MOZ_ASSERT(!mCompositeDC);
   mCompositeDC = dc;
 
   return mozilla::gfx::Factory::CreateDrawTargetForCairoSurface(surf->CairoSurface(), size);
 }
 
 void
-WinCompositorWidget::EndRemoteDrawing()
+WinCompositorWidgetProxy::EndRemoteDrawing()
 {
   MOZ_ASSERT(!mLockedBackBufferData);
 
   if (mTransparencyMode == eTransparencyTransparent) {
     MOZ_ASSERT(mTransparentSurface);
     RedrawTransparentWindow();
   }
   if (mCompositeDC) {
     FreeWindowSurface(mCompositeDC);
   }
   mCompositeDC = nullptr;
 }
 
 already_AddRefed<gfx::DrawTarget>
-WinCompositorWidget::GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
-                                             const LayoutDeviceIntRect& aRect,
-                                             const LayoutDeviceIntRect& aClearRect)
+WinCompositorWidgetProxy::GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
+                                                  const LayoutDeviceIntRect& aRect,
+                                                  const LayoutDeviceIntRect& aClearRect)
 {
   MOZ_ASSERT(!mLockedBackBufferData);
 
   RefPtr<gfx::DrawTarget> target =
-    CompositorWidget::GetBackBufferDrawTarget(aScreenTarget, aRect, aClearRect);
+    CompositorWidgetProxy::GetBackBufferDrawTarget(aScreenTarget, aRect, aClearRect);
   if (!target) {
     return nullptr;
   }
 
   MOZ_ASSERT(target->GetBackendType() == BackendType::CAIRO);
 
   uint8_t* destData;
   IntSize destSize;
@@ -158,122 +151,125 @@ WinCompositorWidget::GetBackBufferDrawTa
                                      destStride,
                                      destFormat);
   mLockedBackBufferData = destData;
 
   return dataTarget.forget();
 }
 
 already_AddRefed<gfx::SourceSurface>
-WinCompositorWidget::EndBackBufferDrawing()
+WinCompositorWidgetProxy::EndBackBufferDrawing()
 {
   if (mLockedBackBufferData) {
     MOZ_ASSERT(mLastBackBuffer);
     mLastBackBuffer->ReleaseBits(mLockedBackBufferData);
     mLockedBackBufferData = nullptr;
   }
-  return CompositorWidget::EndBackBufferDrawing();
+  return CompositorWidgetProxy::EndBackBufferDrawing();
 }
 
 already_AddRefed<CompositorVsyncDispatcher>
-WinCompositorWidget::GetCompositorVsyncDispatcher()
+WinCompositorWidgetProxy::GetCompositorVsyncDispatcher()
 {
   RefPtr<CompositorVsyncDispatcher> cvd = mWindow->GetCompositorVsyncDispatcher();
   return cvd.forget();
 }
 
 uintptr_t
-WinCompositorWidget::GetWidgetKey()
+WinCompositorWidgetProxy::GetWidgetKey()
 {
   return mWidgetKey;
 }
 
 void
-WinCompositorWidget::EnterPresentLock()
+WinCompositorWidgetProxy::EnterPresentLock()
 {
   mPresentLock.Enter();
 }
 
 void
-WinCompositorWidget::LeavePresentLock()
+WinCompositorWidgetProxy::LeavePresentLock()
 {
   mPresentLock.Leave();
 }
 
 RefPtr<gfxASurface>
-WinCompositorWidget::EnsureTransparentSurface()
+WinCompositorWidgetProxy::EnsureTransparentSurface()
 {
   MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent);
 
   if (!mTransparentSurface) {
     LayoutDeviceIntSize size = GetClientSize();
-    CreateTransparentSurface(IntSize(size.width, size.height));
+    CreateTransparentSurface(size.width, size.height);
   }
 
   RefPtr<gfxASurface> surface = mTransparentSurface;
   return surface.forget();
 }
 
 void
-WinCompositorWidget::CreateTransparentSurface(const gfx::IntSize& aSize)
+WinCompositorWidgetProxy::CreateTransparentSurface(int32_t aWidth, int32_t aHeight)
 {
   MOZ_ASSERT(!mTransparentSurface && !mMemoryDC);
-  RefPtr<gfxWindowsSurface> surface = new gfxWindowsSurface(aSize, SurfaceFormat::A8R8G8B8_UINT32);
+  RefPtr<gfxWindowsSurface> surface =
+    new gfxWindowsSurface(IntSize(aWidth, aHeight), SurfaceFormat::A8R8G8B8_UINT32);
   mTransparentSurface = surface;
   mMemoryDC = surface->GetDC();
 }
 
 void
-WinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode)
+WinCompositorWidgetProxy::UpdateTransparency(nsTransparencyMode aMode)
 {
   if (mTransparencyMode == aMode) {
     return;
   }
 
   mTransparencyMode = aMode;
   mTransparentSurface = nullptr;
   mMemoryDC = nullptr;
 
   if (mTransparencyMode == eTransparencyTransparent) {
     EnsureTransparentSurface();
   }
 }
 
 void
-WinCompositorWidget::ClearTransparentWindow()
+WinCompositorWidgetProxy::ClearTransparentWindow()
 {
   if (!mTransparentSurface) {
     return;
   }
 
   IntSize size = mTransparentSurface->GetSize();
   RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
     CreateDrawTargetForSurface(mTransparentSurface, size);
   drawTarget->ClearRect(Rect(0, 0, size.width, size.height));
   RedrawTransparentWindow();
 }
 
 void
-WinCompositorWidget::ResizeTransparentWindow(const gfx::IntSize& aSize)
+WinCompositorWidgetProxy::ResizeTransparentWindow(int32_t aNewWidth, int32_t aNewHeight)
 {
   MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent);
 
-  if (mTransparentSurface && mTransparentSurface->GetSize() == aSize) {
+  if (mTransparentSurface &&
+      mTransparentSurface->GetSize() == IntSize(aNewWidth, aNewHeight))
+  {
     return;
   }
 
   // Destroy the old surface.
   mTransparentSurface = nullptr;
   mMemoryDC = nullptr;
 
-  CreateTransparentSurface(aSize);
+  CreateTransparentSurface(aNewWidth, aNewHeight);
 }
 
 bool
-WinCompositorWidget::RedrawTransparentWindow()
+WinCompositorWidgetProxy::RedrawTransparentWindow()
 {
   MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent);
 
   LayoutDeviceIntSize size = GetClientSize();
 
   ::GdiFlush();
 
   BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
@@ -285,24 +281,24 @@ WinCompositorWidget::RedrawTransparentWi
 
   // perform the alpha blend
   return !!::UpdateLayeredWindow(
     hWnd, nullptr, (POINT*)&winRect, &winSize, mMemoryDC,
     &srcPos, 0, &bf, ULW_ALPHA);
 }
 
 HDC
-WinCompositorWidget::GetWindowSurface()
+WinCompositorWidgetProxy::GetWindowSurface()
 {
   return eTransparencyTransparent == mTransparencyMode
          ? mMemoryDC
          : ::GetDC(mWnd);
 }
 
 void
-WinCompositorWidget::FreeWindowSurface(HDC dc)
+WinCompositorWidgetProxy::FreeWindowSurface(HDC dc)
 {
   if (eTransparencyTransparent != mTransparencyMode)
     ::ReleaseDC(mWnd, dc);
 }
 
 } // namespace widget
 } // namespace mozilla
rename from widget/windows/WinCompositorWidget.h
rename to widget/windows/WinCompositorWidgetProxy.h
--- a/widget/windows/WinCompositorWidget.h
+++ b/widget/windows/WinCompositorWidgetProxy.h
@@ -1,100 +1,77 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef widget_windows_CompositorWidgetParent_h
-#define widget_windows_CompositorWidgetParent_h
+#ifndef _widget_windows_WinCompositorWidget_h__
+#define _widget_windows_WinCompositorWidget_h__
 
-#include "CompositorWidget.h"
-#include "gfxASurface.h"
+#include "CompositorWidgetProxy.h"
 #include "mozilla/gfx/CriticalSection.h"
-#include "mozilla/gfx/Point.h"
-#include "nsIWidget.h"
 
 class nsWindow;
 
 namespace mozilla {
 namespace widget {
-
-class CompositorWidgetDelegate
-{
-public:
-  // Callbacks for nsWindow.
-  virtual void EnterPresentLock() = 0;
-  virtual void LeavePresentLock() = 0;
-  virtual void OnDestroyWindow() = 0;
-
-  // Transparency handling.
-  virtual void UpdateTransparency(nsTransparencyMode aMode) = 0;
-  virtual void ClearTransparentWindow() = 0;
-
-  // Update the bounds of the transparent surface.
-  virtual void ResizeTransparentWindow(const gfx::IntSize& aSize) = 0;
-
-  // If in-process and using software rendering, return the backing transparent
-  // DC.
-  virtual HDC GetTransparentDC() const = 0;
-};
  
-// This is the Windows-specific implementation of CompositorWidget. For
+// This is the Windows-specific implementation of CompositorWidgetProxy. For
 // the most part it only requires an HWND, however it maintains extra state
 // for transparent windows, as well as for synchronizing WM_SETTEXT messages
 // with the compositor.
-class WinCompositorWidget
- : public CompositorWidget,
-   public CompositorWidgetDelegate
+class WinCompositorWidgetProxy : public CompositorWidgetProxy
 {
 public:
-  WinCompositorWidget(const CompositorWidgetInitData& aInitData,
-                      nsWindow* aWindow = nullptr);
+  WinCompositorWidgetProxy(nsWindow* aWindow);
 
   bool PreRender(layers::LayerManagerComposite*) override;
   void PostRender(layers::LayerManagerComposite*) override;
   already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
   void EndRemoteDrawing() override;
   LayoutDeviceIntSize GetClientSize() override;
   already_AddRefed<gfx::DrawTarget> GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
                                                             const LayoutDeviceIntRect& aRect,
                                                             const LayoutDeviceIntRect& aClearRect) override;
   already_AddRefed<gfx::SourceSurface> EndBackBufferDrawing() override;
   already_AddRefed<CompositorVsyncDispatcher> GetCompositorVsyncDispatcher() override;
   uintptr_t GetWidgetKey() override;
   nsIWidget* RealWidget() override;
-  WinCompositorWidget* AsWindows() override {
+  WinCompositorWidgetProxy* AsWindowsProxy() override {
     return this;
   }
 
-  // CompositorWidgetDelegate overrides.
-  void EnterPresentLock() override;
-  void LeavePresentLock() override;
-  void OnDestroyWindow() override;
-  void UpdateTransparency(nsTransparencyMode aMode) override;
-  void ClearTransparentWindow() override;
-  void ResizeTransparentWindow(const gfx::IntSize& aSize) override;
+  // Callbacks for nsWindow.
+  void EnterPresentLock();
+  void LeavePresentLock();
+  void OnDestroyWindow();
 
+  // Transparency handling.
+  void UpdateTransparency(nsTransparencyMode aMode);
+  void ClearTransparentWindow();
   bool RedrawTransparentWindow();
 
+  // Update the bounds of the transparent surface.
+  void ResizeTransparentWindow(int32_t aNewWidth, int32_t aNewHeight);
+
   // Ensure that a transparent surface exists, then return it.
   RefPtr<gfxASurface> EnsureTransparentSurface();
 
-  HDC GetTransparentDC() const override {
+  HDC GetTransparentDC() const {
     return mMemoryDC;
   }
   HWND GetHwnd() const {
     return mWnd;
   }
 
 private:
   HDC GetWindowSurface();
   void FreeWindowSurface(HDC dc);
 
-  void CreateTransparentSurface(const gfx::IntSize& aSize);
+  void CreateTransparentSurface(int32_t aWidth, int32_t aHeight);
 
 private:
   nsWindow* mWindow;
   uintptr_t mWidgetKey;
   HWND mWnd;
   gfx::CriticalSection mPresentLock;
 
   // Transparency handling.
@@ -105,9 +82,9 @@ private:
 
   // Locked back buffer of BasicCompositor
   uint8_t* mLockedBackBufferData;
 };
 
 } // namespace widget
 } // namespace mozilla
 
-#endif // widget_windows_CompositorWidgetParent_h
+#endif // _widget_windows_WinCompositorWidget_h__
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -9,28 +9,24 @@ TEST_DIRS += ['tests']
 EXPORTS += [
     'nsdefs.h',
     'WindowHook.h',
     'WinUtils.h',
 ]
 
 EXPORTS.mozilla.widget += [
     'AudioSession.h',
-    'CompositorWidgetChild.h',
-    'CompositorWidgetParent.h',
-    'WinCompositorWidget.h',
+    'WinCompositorWidgetProxy.h',
     'WinMessages.h',
     'WinModifierKeyState.h',
     'WinNativeEventData.h',
 ]
 
 UNIFIED_SOURCES += [
     'AudioSession.cpp',
-    'CompositorWidgetChild.cpp',
-    'CompositorWidgetParent.cpp',
     'GfxInfo.cpp',
     'IEnumFE.cpp',
     'IMMHandler.cpp',
     'InkCollector.cpp',
     'JumpListItem.cpp',
     'KeyboardLayout.cpp',
     'nsAppShell.cpp',
     'nsClipboard.cpp',
@@ -54,17 +50,17 @@ UNIFIED_SOURCES += [
     'nsWindowDbg.cpp',
     'nsWindowGfx.cpp',
     'nsWinGesture.cpp',
     'TaskbarPreview.cpp',
     'TaskbarPreviewButton.cpp',
     'TaskbarTabPreview.cpp',
     'TaskbarWindowPreview.cpp',
     'WidgetTraceEvent.cpp',
-    'WinCompositorWidget.cpp',
+    'WinCompositorWidgetProxy.cpp',
     'WindowHook.cpp',
     'WinIMEHandler.cpp',
     'WinTaskbar.cpp',
     'WinTextEventDispatcherListener.cpp',
     'WinUtils.cpp',
 ]
 
 # The following files cannot be built in unified mode because of name clashes.
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -131,22 +131,21 @@
 #include "mozilla/dom/Touch.h"
 #include "mozilla/gfx/2D.h"
 #include "nsToolkitCompsCID.h"
 #include "nsIAppStartup.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/TextEvents.h" // For WidgetKeyboardEvent
 #include "mozilla/TextEventDispatcherListener.h"
 #include "mozilla/widget/WinNativeEventData.h"
-#include "mozilla/widget/PlatformWidgetTypes.h"
 #include "nsThemeConstants.h"
 #include "nsBidiKeyboard.h"
 #include "nsThemeConstants.h"
 #include "gfxConfig.h"
-#include "WinCompositorWidget.h"
+#include "WinCompositorWidgetProxy.h"
 
 #include "nsIGfxInfo.h"
 #include "nsUXThemeConstants.h"
 #include "KeyboardLayout.h"
 #include "nsNativeDragTarget.h"
 #include <mmsystem.h> // needed for WIN32_LEAN_AND_MEAN
 #include <zmouse.h>
 #include <richedit.h>
@@ -1287,18 +1286,18 @@ NS_METHOD nsWindow::Show(bool bState)
       if (!wasVisible && (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog)) {
         // when a toplevel window or dialog is shown, initialize the UI state
         ::SendMessageW(mWnd, WM_CHANGEUISTATE, MAKEWPARAM(UIS_INITIALIZE, UISF_HIDEFOCUS | UISF_HIDEACCEL), 0);
       }
     } else {
       // Clear contents to avoid ghosting of old content if we display
       // this window again.
       if (wasVisible && mTransparencyMode == eTransparencyTransparent) {
-        if (mCompositorWidgetDelegate) {
-          mCompositorWidgetDelegate->ClearTransparentWindow();
+        if (RefPtr<WinCompositorWidgetProxy> proxy = GetCompositorWidgetProxy()) {
+          proxy->ClearTransparentWindow();
         }
       }
       if (mWindowType != eWindowType_dialog) {
         ::ShowWindow(mWnd, SW_HIDE);
       } else {
         ::SetWindowPos(mWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
                        SWP_NOZORDER | SWP_NOACTIVATE);
       }
@@ -1546,18 +1545,18 @@ NS_METHOD nsWindow::Resize(double aWidth
   if (mBounds.width == width && mBounds.height == height) {
     if (aRepaint) {
       Invalidate();
     }
     return NS_OK;
   }
 
   if (mTransparencyMode == eTransparencyTransparent) {
-    if (mCompositorWidgetDelegate) {
-      mCompositorWidgetDelegate->ResizeTransparentWindow(gfx::IntSize(width, height));
+    if (RefPtr<WinCompositorWidgetProxy> proxy = GetCompositorWidgetProxy()) {
+      proxy->ResizeTransparentWindow(width, height);
     }
   }
 
   // Set cached value for lightweight and printing
   mBounds.width  = width;
   mBounds.height = height;
 
   if (mWnd) {
@@ -1605,18 +1604,18 @@ NS_METHOD nsWindow::Resize(double aX, do
       mBounds.width == width && mBounds.height == height) {
     if (aRepaint) {
       Invalidate();
     }
     return NS_OK;
   }
 
   if (eTransparencyTransparent == mTransparencyMode) {
-    if (mCompositorWidgetDelegate) {
-      mCompositorWidgetDelegate->ResizeTransparentWindow(gfx::IntSize(width, height));
+    if (RefPtr<WinCompositorWidgetProxy> proxy = GetCompositorWidgetProxy()) {
+      proxy->ResizeTransparentWindow(width, height);
     }
   }
 
   // Set cached value for lightweight and printing
   mBounds.x      = x;
   mBounds.y      = y;
   mBounds.width  = width;
   mBounds.height = height;
@@ -3618,26 +3617,23 @@ nsWindow::GetLayerManager(PLayerTransact
     // e10s uses the parameter to pass in the shadow manager from the TabChild
     // so we don't expect to see it there since this doesn't support e10s.
     NS_ASSERTION(aShadowManager == nullptr, "Async Compositor not supported with e10s");
     CreateCompositor();
   }
 
   if (!mLayerManager) {
     MOZ_ASSERT(!mCompositorSession && !mCompositorBridgeChild);
-    MOZ_ASSERT(!mCompositorWidgetDelegate);
 
     // Ensure we have a widget proxy even if we're not using the compositor,
-    // since all our transparent window handling lives there.
-    CompositorWidgetInitData initData(
-      reinterpret_cast<uintptr_t>(mWnd),
-      reinterpret_cast<uintptr_t>(static_cast<nsIWidget*>(this)),
-      mTransparencyMode);
-    mBasicLayersSurface = new WinCompositorWidget(initData, this);
-    mCompositorWidgetDelegate = mBasicLayersSurface;
+    // since that's where we handle transparent windows.
+    if (!mCompositorWidgetProxy) {
+      mCompositorWidgetProxy = new WinCompositorWidgetProxy(this);
+    }
+
     mLayerManager = CreateBasicLayerManager();
   }
 
   NS_ASSERTION(mLayerManager, "Couldn't provide a valid layer manager.");
 
   return mLayerManager;
 }
 
@@ -3688,16 +3684,28 @@ nsWindow::OnDefaultButtonLoaded(const La
 
   if (!::SetCursorPos(centerOfButton.x, centerOfButton.y)) {
     NS_ERROR("SetCursorPos failed");
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
+mozilla::widget::CompositorWidgetProxy*
+nsWindow::NewCompositorWidgetProxy()
+{
+  return new WinCompositorWidgetProxy(this);
+}
+
+mozilla::widget::WinCompositorWidgetProxy*
+nsWindow::GetCompositorWidgetProxy()
+{
+  return mCompositorWidgetProxy ? mCompositorWidgetProxy->AsWindowsProxy() : nullptr;
+}
+
 void
 nsWindow::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries)
 {
   RefPtr<LayerManager> layerManager = GetLayerManager();
   if (!layerManager) {
     return;
   }
 
@@ -4890,26 +4898,27 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       {
         // From msdn, the way around this is to disable the visible state
         // temporarily. We need the text to be set but we don't want the
         // redraw to occur. However, we need to make sure that we don't
         // do this at the same time that a Present is happening.
         //
         // To do this we take mPresentLock in nsWindow::PreRender and
         // if that lock is taken we wait before doing WM_SETTEXT
-        if (mCompositorWidgetDelegate) {
-          mCompositorWidgetDelegate->EnterPresentLock();
+        RefPtr<WinCompositorWidgetProxy> proxy = GetCompositorWidgetProxy();
+        if (proxy) {
+          proxy->EnterPresentLock();
         }
         DWORD style = GetWindowLong(mWnd, GWL_STYLE);
         SetWindowLong(mWnd, GWL_STYLE, style & ~WS_VISIBLE);
         *aRetValue = CallWindowProcW(GetPrevWindowProc(), mWnd,
                                      msg, wParam, lParam);
         SetWindowLong(mWnd, GWL_STYLE, style);
-        if (mCompositorWidgetDelegate) {
-          mCompositorWidgetDelegate->LeavePresentLock();
+        if (proxy) {
+          proxy->LeavePresentLock();
         }
 
         return true;
       }
 
     case WM_NCACTIVATE:
     {
       /*
@@ -6200,18 +6209,18 @@ void nsWindow::OnWindowPosChanged(WINDOW
 
     ::GetWindowRect(mWnd, &r);
 
     newWidth  = r.right - r.left;
     newHeight = r.bottom - r.top;
     nsIntRect rect(wp->x, wp->y, newWidth, newHeight);
 
     if (eTransparencyTransparent == mTransparencyMode) {
-      if (mCompositorWidgetDelegate) {
-        mCompositorWidgetDelegate->ResizeTransparentWindow(gfx::IntSize(newWidth, newHeight));
+      if (RefPtr<WinCompositorWidgetProxy> proxy = GetCompositorWidgetProxy()) {
+        proxy->ResizeTransparentWindow(newWidth, newHeight);
       }
     }
 
     if (newWidth > mLastSize.width)
     {
       RECT drect;
 
       // getting wider
@@ -6721,20 +6730,19 @@ void nsWindow::OnDestroy()
     VERIFY(::DeleteObject(mBrush));
     mBrush = nullptr;
   }
 
   // Destroy any custom cursor resources.
   if (mCursor == -1)
     SetCursor(eCursor_standard);
 
-  if (mCompositorWidgetDelegate) {
-    mCompositorWidgetDelegate->OnDestroyWindow();
-  }
-  mBasicLayersSurface = nullptr;
+  if (RefPtr<WinCompositorWidgetProxy> proxy = GetCompositorWidgetProxy()) {
+    proxy->OnDestroyWindow();
+  }
 
   // Finalize panning feedback to possibly restore window displacement
   mGesture.PanFeedbackFinalize(mWnd, true);
 
   // Clear the main HWND.
   mWnd = nullptr;
 }
 
@@ -7039,18 +7047,18 @@ void nsWindow::SetWindowTranslucencyInne
   VERIFY_WINDOW_STYLE(style);
   ::SetWindowLongPtrW(hWnd, GWL_STYLE, style);
   ::SetWindowLongPtrW(hWnd, GWL_EXSTYLE, exStyle);
 
   if (HasGlass())
     memset(&mGlassMargins, 0, sizeof mGlassMargins);
   mTransparencyMode = aMode;
 
-  if (mCompositorWidgetDelegate) {
-    mCompositorWidgetDelegate->UpdateTransparency(aMode);
+  if (RefPtr<WinCompositorWidgetProxy> proxy = GetCompositorWidgetProxy()) {
+    proxy->UpdateTransparency(aMode);
   }
   UpdateGlass();
 }
 
 #endif //MOZ_XUL
 
 /**************************************************************
  **************************************************************
@@ -7811,16 +7819,8 @@ nsWindow::OnWindowedPluginKeyEvent(const
 DWORD ChildWindow::WindowStyle()
 {
   DWORD style = WS_CLIPCHILDREN | nsWindow::WindowStyle();
   if (!(style & WS_POPUP))
     style |= WS_CHILD; // WS_POPUP and WS_CHILD are mutually exclusive.
   VERIFY_WINDOW_STYLE(style);
   return style;
 }
-
-void
-nsWindow::GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData)
-{
-  aInitData->hWnd() = reinterpret_cast<uintptr_t>(mWnd);
-  aInitData->widgetKey() = reinterpret_cast<uintptr_t>(static_cast<nsIWidget*>(this));
-  aInitData->transparencyMode() = mTransparencyMode;
-}
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -52,18 +52,18 @@
 
 class nsNativeDragTarget;
 class nsIRollupListener;
 class imgIContainer;
 
 namespace mozilla {
 namespace widget {
 class NativeKey;
-class WinCompositorWidget;
 struct MSGResult;
+class WinCompositorWidgetProxy;
 } // namespace widget
 } // namespacw mozilla;
 
 /**
  * Native WIN32 window wrapper.
  */
 
 class nsWindow : public nsWindowBase
@@ -308,17 +308,17 @@ public:
                  const mozilla::widget::CandidateWindowPosition&
                    aPosition) override;
   virtual void DefaultProcOfPluginEvent(
                  const mozilla::WidgetPluginEvent& aEvent) override;
   virtual nsresult OnWindowedPluginKeyEvent(
                      const mozilla::NativeEventData& aKeyEventData,
                      nsIKeyEventInPluginCallback* aCallback) override;
 
-  void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData) override;
+  mozilla::widget::CompositorWidgetProxy* NewCompositorWidgetProxy() override;
 
 protected:
   virtual ~nsWindow();
 
   virtual void WindowUsesOMTC() override;
   virtual void RegisterTouchWindow() override;
 
   // A magic number to identify the FAKETRACKPOINTSCROLLABLE window created
@@ -483,16 +483,18 @@ protected:
   virtual nsresult        SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
                                               bool aIntersectWithExisting) override;
   nsIntRegion             GetRegionToPaint(bool aForceFullRepaint, 
                                            PAINTSTRUCT ps, HDC aDC);
   static void             ActivateOtherWindowHelper(HWND aWnd);
   void                    ClearCachedResources();
   nsIWidgetListener*      GetPaintListener();
 
+  mozilla::widget::WinCompositorWidgetProxy* GetCompositorWidgetProxy();
+
 protected:
   nsCOMPtr<nsIWidget>   mParent;
   nsIntSize             mLastSize;
   nsIntPoint            mLastPoint;
   HWND                  mWnd;
   HWND                  mTransitionWnd;
   WNDPROC               mPrevWndProc;
   HBRUSH                mBrush;
@@ -615,18 +617,16 @@ protected:
   //  painting too rapidly in response to frequent input events.
   TimeStamp mLastPaintEndTime;
 
   // Caching for hit test results
   POINT mCachedHitTestPoint;
   TimeStamp mCachedHitTestTime;
   int32_t mCachedHitTestResult;
 
-  RefPtr<mozilla::widget::WinCompositorWidget> mBasicLayersSurface;
-
   static bool sNeedsToInitMouseWheelSettings;
   static void InitMouseWheelScrollData();
 
   double mSizeConstraintsScale; // scale in effect when setting constraints
 };
 
 /**
  * A child window is a window with different style.
--- a/widget/windows/nsWindowGfx.cpp
+++ b/widget/windows/nsWindowGfx.cpp
@@ -234,17 +234,17 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t
     // we force generation of WM_PAINT messages by invalidating window areas with
     // RedrawWindow, InvalidateRect or InvalidateRgn function calls.
     // BeginPaint/EndPaint must be called to make Windows think that invalid area
     // is painted. Otherwise it will continue sending the same message endlessly.
     ::BeginPaint(mWnd, &ps);
     ::EndPaint(mWnd, &ps);
 
     // We're guaranteed to have a widget proxy since we called GetLayerManager().
-    aDC = mCompositorWidgetDelegate->GetTransparentDC();
+    aDC = GetCompositorWidgetProxy()->GetTransparentDC();
   }
 #endif
 
   mPainting = true;
 
 #ifdef WIDGET_DEBUG_OUTPUT
   HRGN debugPaintFlashRegion = nullptr;
   HDC debugPaintFlashDC = nullptr;
@@ -308,17 +308,17 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t
     switch (GetLayerManager()->GetBackendType()) {
       case LayersBackend::LAYERS_BASIC:
         {
           RefPtr<gfxASurface> targetSurface;
 
 #if defined(MOZ_XUL)
           // don't support transparency for non-GDI rendering, for now
           if (eTransparencyTransparent == mTransparencyMode) {
-            targetSurface = mBasicLayersSurface->EnsureTransparentSurface();
+            targetSurface = GetCompositorWidgetProxy()->EnsureTransparentSurface();
           }
 #endif
 
           RefPtr<gfxWindowsSurface> targetSurfaceWin;
           if (!targetSurface)
           {
             uint32_t flags = (mTransparencyMode == eTransparencyOpaque) ? 0 :
                 gfxWindowsSurface::FLAG_IS_TRANSPARENT;
@@ -373,17 +373,17 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t
               this, LayoutDeviceIntRegion::FromUnknownRegion(region));
           }
 
 #ifdef MOZ_XUL
           if (eTransparencyTransparent == mTransparencyMode) {
             // Data from offscreen drawing surface was copied to memory bitmap of transparent
             // bitmap. Now it can be read from memory bitmap to apply alpha channel and after
             // that displayed on the screen.
-            mBasicLayersSurface->RedrawTransparentWindow();
+            GetCompositorWidgetProxy()->RedrawTransparentWindow();
           }
 #endif
         }
         break;
       case LayersBackend::LAYERS_CLIENT:
         {
           result = listener->PaintWindow(
             this, LayoutDeviceIntRegion::FromUnknownRegion(region));