More handling review comments for Bug 711168.
authorAli Juma <ajuma@mozilla.com>
Tue, 10 Jan 2012 18:04:21 -0500
changeset 92342 a3c28289621179e72d3c46b5a067116f06b07020
parent 92341 bf899571b52b4249f6c382d09211ad69a947035b
child 92343 bc3f0f7c0a073aa8a690ddf6db5cb9f603bb6a2a
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
More handling review comments for Bug 711168.
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
gfx/layers/ipc/PCompositor.ipdl
widget/src/xpwidgets/nsBaseWidget.cpp
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -52,27 +52,31 @@ CompositorParent::CompositorParent(nsIWi
   MOZ_COUNT_CTOR(CompositorParent);
 }
 
 CompositorParent::~CompositorParent()
 {
   MOZ_COUNT_DTOR(CompositorParent);
 }
 
+bool
+CompositorParent::RecvFixMeDoNotCall()
+{
+  NS_RUNTIMEABORT("not reached");
+  return NULL;
+}
+
 void
 CompositorParent::Destroy()
 {
   NS_ABORT_IF_FALSE(ManagedPLayersParent().Length() == 0,
                     "CompositorParent destroyed before managed PLayersParent");
-}
 
-bool
-CompositorParent::RecvInit()
-{
-  return true;
+  // Ensure that the layer manager is destroyed on the compositor thread.
+  mLayerManager = NULL;
 }
 
 bool
 CompositorParent::RecvStop()
 {
   mStopped = true;
   Destroy();
   return true;
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -55,19 +55,21 @@ class LayerManager;
 class CompositorParent : public PCompositorParent,
                          public ShadowLayersManager
 {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorParent)
 public:
   CompositorParent(nsIWidget* aWidget);
   virtual ~CompositorParent();
 
-  bool RecvInit();
   bool RecvStop();
 
+  // Workaround for Bug 717027.
+  bool RecvFixMeDoNotCall();
+
   virtual void ShadowLayersUpdated();
   void Destroy();
 
   LayerManager* GetLayerManager() { return mLayerManager; }
 
 protected:
   virtual PLayersParent* AllocPLayers(const LayersBackend &backendType);
   virtual bool DeallocPLayers(PLayersParent* aLayers);
--- a/gfx/layers/ipc/PCompositor.ipdl
+++ b/gfx/layers/ipc/PCompositor.ipdl
@@ -47,23 +47,28 @@ using mozilla::null_t;
 namespace mozilla {
 namespace layers {
 
 /**
  * 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.
  */
+// This should really be 'sync', but we're using 'rpc' as a workaround
+// for Bug 716631.
 rpc protocol PCompositor
 {
   // A Compositor manages a single Layer Manager (PLayers)
   manages PLayers;
 
 parent:  
 
-  sync Init();
+  // Clean up in preparation for destruction.
   sync Stop();
 
-  async PLayers(LayersBackend backend);
+  // Workaround for Bug 717027.
+  async FixMeDoNotCall();
+
+  sync PLayers(LayersBackend backend);
 };
 
 } // layers
 } // mozilla
--- a/widget/src/xpwidgets/nsBaseWidget.cpp
+++ b/widget/src/xpwidgets/nsBaseWidget.cpp
@@ -835,17 +835,16 @@ void nsBaseWidget::CreateCompositor()
     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);