Address next set of review comments.
authorAli Juma <ajuma@mozilla.com>
Mon, 16 Jan 2012 10:31:16 -0500
changeset 90846 655e933a80b24bb8c70b8b40916fef22b0e093cc
parent 90845 5e2da9e110c9c6bd908805cf26854ae9285061dc
child 90847 c96dd4bb2388791dd00da266b64df574f33dfe26
push idunknown
push userunknown
push dateunknown
milestone12.0a1
Address next set of review comments.
gfx/layers/Makefile.in
gfx/layers/ipc/Compositor.cpp
gfx/layers/ipc/Compositor.h
gfx/layers/ipc/CompositorChild.cpp
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
gfx/layers/ipc/PCompositor.ipdl
layout/ipc/RenderFrameParent.h
widget/cocoa/Makefile.in
widget/cocoa/nsChildView.mm
widget/xpwidgets/nsBaseWidget.cpp
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -126,27 +126,25 @@ CPPSRCS += \
         ThebesLayerD3D10.cpp \
         $(NULL)
 endif
 endif
 
 EXPORTS_NAMESPACES = gfxipc mozilla/layers
 EXPORTS_gfxipc = ShadowLayerUtils.h
 EXPORTS_mozilla/layers =\
-        Compositor.h \
         CompositorChild.h \
         CompositorParent.h \
         ShadowLayers.h \
         ShadowLayersChild.h \
         ShadowLayersParent.h \
         ShadowLayersManager.h \
         $(NULL)
 
 CPPSRCS += \
-        Compositor.cpp \
         CompositorChild.cpp \
         CompositorParent.cpp \
         ShadowLayers.cpp \
         ShadowLayerChild.cpp \
         ShadowLayersChild.cpp \
         ShadowLayerParent.cpp \
         ShadowLayersParent.cpp \
         $(NULL)
deleted file mode 100644
--- a/gfx/layers/ipc/Compositor.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=2 et tw=80 : */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Content App.
- *
- * 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 ***** */
-
-#include "CompositorParent.h"
-#include "Compositor.h"
-#include "nsDebug.h"
-
-namespace mozilla {
-namespace layers {
-namespace compositor {
-
-LayerManager*
-GetLayerManager(CompositorParent* aParent)
-{
-  return aParent->GetLayerManager();
-}
-
-
-}
-}
-}
deleted file mode 100644
--- a/gfx/layers/ipc/Compositor.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set sw=4 ts=8 et tw=80 : */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Content App.
- *
- * 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>
- *
- * 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
-
-// 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 {
-
-// 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
@@ -35,22 +35,20 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "CompositorChild.h"
 #include "CompositorParent.h"
-#include "Compositor.h"
 #include "LayerManagerOGL.h"
 #include "mozilla/layers/ShadowLayersChild.h"
 
 using mozilla::layers::ShadowLayersChild;
-using namespace mozilla::layers::compositor;
 
 namespace mozilla {
 namespace layers {
 
 CompositorChild::CompositorChild(LayerManager *aLayerManager)
   : mLayerManager(aLayerManager)
 {
   MOZ_COUNT_CTOR(CompositorChild);
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -52,23 +52,16 @@ 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");
 
   // Ensure that the layer manager is destroyed on the compositor thread.
   mLayerManager = NULL;
@@ -99,16 +92,17 @@ CompositorParent::Composite()
   mLayerManager->EndEmptyTransaction();
 }
 
 // Go down shadow layer tree, setting properties to match their non-shadow
 // counterparts.
 static void
 SetShadowProperties(Layer* aLayer)
 {
+  // FIXME: Bug 717688 -- Do these updates in ShadowLayersParent::RecvUpdate.
   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);
@@ -129,16 +123,17 @@ CompositorParent::ShadowLayersUpdated()
   ScheduleComposition();
 }
 
 PLayersParent*
 CompositorParent::AllocPLayers(const LayersBackend &backendType)
 {
   if (backendType == LayerManager::LAYERS_OPENGL) {
     nsRefPtr<LayerManagerOGL> layerManager = new LayerManagerOGL(mWidget);
+    mWidget = NULL;
     mLayerManager = layerManager;
 
     if (!layerManager->Initialize()) {
       NS_ERROR("Failed to init OGL Layers");
       return NULL;
     }
 
     ShadowLayerManager* slm = layerManager->AsShadowManager();
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -55,22 +55,19 @@ class LayerManager;
 class CompositorParent : public PCompositorParent,
                          public ShadowLayersManager
 {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorParent)
 public:
   CompositorParent(nsIWidget* aWidget);
   virtual ~CompositorParent();
 
-  bool RecvStop();
+  virtual bool RecvStop() MOZ_OVERRIDE;
 
-  // Workaround for Bug 717027.
-  bool RecvFixMeDoNotCall();
-
-  virtual void ShadowLayersUpdated();
+  virtual void ShadowLayersUpdated() MOZ_OVERRIDE;
   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
@@ -59,16 +59,13 @@ rpc protocol PCompositor
   // A Compositor manages a single Layer Manager (PLayers)
   manages PLayers;
 
 parent:  
 
   // Clean up in preparation for destruction.
   sync Stop();
 
-  // Workaround for Bug 717027.
-  async FixMeDoNotCall();
-
   sync PLayers(LayersBackend backend);
 };
 
 } // layers
 } // mozilla
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -81,17 +81,17 @@ 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);
 
-  virtual void ShadowLayersUpdated();
+  virtual void ShadowLayersUpdated() MOZ_OVERRIDE;
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
                               nsSubDocumentFrame* aFrame,
                               const nsRect& aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
                                      nsIFrame* aFrame,
--- a/widget/cocoa/Makefile.in
+++ b/widget/cocoa/Makefile.in
@@ -140,8 +140,10 @@ LOCAL_INCLUDES	= \
 	-I$(srcdir)/../xpwidgets \
 	$(NULL)
 
 LDFLAGS	+= \
 	-framework QuickTime \
 	-framework IOKit \
 	-F/System/Library/PrivateFrameworks -framework CoreUI \
 	$(NULL)
+
+include $(topsrcdir)/ipc/chromium/chromium-config.mk
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -36,20 +36,19 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "mozilla/layers/CompositorParent.h"
 #include "mozilla/Util.h"
 
-#include "mozilla/layers/Compositor.h"
-
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG
 #endif
 #include "prlog.h"
 
 #include <unistd.h>
 #include <math.h>
  
@@ -1773,17 +1772,17 @@ NSView<mozView>* nsChildView::GetEditorV
 #pragma mark -
 
 void
 nsChildView::CreateCompositor()
 {
   nsBaseWidget::CreateCompositor();
   if (mCompositorChild) {
     LayerManagerOGL *manager =
-      static_cast<LayerManagerOGL*>(compositor::GetLayerManager(mCompositorParent));
+      static_cast<LayerManagerOGL*>(mCompositorParent->GetLayerManager());
 
     NSOpenGLContext *glContext =
       (NSOpenGLContext *) manager->gl()->GetNativeData(GLContext::NativeGLContext);
 
     [(ChildView *)mView setGLContext:glContext];
     [(ChildView *)mView setUsingOMTCompositor:true];
   }
 }
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -832,17 +832,18 @@ void nsBaseWidget::CreateCompositor()
   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);
+    PLayersChild* shadowManager =
+      mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL);
 
     if (shadowManager) {
       ShadowLayerForwarder* lf = lm->AsShadowForwarder();
       if (!lf) {
         delete lm;
         mCompositorChild = nsnull;
       }
       lf->SetShadowManager(shadowManager);
@@ -877,17 +878,17 @@ LayerManager* nsBaseWidget::GetLayerMana
         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
+         * If we'd get a non-basic layer manager they'd crash. This is ok though
          * since on those platforms it will fail. Anyone implementing new
          * platforms on LayerManagerOGL should ensure their widget is able to
          * deal with it though!
          */
         if (layerManager->Initialize()) {
           mLayerManager = layerManager;
         }
       }