Bug 1384181 - Add utility dump functions for debugging. r=jrmuizel
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 26 Jul 2017 14:47:49 -0400
changeset 422245 691af1e600e06fcee33478a39d03c43a24c5d2e8
parent 422244 3a1dfb72b22525011e741e4c51700151155932a7
child 422246 02874c4ecef40f64645fee4eb62f2fa0a1323df9
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1384181
milestone56.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 1384181 - Add utility dump functions for debugging. r=jrmuizel MozReview-Commit-ID: 5YJLGhnMkwG
gfx/layers/wr/WebRenderScrollData.cpp
gfx/layers/wr/WebRenderScrollData.h
--- a/gfx/layers/wr/WebRenderScrollData.cpp
+++ b/gfx/layers/wr/WebRenderScrollData.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/WebRenderScrollData.h"
 
 #include "Layers.h"
+#include "LayersLogging.h"
 #include "mozilla/layout/RenderFrameParent.h"
 #include "mozilla/Unused.h"
 #include "nsTArray.h"
 #include "UnitTransforms.h"
 
 namespace mozilla {
 namespace layers {
 
@@ -123,16 +124,37 @@ WebRenderLayerScrollData::GetScrollMetad
 }
 
 CSSTransformMatrix
 WebRenderLayerScrollData::GetTransformTyped() const
 {
   return ViewAs<CSSTransformMatrix>(GetTransform());
 }
 
+void
+WebRenderLayerScrollData::Dump(const WebRenderScrollData& aOwner) const
+{
+  printf_stderr("LayerScrollData(%p) descendants %d\n", this, mDescendantCount);
+  for (size_t i : mScrollIds) {
+    printf_stderr("  metadata: %s\n", Stringify(aOwner.GetScrollMetadata(i)).c_str());
+  }
+  printf_stderr("  transform: %s perspective: %d visible: %s\n",
+    Stringify(mTransform).c_str(), mTransformIsPerspective,
+    Stringify(mVisibleRegion).c_str());
+  printf_stderr("  event regions: %s override: 0x%x\n",
+    Stringify(mEventRegions).c_str(), mEventRegionsOverride);
+  printf_stderr("  ref layers id: %" PRIu64 "\n", mReferentId.valueOr(0));
+  //printf_stderr("  scroll thumb: %s animation: %" PRIu64 "\n",
+  //  Stringify(mScrollThumbData).c_str(), mScrollbarAnimationId);
+  printf_stderr("  scroll container: %d target: %" PRIu64 "\n",
+    mIsScrollbarContainer, mScrollbarTargetContainerId);
+  printf_stderr("  fixed pos container: %" PRIu64 "\n",
+    mFixedPosScrollContainerId);
+}
+
 WebRenderScrollData::WebRenderScrollData()
   : mIsFirstPaint(false)
   , mPaintSequenceNumber(0)
 {
 }
 
 WebRenderScrollData::~WebRenderScrollData()
 {
@@ -222,10 +244,20 @@ WebRenderScrollData::SetPaintSequenceNum
 }
 
 uint32_t
 WebRenderScrollData::GetPaintSequenceNumber() const
 {
   return mPaintSequenceNumber;
 }
 
+void
+WebRenderScrollData::Dump() const
+{
+  printf_stderr("WebRenderScrollData with %zu layers firstpaint: %d\n",
+      mLayerScrollData.Length(), mIsFirstPaint);
+  for (size_t i = 0; i < mLayerScrollData.Length(); i++) {
+    mLayerScrollData.ElementAt(i).Dump(*this);
+  }
+}
+
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/wr/WebRenderScrollData.h
+++ b/gfx/layers/wr/WebRenderScrollData.h
@@ -63,16 +63,18 @@ public:
   Maybe<uint64_t> GetReferentId() const { return mReferentId; }
   EventRegionsOverride GetEventRegionsOverride() const { return mEventRegionsOverride; }
   const ScrollThumbData& GetScrollThumbData() const { return mScrollThumbData; }
   const uint64_t& GetScrollbarAnimationId() const { return mScrollbarAnimationId; }
   FrameMetrics::ViewID GetScrollbarTargetContainerId() const { return mScrollbarTargetContainerId; }
   bool IsScrollbarContainer() const { return mIsScrollbarContainer; }
   FrameMetrics::ViewID GetFixedPositionScrollContainerId() const { return mFixedPosScrollContainerId; }
 
+  void Dump(const WebRenderScrollData& aOwner) const;
+
   friend struct IPC::ParamTraits<WebRenderLayerScrollData>;
 
 private:
   // The number of descendants this layer has (not including the layer itself).
   // This is needed to reconstruct the depth-first layer tree traversal
   // efficiently. Leaf layers should always have 0 descendants.
   int32_t mDescendantCount;
 
@@ -133,16 +135,18 @@ public:
 
   void SetIsFirstPaint();
   bool IsFirstPaint() const;
   void SetPaintSequenceNumber(uint32_t aPaintSequenceNumber);
   uint32_t GetPaintSequenceNumber() const;
 
   friend struct IPC::ParamTraits<WebRenderScrollData>;
 
+  void Dump() const;
+
 private:
   // Internal data structure used to maintain uniqueness of mScrollMetadatas.
   // This is not serialized/deserialized over IPC because there's no need for it,
   // as the parent side doesn't need this at all. Also because we don't have any
   // IPC-friendly hashtable implementation lying around.
   // The key into this map is the scrollId of a ScrollMetadata, and the value is
   // an index into the mScrollMetadatas array.
   std::map<FrameMetrics::ViewID, size_t> mScrollIdMap;