Address review comments from Bug 711168.
authorAli Juma <ajuma@mozilla.com>
Fri, 06 Jan 2012 17:52:32 -0500
changeset 92341 bf899571b52b4249f6c382d09211ad69a947035b
parent 92340 9a06644c9e86779eef3f211aa92f508c235c17bf
child 92342 a3c28289621179e72d3c46b5a067116f06b07020
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs711168
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Address review comments from Bug 711168.
gfx/layers/Makefile.in
gfx/layers/ipc/Compositor.cpp
gfx/layers/ipc/Compositor.h
gfx/layers/ipc/CompositorChild.cpp
gfx/layers/ipc/CompositorChild.h
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
gfx/layers/ipc/PCompositor.ipdl
gfx/layers/ipc/ShadowLayersHost.h
gfx/layers/ipc/ShadowLayersManager.h
gfx/layers/ipc/ShadowLayersParent.cpp
gfx/layers/ipc/ShadowLayersParent.h
layout/ipc/RenderFrameParent.h
widget/src/cocoa/nsChildView.h
widget/src/cocoa/nsChildView.mm
widget/src/xpwidgets/nsBaseWidget.cpp
widget/src/xpwidgets/nsBaseWidget.h
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -132,17 +132,17 @@ EXPORTS_NAMESPACES = IPC mozilla/layers
 EXPORTS_IPC = ShadowLayerUtils.h
 EXPORTS_mozilla/layers = \
         Compositor.h \
         CompositorChild.h \
         CompositorParent.h \
         ShadowLayers.h \
         ShadowLayersChild.h \
         ShadowLayersParent.h \
-        ShadowLayersHost.h \
+        ShadowLayersManager.h \
         $(NULL)
 
 CPPSRCS += \
         Compositor.cpp \
         CompositorChild.cpp \
         CompositorParent.cpp \
         ShadowLayers.cpp \
         ShadowLayerChild.cpp \
--- a/gfx/layers/ipc/Compositor.cpp
+++ b/gfx/layers/ipc/Compositor.cpp
@@ -17,43 +17,42 @@
  *
  * The Initial Developer of the Original Code is
  *   The Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2011
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Benoit Girard <bgirard@mozilla.com>
+ *   Ali Juma <ajuma@mozilla.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef mozilla_layers_Compositor_h
-#define mozilla_layers_Compositor_h
-
+#include "CompositorParent.h"
 #include "Compositor.h"
-#include "CompositorChild.h"
 #include "nsDebug.h"
 
-class CompositorChild;
-
 namespace mozilla {
 namespace layers {
 namespace compositor {
 
-int sShadowNativeContext = 0;
+LayerManager*
+GetLayerManager(CompositorParent* aParent)
+{
+  return aParent->GetLayerManager();
+}
+
 
 }
 }
 }
-#endif
-
--- a/gfx/layers/ipc/Compositor.h
+++ b/gfx/layers/ipc/Compositor.h
@@ -42,44 +42,23 @@
 
 // Note we can't include IPDL generated headers here
 
 #include "Layers.h"
 #include "nsDebug.h"
 
 namespace mozilla {
 namespace layers {
+
+class CompositorParent;
+class LayerManager;
+
 namespace compositor {
 
-// Layer user data to store the native content
-// on the shadow layer manager since cocoa widgets
-// expects to find the native context from the layer manager.
-extern int sShadowNativeContext;
-
-class ShadowNativeContextUserData : public LayerUserData
-{
-public:
-  ShadowNativeContextUserData(void *aNativeContext)
-    : mNativeContext(aNativeContext)
-  {
-    MOZ_COUNT_CTOR(ShadowNativeContextUserData);
-  }
-  ~ShadowNativeContextUserData()
-  {
-    MOZ_COUNT_DTOR(ShadowNativeContextUserData);
-  }
-
-  // This native context is shared with the compositor.
-  // The user is responsible for locking usage of this context
-  // with the compositor. Note that using this context blocks
-  // the compositor and must be avoided.
-  void* GetNativeContext() {
-    return mNativeContext;
-  }
-private:
-  void *mNativeContext;
-};
-
+// Needed when we cannot directly include CompositorParent.h since it includes
+// an IPDL-generated header (e.g. IPDL-generated headers cannot be included in
+// widget/src/cocoa).
+LayerManager* GetLayerManager(CompositorParent* aParent);
 
 }
 }
 }
 #endif
--- a/gfx/layers/ipc/CompositorChild.cpp
+++ b/gfx/layers/ipc/CompositorChild.cpp
@@ -38,27 +38,25 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "CompositorChild.h"
 #include "CompositorParent.h"
 #include "Compositor.h"
 #include "LayerManagerOGL.h"
 #include "mozilla/layers/ShadowLayersChild.h"
-#include "base/thread.h"
 
 using mozilla::layers::ShadowLayersChild;
 using namespace mozilla::layers::compositor;
 
 namespace mozilla {
 namespace layers {
 
-CompositorChild::CompositorChild(Thread *aCompositorThread, LayerManager *aLayerManager)
-  : mCompositorThread(aCompositorThread)
-  , mLayerManager(aLayerManager)
+CompositorChild::CompositorChild(LayerManager *aLayerManager)
+  : mLayerManager(aLayerManager)
 {
   MOZ_COUNT_CTOR(CompositorChild);
 }
 
 CompositorChild::~CompositorChild()
 {
   MOZ_COUNT_DTOR(CompositorChild);
 }
@@ -74,54 +72,20 @@ CompositorChild::Destroy()
   if (numChildren) {
     ShadowLayersChild* layers =
       static_cast<ShadowLayersChild*>(ManagedPLayersChild()[0]);
     layers->Destroy();
   }
   SendStop();
 }
 
-CompositorChild*
-CompositorChild::CreateCompositor(LayerManager *aLayerManager,
-                                  CompositorParent *aCompositorParent)
+PLayersChild*
+CompositorChild::AllocPLayers(const LayersBackend &backend)
 {
-  Thread* compositorThread = new Thread("CompositorThread");
-  if (compositorThread->Start()) {
-    MessageLoop *parentMessageLoop = MessageLoop::current();
-    MessageLoop *childMessageLoop = compositorThread->message_loop();
-    CompositorChild *compositorChild = new CompositorChild(compositorThread, aLayerManager);
-    mozilla::ipc::AsyncChannel *parentChannel =
-      aCompositorParent->GetIPCChannel();
-    mozilla::ipc::AsyncChannel *childChannel =
-      compositorChild->GetIPCChannel();
-    mozilla::ipc::AsyncChannel::Side childSide =
-      mozilla::ipc::AsyncChannel::Child;
-
-    compositorChild->Open(parentChannel, childMessageLoop, childSide);
-    compositorChild->SendInit();
-
-    return compositorChild;
-  }
-
-  return NULL;
-}
-
-bool
-CompositorChild::RecvNativeContextCreated(const NativeContext &aNativeContext)
-{
-  void *nativeContext = (void*)aNativeContext.nativeContext();
-  ShadowNativeContextUserData *userData = new ShadowNativeContextUserData(nativeContext);
-  mLayerManager->AsShadowManager()->SetUserData(&sShadowNativeContext, userData);
-  return true;
-}
-
-PLayersChild*
-CompositorChild::AllocPLayers(const LayersBackend &backend, const WidgetDescriptor &widget)
-{
-  return new ShadowLayersChild();;
+  return new ShadowLayersChild();
 }
 
 bool
 CompositorChild::DeallocPLayers(PLayersChild* actor)
 {
   delete actor;
   return true;
 }
--- a/gfx/layers/ipc/CompositorChild.h
+++ b/gfx/layers/ipc/CompositorChild.h
@@ -37,49 +37,36 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_layers_CompositorChild_h
 #define mozilla_layers_CompositorChild_h
 
 #include "mozilla/layers/PCompositorChild.h"
 
-namespace base {
-  class Thread;
-}
-
-using base::Thread;
-
 namespace mozilla {
 namespace layers {
 
 class LayerManager;
 class CompositorParent;
 
 class CompositorChild : public PCompositorChild
 {
   NS_INLINE_DECL_REFCOUNTING(CompositorChild)
 public:
+  CompositorChild(LayerManager *aLayerManager);
   virtual ~CompositorChild();
 
   void Destroy();
 
-  static CompositorChild* CreateCompositor(LayerManager *aLayerManager,
-                                           CompositorParent *aCompositorParent);
-
 protected:
-  CompositorChild(Thread* aCompositorThread, LayerManager *aLayerManager);
-
-  virtual PLayersChild* AllocPLayers(const LayersBackend &aBackend, const WidgetDescriptor &aWidget);
+  virtual PLayersChild* AllocPLayers(const LayersBackend &aBackend);
   virtual bool DeallocPLayers(PLayersChild *aChild);
 
-  virtual bool RecvNativeContextCreated(const NativeContext &aNativeContext);
-
 private:
-  Thread *mCompositorThread;
   nsRefPtr<LayerManager> mLayerManager;
 
   DISALLOW_EVIL_CONSTRUCTORS(CompositorChild);
 };
 
 } // layers
 } // mozilla
 
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -36,113 +36,116 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "CompositorParent.h"
 #include "ShadowLayersParent.h"
 #include "LayerManagerOGL.h"
+#include "nsIWidget.h"
 
 namespace mozilla {
 namespace layers {
 
-CompositorParent::CompositorParent()
-  : mStopped(false)
+CompositorParent::CompositorParent(nsIWidget* aWidget)
+  : mStopped(false), mWidget(aWidget)
 {
-
   MOZ_COUNT_CTOR(CompositorParent);
 }
 
 CompositorParent::~CompositorParent()
 {
   MOZ_COUNT_DTOR(CompositorParent);
 }
 
 void
 CompositorParent::Destroy()
 {
-  size_t numChildren = ManagedPLayersParent().Length();
-  NS_ABORT_IF_FALSE(0 == numChildren || 1 == numChildren,
-                    "compositor must only have 0 or 1 layer manager");
-
-  if (numChildren) {
-    ShadowLayersParent* layers =
-      static_cast<ShadowLayersParent*>(ManagedPLayersParent()[0]);
-    layers->Destroy();
-  }
+  NS_ABORT_IF_FALSE(ManagedPLayersParent().Length() == 0,
+                    "CompositorParent destroyed before managed PLayersParent");
 }
 
 bool
 CompositorParent::RecvInit()
 {
-  CancelableTask *composeTask = NewRunnableMethod(this, &CompositorParent::Composite);
-  MessageLoop::current()->PostTask(FROM_HERE, composeTask);
   return true;
 }
 
 bool
 CompositorParent::RecvStop()
 {
   mStopped = true;
   Destroy();
   return true;
 }
 
 void
-CompositorParent::RequestComposition()
+CompositorParent::ScheduleComposition()
 {
   CancelableTask *composeTask = NewRunnableMethod(this, &CompositorParent::Composite);
   MessageLoop::current()->PostTask(FROM_HERE, composeTask);
 }
 
 void
 CompositorParent::Composite()
 {
-  if (mStopped) {
-    return;
-  }
-
-  if (!mLayerManager) {
-    CancelableTask *composeTask = NewRunnableMethod(this, &CompositorParent::Composite);
-    MessageLoop::current()->PostDelayedTask(FROM_HERE, composeTask, 10);
+  if (mStopped || !mLayerManager) {
     return;
   }
 
   mLayerManager->EndEmptyTransaction();
 }
 
-PLayersParent*
-CompositorParent::AllocPLayers(const LayersBackend &backend, const WidgetDescriptor &widget)
+// Go down shadow layer tree, setting properties to match their non-shadow
+// counterparts.
+static void
+SetShadowProperties(Layer* aLayer)
 {
-  if (widget.type() != WidgetDescriptor::TViewWidget) {
-    NS_ERROR("Invalid widget descriptor\n");
-    return NULL;
+  ShadowLayer* shadow = aLayer->AsShadowLayer();
+  shadow->SetShadowTransform(aLayer->GetTransform());
+  shadow->SetShadowVisibleRegion(aLayer->GetVisibleRegion());
+  shadow->SetShadowClipRect(aLayer->GetClipRect());
+
+  for (Layer* child = aLayer->GetFirstChild();
+      child; child = child->GetNextSibling()) {
+    SetShadowProperties(child);
   }
+}
 
-  if (backend == LayerManager::LAYERS_OPENGL) {
-    nsIWidget *nsWidget = (nsIWidget*)widget.get_ViewWidget().widgetPtr();
-    nsRefPtr<LayerManagerOGL> layerManager = new LayerManagerOGL(nsWidget);
+void
+CompositorParent::ShadowLayersUpdated()
+{
+  const nsTArray<PLayersParent*>& shadowParents = ManagedPLayersParent();
+  NS_ABORT_IF_FALSE(shadowParents.Length() <= 1,
+                    "can only support at most 1 ShadowLayersParent");
+  if (shadowParents.Length()) {
+    Layer* root = static_cast<ShadowLayersParent*>(shadowParents[0])->GetRoot();
+    mLayerManager->SetRoot(root);
+    SetShadowProperties(root);
+  }
+  ScheduleComposition();
+}
+
+PLayersParent*
+CompositorParent::AllocPLayers(const LayersBackend &backendType)
+{
+  if (backendType == LayerManager::LAYERS_OPENGL) {
+    nsRefPtr<LayerManagerOGL> layerManager = new LayerManagerOGL(mWidget);
+    mLayerManager = layerManager;
 
     if (!layerManager->Initialize()) {
       NS_ERROR("Failed to init OGL Layers");
       return NULL;
     }
 
     ShadowLayerManager* slm = layerManager->AsShadowManager();
     if (!slm) {
       return NULL;
     }
-
-    void *glContext = layerManager->gl()->GetNativeData(mozilla::gl::GLContext::NativeGLContext);
-    NativeContext nativeContext = NativeContext((uintptr_t)glContext);
-    SendNativeContextCreated(nativeContext);
-
-    mLayerManager = layerManager;
-
     return new ShadowLayersParent(slm, this);
   } else {
     NS_ERROR("Unsupported backend selected for Async Compositor");
     return NULL;
   }
 }
 
 bool
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -38,51 +38,52 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_layers_CompositorParent_h
 #define mozilla_layers_CompositorParent_h
 
 #include "mozilla/layers/PCompositorParent.h"
 #include "mozilla/layers/PLayersParent.h"
-#include "ShadowLayersHost.h"
+#include "ShadowLayersManager.h"
 
-class LayerManager;
+class nsIWidget;
 
 namespace mozilla {
 namespace layers {
 
+class LayerManager;
+
 class CompositorParent : public PCompositorParent,
-                         public ShadowLayersHost
+                         public ShadowLayersManager
 {
-  NS_INLINE_DECL_REFCOUNTING(CompositorParent)
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorParent)
 public:
-  CompositorParent();
+  CompositorParent(nsIWidget* aWidget);
   virtual ~CompositorParent();
 
   bool RecvInit();
   bool RecvStop();
 
-  void RequestComposition();
-
-  virtual mozilla::layout::RenderFrameParent* GetRenderFrameParent() { return NULL; }
-  virtual CompositorParent* GetCompositorParent() { return this; }
-
+  virtual void ShadowLayersUpdated();
   void Destroy();
 
+  LayerManager* GetLayerManager() { return mLayerManager; }
+
 protected:
-  virtual PLayersParent* AllocPLayers(const LayersBackend &backend, const WidgetDescriptor &widget);
-
+  virtual PLayersParent* AllocPLayers(const LayersBackend &backendType);
   virtual bool DeallocPLayers(PLayersParent* aLayers);
 
 private:
+  void ScheduleComposition();
   void Composite();
 
   nsRefPtr<LayerManager> mLayerManager;
   bool mStopped;
+  nsIWidget* mWidget;
 
   DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
 };
 
 } // layers
 } // mozilla
 
 #endif // mozilla_layers_CompositorParent_h
--- a/gfx/layers/ipc/PCompositor.ipdl
+++ b/gfx/layers/ipc/PCompositor.ipdl
@@ -18,16 +18,17 @@
  *
  * The Initial Developer of the Original Code is
  *   The Mozilla Foundation
  * Portions created by the Initial Developer are Copyright (C) 2011
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Benoit Girard <bgirard@mozilla.com>
+ *   Ali Juma <ajuma@mozilla.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -41,51 +42,28 @@
 include protocol PLayers;
 
 using mozilla::LayersBackend;
 using mozilla::null_t;
 
 namespace mozilla {
 namespace layers {
 
-// The Compositor needs to know about the widget to initialize the LayerManager.
-struct ViewWidget {
-  uintptr_t widgetPtr;
-};
-
-// Gives platform specific information about the widget to initialize the LayerManager.
-union WidgetDescriptor {
-  ViewWidget;
-  null_t;
-};
-
-// Cocoa: The widget needs to have access to the native context for resizing
-struct NativeContext {
-  uintptr_t nativeContext;
-};
-
 /**
  * The PCompositor protocol is used to manage communication between
  * the main thread and the compositor thread context. It's primary
  * purpose is to manage the PLayers sub protocol.
  */
 rpc protocol PCompositor
 {
-  // Compositor can manage many Layer Manager (PLayers)
+  // A Compositor manages a single Layer Manager (PLayers)
   manages PLayers;
 
 parent:  
 
   sync Init();
   sync Stop();
 
-  async PLayers(LayersBackend backend, WidgetDescriptor widgetDescriptor);
-
-child:
-
-  // We create the LayerManager async thus we need to notify
-  // content that we have a native context to attach to the widget.
-  async NativeContextCreated(NativeContext aNativeContext);
-
+  async PLayers(LayersBackend backend);
 };
 
 } // layers
 } // mozilla
rename from gfx/layers/ipc/ShadowLayersHost.h
rename to gfx/layers/ipc/ShadowLayersManager.h
--- a/gfx/layers/ipc/ShadowLayersHost.h
+++ b/gfx/layers/ipc/ShadowLayersManager.h
@@ -32,34 +32,32 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef mozilla_layers_ShadowLayersHost_h
-#define mozilla_layers_ShadowLayersHost_h
+#ifndef mozilla_layers_ShadowLayersManager_h
+#define mozilla_layers_ShadowLayersManager_h
 
 namespace mozilla {
 
 namespace layout {
 class RenderFrameParent;
 }
 
 namespace layers {
 
 class CompositorParent;
 
-class ShadowLayersHost
+class ShadowLayersManager
 {
-NS_INLINE_DECL_REFCOUNTING(ShadowLayersHost)
 
 public:
-  virtual mozilla::layout::RenderFrameParent* GetRenderFrameParent() = 0;
-  virtual CompositorParent* GetCompositorParent() = 0;
+  virtual void ShadowLayersUpdated() = 0;
 };
 
 } // layers
 } // mozilla
 
-#endif // mozilla_layers_ShadowLayersHost_h
+#endif // mozilla_layers_ShadowLayersManager_h
--- a/gfx/layers/ipc/ShadowLayersParent.cpp
+++ b/gfx/layers/ipc/ShadowLayersParent.cpp
@@ -117,22 +117,21 @@ ShadowContainer(const OpRemoveChild& op)
 static ShadowLayerParent*
 ShadowChild(const OpRemoveChild& op)
 {
   return cast(op.childLayerParent());
 }
 
 //--------------------------------------------------
 // ShadowLayersParent
-ShadowLayersParent::ShadowLayersParent(ShadowLayerManager* aManager, ShadowLayersHost* aHost)
-  : mDestroyed(false)
+ShadowLayersParent::ShadowLayersParent(ShadowLayerManager* aManager,
+                                       ShadowLayersManager* aLayersManager)
+  : mLayerManager(aManager), mShadowLayersManager(aLayersManager), mDestroyed(false)
 {
   MOZ_COUNT_CTOR(ShadowLayersParent);
-  mLayerManager = aManager;
-  mHost = aHost;
 }
 
 ShadowLayersParent::~ShadowLayersParent()
 {
   MOZ_COUNT_DTOR(ShadowLayersParent);
 }
 
 void
@@ -216,21 +215,16 @@ ShadowLayersParent::RecvUpdate(const Inf
 
       const CommonLayerAttributes& common = attrs.common();
       layer->SetVisibleRegion(common.visibleRegion());
       layer->SetContentFlags(common.contentFlags());
       layer->SetOpacity(common.opacity());
       layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
       layer->SetTransform(common.transform());
       layer->SetTileSourceRect(common.useTileSourceRect() ? &common.tileSourceRect() : NULL);
-      if (mHost->GetCompositorParent()) {
-        layer->AsShadowLayer()->SetShadowTransform(common.transform());
-        layer->AsShadowLayer()->SetShadowVisibleRegion(common.visibleRegion());
-        layer->AsShadowLayer()->SetShadowClipRect(layer->GetClipRect());
-      }
       static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
       if (fixedPositionLayersEnabled) {
         layer->SetIsFixedPosition(common.isFixedPosition());
       }
 
       typedef SpecificLayerAttributes Specific;
       const SpecificLayerAttributes& specific = attrs.specific();
       switch (specific.type()) {
@@ -283,19 +277,16 @@ ShadowLayersParent::RecvUpdate(const Inf
       break;
     }
 
       // Tree ops
     case Edit::TOpSetRoot: {
       MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
 
       mRoot = AsShadowLayer(edit.get_OpSetRoot())->AsContainer();
-      if (mHost->GetCompositorParent()) {
-        mLayerManager->SetRoot(mRoot);
-      }
       break;
     }
     case Edit::TOpInsertAfter: {
       MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
 
       const OpInsertAfter& oia = edit.get_OpInsertAfter();
       ShadowContainer(oia)->AsContainer()->InsertAfter(
         ShadowChild(oia)->AsLayer(), ShadowAfter(oia)->AsLayer());
@@ -387,49 +378,34 @@ ShadowLayersParent::RecvUpdate(const Inf
     reply->AppendElements(&replyv.front(), replyv.size());
   }
 
   // Ensure that any pending operations involving back and front
   // buffers have completed, so that neither process stomps on the
   // other's buffer contents.
   ShadowLayerManager::PlatformSyncBeforeReplyUpdate();
 
-  if (Frame()) {
-    Frame()->ShadowLayersUpdated();
-  }
+  mShadowLayersManager->ShadowLayersUpdated();
 
-  if (mHost->GetCompositorParent()) {
-    mHost->GetCompositorParent()->RequestComposition();
-  }
   return true;
 }
 
 PLayerParent*
 ShadowLayersParent::AllocPLayer()
 {
   return new ShadowLayerParent();
 }
 
 bool
 ShadowLayersParent::DeallocPLayer(PLayerParent* actor)
 {
   delete actor;
   return true;
 }
 
-RenderFrameParent*
-ShadowLayersParent::Frame()
-{
-  if (mDestroyed) {
-    return NULL;
-  } else {
-    return mHost->GetRenderFrameParent();
-  }
-}
-
 void
 ShadowLayersParent::DestroySharedSurface(gfxSharedImageSurface* aSurface)
 {
   layer_manager()->DestroySharedSurface(aSurface, this);
 }
 
 void
 ShadowLayersParent::DestroySharedSurface(SurfaceDescriptor* aSurface)
--- a/gfx/layers/ipc/ShadowLayersParent.h
+++ b/gfx/layers/ipc/ShadowLayersParent.h
@@ -38,17 +38,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_layers_ShadowLayersParent_h
 #define mozilla_layers_ShadowLayersParent_h
 
 #include "mozilla/layers/PLayersParent.h"
 #include "ShadowLayers.h"
-#include "ShadowLayersHost.h"
+#include "ShadowLayersManager.h"
 
 namespace mozilla {
 
 namespace layout {
 class RenderFrameParent;
 }
 
 namespace layers {
@@ -59,17 +59,17 @@ class ShadowLayerManager;
 class ShadowLayersParent : public PLayersParent,
                            public ISurfaceDeAllocator
 {
   typedef mozilla::layout::RenderFrameParent RenderFrameParent;
   typedef InfallibleTArray<Edit> EditArray;
   typedef InfallibleTArray<EditReply> EditReplyArray;
 
 public:
-  ShadowLayersParent(ShadowLayerManager* aManager, ShadowLayersHost* aHost);
+  ShadowLayersParent(ShadowLayerManager* aManager, ShadowLayersManager* aLayersManager);
   ~ShadowLayersParent();
 
   void Destroy();
 
   ShadowLayerManager* layer_manager() const { return mLayerManager; }
 
   ContainerLayer* GetRoot() const { return mRoot; }
 
@@ -79,20 +79,18 @@ public:
 protected:
   NS_OVERRIDE virtual bool RecvUpdate(const EditArray& cset,
                                       EditReplyArray* reply);
 
   NS_OVERRIDE virtual PLayerParent* AllocPLayer();
   NS_OVERRIDE virtual bool DeallocPLayer(PLayerParent* actor);
 
 private:
-  RenderFrameParent* Frame();
-
   nsRefPtr<ShadowLayerManager> mLayerManager;
-  ShadowLayersHost* mHost;
+  ShadowLayersManager* mShadowLayersManager;
   // Hold the root because it might be grafted under various
   // containers in the "real" layer tree
   nsRefPtr<ContainerLayer> mRoot;
   // When the widget/frame/browser stuff in this process begins its
   // destruction process, we need to Disconnect() all the currently
   // live shadow layers, because some of them might be orphaned from
   // the layer tree.  This happens in Destroy() above.  After we
   // Destroy() ourself, there's a window in which that information
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -37,17 +37,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_layout_RenderFrameParent_h
 #define mozilla_layout_RenderFrameParent_h
 
 #include "mozilla/layout/PRenderFrameParent.h"
-#include "mozilla/layers/ShadowLayersHost.h"
+#include "mozilla/layers/ShadowLayersManager.h"
 
 #include <map>
 #include "nsDisplayList.h"
 #include "Layers.h"
 
 class nsContentView;
 class nsFrameLoader;
 class nsSubDocumentFrame;
@@ -56,17 +56,17 @@ namespace mozilla {
 
 namespace layers {
 class ShadowLayersParent;
 }
 
 namespace layout {
 
 class RenderFrameParent : public PRenderFrameParent,
-                          public mozilla::layers::ShadowLayersHost
+                          public mozilla::layers::ShadowLayersManager
 {
   typedef mozilla::layers::FrameMetrics FrameMetrics;
   typedef mozilla::layers::ContainerLayer ContainerLayer;
   typedef mozilla::layers::Layer Layer;
   typedef mozilla::layers::LayerManager LayerManager;
   typedef mozilla::layers::ShadowLayersParent ShadowLayersParent;
   typedef FrameMetrics::ViewID ViewID;
 
@@ -81,35 +81,32 @@ public:
   /**
    * Helper function for getting a non-owning reference to a scrollable.
    * @param aId The ID of the frame.
    */
   nsContentView* GetContentView(ViewID aId = FrameMetrics::ROOT_SCROLL_ID);
 
   void ContentViewScaleChanged(nsContentView* aView);
 
-  void ShadowLayersUpdated();
+  virtual void ShadowLayersUpdated();
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
                               nsSubDocumentFrame* aFrame,
                               const nsRect& aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
                                      nsIFrame* aFrame,
                                      LayerManager* aManager,
                                      const nsIntRect& aVisibleRect);
 
   void OwnerContentChanged(nsIContent* aContent);
 
   void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
 
-  virtual RenderFrameParent* GetRenderFrameParent() { return this; }
-  virtual mozilla::layers::CompositorParent* GetCompositorParent() { return NULL; }
-
 protected:
   NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
 
   NS_OVERRIDE virtual PLayersParent* AllocPLayers(LayerManager::LayersBackend* aBackendType);
   NS_OVERRIDE virtual bool DeallocPLayers(PLayersParent* aLayers);
 
 private:
   void BuildViewMap();
--- a/widget/src/cocoa/nsChildView.h
+++ b/widget/src/cocoa/nsChildView.h
@@ -114,16 +114,20 @@ class gfxASurface;
 class nsChildView;
 class nsCocoaWindow;
 union nsPluginPort;
 
 namespace mozilla {
 namespace gl {
 class TextureImage;
 }
+
+namespace layers {
+class LayerManagerOGL;
+}
 }
 
 #ifndef NP_NO_CARBON
 enum {
   // Currently focused ChildView (while this TSM document is active).
   // Transient (only set while TSMProcessRawKeyEvent() is processing a key
   // event), and the ChildView will be retained and released around the call
   // to TSMProcessRawKeyEvent() -- so it can be weak.
@@ -290,16 +294,19 @@ typedef NSInteger NSEventGestureAxis;
   float mCumulativeRotation;
 
   BOOL mDidForceRefreshOpenGL;
 
   // Support for fluid swipe tracking.
 #ifdef __LP64__
   BOOL *mSwipeAnimationCancelled;
 #endif
+
+  // Whether this uses off-main-thread compositing.
+  BOOL mUsingOMTCompositor;
 }
 
 // class initialization
 + (void)initialize;
 
 // these are sent to the first responder when the window key status changes
 - (void)viewsWindowDidBecomeKey;
 - (void)viewsWindowDidResignKey;
@@ -345,16 +352,18 @@ typedef NSInteger NSEventGestureAxis;
 - (void)rotateWithEvent:(NSEvent *)anEvent;
 - (void)endGestureWithEvent:(NSEvent *)anEvent;
 
 // Support for fluid swipe tracking.
 #ifdef __LP64__
 - (void)maybeTrackScrollEventAsSwipe:(NSEvent *)anEvent
                       scrollOverflow:(PRInt32)overflow;
 #endif
+
+- (void)setUsingOMTCompositor:(BOOL)aUseOMTC;
 @end
 
 class ChildViewMouseTracker {
 
 public:
 
   static void MouseMoved(NSEvent* aEvent);
   static void MouseScrolled(NSEvent* aEvent);
@@ -484,16 +493,17 @@ public:
   // Mac specific methods
   
   virtual bool      DispatchWindowEvent(nsGUIEvent& event);
   
 #ifdef ACCESSIBILITY
   already_AddRefed<nsAccessible> GetDocumentAccessible();
 #endif
 
+  virtual void CreateCompositor();
   virtual gfxASurface* GetThebesSurface();
   virtual void DrawOver(LayerManager* aManager, nsIntRect aRect);
 
   virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries);
 
   NS_IMETHOD BeginSecureKeyboardInput();
   NS_IMETHOD EndSecureKeyboardInput();
 
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -97,18 +97,16 @@
 #include <ApplicationServices/ApplicationServices.h>
 
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::gl;
 using namespace mozilla::widget;
 using namespace mozilla;
 
-using compositor::ShadowNativeContextUserData;
-
 #undef DEBUG_UPDATE
 #undef INVALIDATE_DEBUGGING  // flash areas as they are invalidated
 
 // Don't put more than this many rects in the dirty region, just fluff
 // out to the bounding-box if there are more
 #define MAX_RECTS_IN_REGION 100
 
 #ifdef PR_LOGGING
@@ -1781,16 +1779,32 @@ NSView<mozView>* nsChildView::GetEditorV
     if (view)
       editorView = view;
   }
   return editorView;
 }
 
 #pragma mark -
 
+void
+nsChildView::CreateCompositor()
+{
+  nsBaseWidget::CreateCompositor();
+  if (mCompositorChild) {
+    LayerManagerOGL *manager =
+      static_cast<LayerManagerOGL*>(compositor::GetLayerManager(mCompositorParent));
+
+    NSOpenGLContext *glContext =
+      (NSOpenGLContext *) manager->gl()->GetNativeData(GLContext::NativeGLContext);
+
+    [(ChildView *)mView setGLContext:glContext];
+    [(ChildView *)mView setUsingOMTCompositor:true];
+  }
+}
+
 gfxASurface*
 nsChildView::GetThebesSurface()
 {
   if (!mTempThebesSurface) {
     mTempThebesSurface = new gfxQuartzSurface(gfxSize(1, 1), gfxASurface::ImageFormatARGB32);
   }
 
   return mTempThebesSurface;
@@ -2585,27 +2599,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
     // Force OpenGL to refresh the very first time we draw. This works around a
     // Mac OS X bug that stops windows updating on OS X when we use OpenGL.
     if (!mDidForceRefreshOpenGL) {
       [self performSelector:@selector(forceRefreshOpenGL) withObject:nil afterDelay:0];
       mDidForceRefreshOpenGL = YES;
     }
 
     return;
-  } else if (layerManager->AsShadowManager() &&
-             layerManager->GetUserData(&compositor::sShadowNativeContext)) {
-    NSOpenGLContext *glContext;
-
-    ShadowNativeContextUserData *userData =
-        (ShadowNativeContextUserData*)layerManager->GetUserData(&compositor::sShadowNativeContext);
-      glContext = (NSOpenGLContext*)userData->GetNativeContext();
-
-    if (!mGLContext) {
-      [self setGLContext:glContext];
-    }
   }
 
   // Create Cairo objects.
   NSSize bufferSize = [self bounds].size;
   nsRefPtr<gfxQuartzSurface> targetSurface =
     new gfxQuartzSurface(aContext, gfxSize(bufferSize.width, bufferSize.height));
   targetSurface->SetAllowUseAsSource(false);
 
@@ -2628,18 +2631,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
     nsBaseWidget::AutoLayerManagerSetup
       setupLayerManager(mGeckoChild, targetContext, BasicLayerManager::BUFFER_NONE);
     painted = mGeckoChild->DispatchWindowEvent(paintEvent);
   }
 
   // Force OpenGL to refresh the very first time we draw. This works around a
   // Mac OS X bug that stops windows updating on OS X when we use OpenGL.
   if (painted && !mDidForceRefreshOpenGL &&
-      layerManager->AsShadowManager() &&
-      layerManager->GetUserData(&compositor::sShadowNativeContext)) {
+      layerManager->AsShadowManager() && mUsingOMTCompositor) {
     if (!mDidForceRefreshOpenGL) {
       [self performSelector:@selector(forceRefreshOpenGL) withObject:nil afterDelay:0];
       mDidForceRefreshOpenGL = YES;
     }
   }
 
   if (!painted && [self isOpaque]) {
     // Gecko refused to draw, but we've claimed to be opaque, so we have to
@@ -3174,16 +3176,22 @@ NSEvent* gLastDragMouseDownEvent = nil;
   // We keep a pointer to the __block variable (animationCanceled) so we
   // can cancel our block handler at any time.  Note: We must assign
   // &animationCanceled after our block creation and copy -- its address
   // isn't resolved until then!
   mSwipeAnimationCancelled = &animationCancelled;
 }
 #endif // #ifdef __LP64__
 
+- (void)setUsingOMTCompositor:(BOOL)aUseOMTC
+{
+  mUsingOMTCompositor = aUseOMTC;
+}
+
+
 // Returning NO from this method only disallows ordering on mousedown - in order
 // to prevent it for mouseup too, we need to call [NSApp preventWindowOrdering]
 // when handling the mousedown event.
 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)aEvent
 {
   // Always using system-provided window ordering for normal windows.
   if (![[self window] isKindOfClass:[PopupWindow class]])
     return NO;
--- a/widget/src/xpwidgets/nsBaseWidget.cpp
+++ b/widget/src/xpwidgets/nsBaseWidget.cpp
@@ -52,31 +52,34 @@
 #include "nsIContent.h"
 #include "nsIServiceManager.h"
 #include "mozilla/Preferences.h"
 #include "BasicLayers.h"
 #include "LayerManagerOGL.h"
 #include "nsIXULRuntime.h"
 #include "nsIGfxInfo.h"
 #include "npapi.h"
+#include "base/thread.h"
 
 #ifdef DEBUG
 #include "nsIObserver.h"
 
 static void debug_RegisterPrefCallbacks();
 
 static bool debug_InSecureKeyboardInputMode = false;
 #endif
 
 #ifdef NOISY_WIDGET_LEAKS
 static PRInt32 gNumWidgets;
 #endif
 
 using namespace mozilla::layers;
 using namespace mozilla;
+using base::Thread;
+using mozilla::ipc::AsyncChannel;
 
 nsIContent* nsBaseWidget::mLastRollup = nsnull;
 
 // nsBaseWidget
 NS_IMPL_ISUPPORTS1(nsBaseWidget, nsIWidget)
 
 
 nsAutoRollup::nsAutoRollup()
@@ -101,16 +104,17 @@ nsAutoRollup::~nsAutoRollup()
 //-------------------------------------------------------------------------
 
 nsBaseWidget::nsBaseWidget()
 : mClientData(nsnull)
 , mViewWrapperPtr(nsnull)
 , mEventCallback(nsnull)
 , mViewCallback(nsnull)
 , mContext(nsnull)
+, mCompositorThread(nsnull)
 , mCursor(eCursor_standard)
 , mWindowType(eWindowType_child)
 , mBorderStyle(eBorderStyle_none)
 , mOnDestroyCalled(false)
 , mUseAcceleratedRendering(false)
 , mTemporarilyUseBasicLayerManager(false)
 , mBounds(0,0,0,0)
 , mOriginalBounds(nsnull)
@@ -139,21 +143,22 @@ nsBaseWidget::~nsBaseWidget()
 {
   if (mLayerManager &&
       mLayerManager->GetBackendType() == LayerManager::LAYERS_BASIC) {
     static_cast<BasicLayerManager*>(mLayerManager.get())->ClearRetainerWidget();
   }
 
   if (mLayerManager) {
     mLayerManager->Destroy();
-    mLayerManager = NULL;
+    mLayerManager = nsnull;
   }
 
-  if (mCompositor) {
-    mCompositor->Destroy();
+  if (mCompositorChild) {
+    mCompositorChild->Destroy();
+    delete mCompositorThread;
   }
 
 #ifdef NOISY_WIDGET_LEAKS
   gNumWidgets--;
   printf("WIDGETS- = %d\n", gNumWidgets);
 #endif
 
   NS_IF_RELEASE(mContext);
@@ -816,59 +821,67 @@ nsBaseWidget::GetShouldAccelerate()
 
   if (accelerateByDefault)
     return true;
 
   /* use the window acceleration flag */
   return mUseAcceleratedRendering;
 }
 
+void nsBaseWidget::CreateCompositor()
+{
+  mCompositorParent = new CompositorParent(this);
+  mCompositorThread = new Thread("CompositorThread");
+  if (mCompositorThread->Start()) {
+    LayerManager* lm = CreateBasicLayerManager();
+    MessageLoop *childMessageLoop = mCompositorThread->message_loop();
+    mCompositorChild = new CompositorChild(lm);
+    AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
+    AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
+    mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
+    PLayersChild* shadowManager = mCompositorChild->SendPLayersConstructor(                                                LayerManager::LAYERS_OPENGL);
+
+    if (shadowManager) {
+      mCompositorChild->SendInit();
+      ShadowLayerForwarder* lf = lm->AsShadowForwarder();
+      if (!lf) {
+        delete lm;
+        mCompositorChild = nsnull;
+      }
+      lf->SetShadowManager(shadowManager);
+      lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);
+
+      mLayerManager = lm;
+    } else {
+      NS_WARNING("fail to construct LayersChild");
+      delete lm;
+      mCompositorChild = nsnull;
+    }
+  }
+}
+
 LayerManager* nsBaseWidget::GetLayerManager(PLayersChild* aShadowManager,
                                             LayersBackend aBackendHint,
                                             LayerManagerPersistence aPersistence,
                                             bool* aAllowRetaining)
 {
   if (!mLayerManager) {
 
     mUseAcceleratedRendering = GetShouldAccelerate();
 
     if (mUseAcceleratedRendering) {
 
       // Try to use an async compositor first, if possible
       bool useCompositor =
         Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
       if (useCompositor) {
-        LayerManager* lm = CreateBasicLayerManager();
-        mCompositorParent = new CompositorParent();
-        mCompositor = CompositorChild::CreateCompositor(lm, mCompositorParent);
-
-        if (mCompositor) {
-          // 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 == NULL, "Async Compositor not supported with e10s");
-          WidgetDescriptor desc = ViewWidget((uintptr_t)dynamic_cast<nsIWidget*>(this));
-          PLayersChild* shadowManager = mCompositor->SendPLayersConstructor(
-                                          LayerManager::LAYERS_OPENGL,
-                                          desc);
-
-          if (shadowManager) {
-            ShadowLayerForwarder* lf = lm->AsShadowForwarder();
-            if (!lf) {
-              delete lm;
-              mCompositor = NULL;
-            }
-            lf->SetShadowManager(shadowManager);
-            lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);
-
-            mLayerManager = lm;
-          } else {
-            NS_WARNING("fail to construct LayersChild");
-            mCompositor = NULL;
-          }
-        }
+        // 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 == nsnull, "Async Compositor not supported with e10s");
+        CreateCompositor();
       }
 
       if (!mLayerManager) {
         nsRefPtr<LayerManagerOGL> layerManager = new LayerManagerOGL(this);
         /**
          * XXX - On several OSes initialization is expected to fail for now.
          * If we'd get a none-basic layer manager they'd crash. This is ok though
          * since on those platforms it will fail. Anyone implementing new
--- a/widget/src/xpwidgets/nsBaseWidget.h
+++ b/widget/src/xpwidgets/nsBaseWidget.h
@@ -53,34 +53,38 @@ class gfxContext;
 
 namespace mozilla {
 namespace layers {
 class CompositorChild;
 class CompositorParent;
 }
 }
 
-using mozilla::layers::CompositorChild;
-using mozilla::layers::CompositorParent;
+namespace base {
+class Thread;
+}
 
 /**
  * Common widget implementation used as base class for native
  * or crossplatform implementations of Widgets. 
  * All cross-platform behavior that all widgets need to implement 
  * should be placed in this class. 
  * (Note: widget implementations are not required to use this
  * class, but it gives them a head start.)
  */
 
 class nsBaseWidget : public nsIWidget
 {
   friend class nsAutoRollup;
 
 protected:
   typedef mozilla::layers::BasicLayerManager BasicLayerManager;
+  typedef mozilla::layers::CompositorChild CompositorChild;
+  typedef mozilla::layers::CompositorParent CompositorParent;
+  typedef base::Thread Thread;
 
 public:
   nsBaseWidget();
   virtual ~nsBaseWidget();
   
   NS_DECL_ISUPPORTS
   
   // nsIWidget interface
@@ -122,16 +126,17 @@ public:
   NS_IMETHOD              HideWindowChrome(bool aShouldHide);
   NS_IMETHOD              MakeFullScreen(bool aFullScreen);
   virtual nsDeviceContext* GetDeviceContext();
   virtual LayerManager*   GetLayerManager(PLayersChild* aShadowManager = nsnull,
                                           LayersBackend aBackendHint = LayerManager::LAYERS_NONE,
                                           LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
                                           bool* aAllowRetaining = nsnull);
 
+  virtual void            CreateCompositor();
   virtual void            DrawOver(LayerManager* aManager, nsIntRect aRect) {}
   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {}
   virtual gfxASurface*    GetThebesSurface();
   NS_IMETHOD              SetModal(bool aModal); 
   NS_IMETHOD              SetWindowClass(const nsAString& xulWinType);
   NS_IMETHOD              MoveClient(PRInt32 aX, PRInt32 aY);
   NS_IMETHOD              ResizeClient(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
   NS_IMETHOD              ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
@@ -273,18 +278,19 @@ protected:
 protected:
   void*             mClientData;
   ViewWrapper*      mViewWrapperPtr;
   EVENT_CALLBACK    mEventCallback;
   EVENT_CALLBACK    mViewCallback;
   nsDeviceContext* mContext;
   nsRefPtr<LayerManager> mLayerManager;
   nsRefPtr<LayerManager> mBasicLayerManager;
-  nsRefPtr<CompositorChild> mCompositor;
+  nsRefPtr<CompositorChild> mCompositorChild;
   nsRefPtr<CompositorParent> mCompositorParent;
+  Thread*           mCompositorThread;
   nscolor           mBackground;
   nscolor           mForeground;
   nsCursor          mCursor;
   nsWindowType      mWindowType;
   nsBorderStyle     mBorderStyle;
   bool              mOnDestroyCalled;
   bool              mUseAcceleratedRendering;
   bool              mTemporarilyUseBasicLayerManager;