Don't use nsIWidget to check APZ in LayerManagerComposite. (bug 1269653 part 1, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Tue, 03 May 2016 17:37:34 -0700
changeset 296036 3a4e68d0112b13c94e47e0f11b73aafdeebd844a
parent 296035 8a037cb33a3d93a6a2c7aeec3b725eb796713b43
child 296037 2872b9050cab51f33bc0d95b72461a990b80dd34
push id30230
push usercbook@mozilla.com
push dateWed, 04 May 2016 09:55:16 +0000
treeherdermozilla-central@311c7ea8803d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1269653
milestone49.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
Don't use nsIWidget to check APZ in LayerManagerComposite. (bug 1269653 part 1, r=kats)
gfx/layers/Compositor.h
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/ipc/CompositorBridgeParent.h
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -528,16 +528,19 @@ public:
   TimeStamp GetCompositeUntilTime() const {
     return mCompositeUntilTime;
   }
 
   // A stale Compositor has no CompositorBridgeParent; it will not process
   // frames and should not be used.
   void SetInvalid();
   bool IsValid() const;
+  CompositorBridgeParent* GetCompositorBridgeParent() const {
+    return mParent;
+  }
 
 protected:
   void DrawDiagnosticsInternal(DiagnosticFlags aFlags,
                                const gfx::Rect& aVisibleRect,
                                const gfx::Rect& aClipRect,
                                const gfx::Matrix4x4& transform,
                                uint32_t aFlashCounter);
 
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -63,16 +63,17 @@
 #include "ScopedGLHelpers.h"
 #endif
 #ifdef MOZ_WIDGET_GONK
 #include "nsScreenManagerGonk.h"
 #include "nsWindow.h"
 #endif
 #include "GeckoProfiler.h"
 #include "TextRenderer.h"               // for TextRenderer
+#include "mozilla/layers/CompositorBridgeParent.h"
 
 class gfxContext;
 
 namespace mozilla {
 namespace layers {
 
 class ImageLayer;
 
@@ -1542,17 +1543,20 @@ LayerComposite::SetLayerManager(LayerMan
 {
   mCompositeManager = aManager;
   mCompositor = aManager->GetCompositor();
 }
 
 bool
 LayerManagerComposite::AsyncPanZoomEnabled() const
 {
-  return mCompositor->GetWidget()->RealWidget()->AsyncPanZoomEnabled();
+  if (CompositorBridgeParent* bridge = mCompositor->GetCompositorBridgeParent()) {
+    return bridge->AsyncPanZoomEnabled();
+  }
+  return false;
 }
 
 nsIntRegion
 LayerComposite::GetFullyRenderedRegion() {
   if (TiledContentHost* tiled = GetCompositableHost() ? GetCompositableHost()->AsTiledContentHost()
                                                         : nullptr) {
     nsIntRegion shadowVisibleRegion = GetShadowVisibleRegion().ToUnknownRegion();
     // Discard the region which hasn't been drawn yet when doing
--- a/gfx/layers/ipc/CompositorBridgeParent.h
+++ b/gfx/layers/ipc/CompositorBridgeParent.h
@@ -511,16 +511,19 @@ public:
    * aContentParent The ContentParent for the process that the TabChild for
    *                aTabId lives in.
    * aBrowserParent The toplevel TabParent for aTabId.
    */
   static bool UpdateRemoteContentController(uint64_t aLayersId,
                                             dom::ContentParent* aContentParent,
                                             const dom::TabId& aTabId,
                                             dom::TabParent* aBrowserParent);
+  bool AsyncPanZoomEnabled() const {
+    return !!mApzcTreeManager;
+  }
 
 protected:
   // Protected destructor, to discourage deletion outside of Release():
   virtual ~CompositorBridgeParent();
 
   void DeferredDestroy();
 
   virtual PLayerTransactionParent*