Bug 958596 - Print ScrollableLayerGuids of APZCs when printing the tree. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 22 Jan 2014 18:44:59 -0500
changeset 188742 0ed4786b22de571502f054b6156c6cb669f09a61
parent 188741 62b54b8fa885be299d138034b2ff7470317db429
child 188743 350d43769841829183d79458336ed577c9eb5350
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs958596
milestone30.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
Bug 958596 - Print ScrollableLayerGuids of APZCs when printing the tree. r=kats
gfx/layers/FrameMetrics.h
gfx/layers/composite/APZCTreeManager.cpp
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -7,16 +7,17 @@
 #define GFX_FRAMEMETRICS_H
 
 #include <stdint.h>                     // for uint32_t, uint64_t
 #include <string>                       // for std::string
 #include "Units.h"                      // for CSSRect, CSSPixel, etc
 #include "mozilla/gfx/BasePoint.h"      // for BasePoint
 #include "mozilla/gfx/Rect.h"           // for RoundedIn
 #include "mozilla/gfx/ScaleFactor.h"    // for ScaleFactor
+#include "mozilla/gfx/Logging.h"        // for Log
 
 namespace IPC {
 template <typename T> struct ParamTraits;
 } // namespace IPC
 
 namespace mozilla {
 namespace layers {
 
@@ -420,16 +421,21 @@ struct ScrollableLayerGuid {
   }
 
   bool operator!=(const ScrollableLayerGuid& other) const
   {
     return !(*this == other);
   }
 };
 
+template <int LogLevel>
+gfx::Log<LogLevel>& operator<<(gfx::Log<LogLevel>& log, const ScrollableLayerGuid& aGuid) {
+  return log << '(' << aGuid.mLayersId << ',' << aGuid.mPresShellId << ',' << aGuid.mScrollId << ')';
+}
+
 struct ZoomConstraints {
   bool mAllowZoom;
   bool mAllowDoubleTapZoom;
   CSSToScreenScale mMinZoom;
   CSSToScreenScale mMaxZoom;
 
   ZoomConstraints()
     : mAllowZoom(true)
--- a/gfx/layers/composite/APZCTreeManager.cpp
+++ b/gfx/layers/composite/APZCTreeManager.cpp
@@ -163,30 +163,30 @@ APZCTreeManager::UpdatePanZoomController
         // it has an APZC instance to manage its scrolling.
 
         apzc = container->GetAsyncPanZoomController();
 
         // If the content represented by the container layer has changed (which may
         // be possible because of DLBI heuristics) then we don't want to keep using
         // the same old APZC for the new content. Null it out so we run through the
         // code to find another one or create one.
-        if (apzc && !apzc->Matches(ScrollableLayerGuid(aLayersId, container->GetFrameMetrics()))) {
+        ScrollableLayerGuid guid(aLayersId, container->GetFrameMetrics());
+        if (apzc && !apzc->Matches(guid)) {
           apzc = nullptr;
         }
 
         // If the container doesn't have an APZC already, try to find one of our
         // pre-existing ones that matches. In particular, if we find an APZC whose
         // ScrollableLayerGuid is the same, then we know what happened is that the
         // layout of the page changed causing the layer tree to be rebuilt, but the
         // underlying content for which the APZC was originally created is still
         // there. So it makes sense to pick up that APZC instance again and use it here.
         if (apzc == nullptr) {
-          ScrollableLayerGuid target(aLayersId, container->GetFrameMetrics());
           for (size_t i = 0; i < aApzcsToDestroy->Length(); i++) {
-            if (aApzcsToDestroy->ElementAt(i)->Matches(target)) {
+            if (aApzcsToDestroy->ElementAt(i)->Matches(guid)) {
               apzc = aApzcsToDestroy->ElementAt(i);
               break;
             }
           }
         }
 
         // The APZC we get off the layer may have been destroyed previously if the layer was inactive
         // or omitted from the layer tree for whatever reason from a layers update. If it later comes
@@ -227,17 +227,17 @@ APZCTreeManager::UpdatePanZoomController
         gfx3DMatrix transform;
         gfx::To3DMatrix(aLayer->GetTransform(), transform);
 
         apzc->SetLayerHitTestData(visible, aTransform, transform);
         APZC_LOG("Setting rect(%f %f %f %f) as visible region for APZC %p\n", visible.x, visible.y,
                                                                               visible.width, visible.height,
                                                                               apzc);
 
-        mApzcTreeLog << "APZC "
+        mApzcTreeLog << "APZC " << guid
                      << "\tcb=" << visible
                      << "\tsr=" << container->GetFrameMetrics().mScrollableRect
                      << "\t" << container->GetFrameMetrics().GetContentDescription();
 
         // Bind the APZC instance into the tree of APZCs
         if (aNextSibling) {
           aNextSibling->SetPrevSibling(apzc);
         } else if (aParent) {