Bug 1397813. Make sure to memory-report the ServoStyleContexts for anon boxes and lazy pseudos that we cache on the parent ServoStyleContext. r=njn
authorBoris Zbarsky <bzbarsky@mit.edu>
Sat, 09 Sep 2017 04:11:40 -0400
changeset 429405 f0fdf712c7249816ec347c308f5ae15e87776f00
parent 429404 bd62e8a3194213d0ef806a83f5c888b72b663cd0
child 429406 e5dd43e9452d6cccda023681fd9d2351c2a4d5f4
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1397813
milestone57.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 1397813. Make sure to memory-report the ServoStyleContexts for anon boxes and lazy pseudos that we cache on the parent ServoStyleContext. r=njn
layout/style/ServoStyleContext.h
--- a/layout/style/ServoStyleContext.h
+++ b/layout/style/ServoStyleContext.h
@@ -106,16 +106,26 @@ public:
   void AddSizeOfIncludingThis(nsWindowSizes& aSizes, size_t* aCVsSize) const
   {
     // Note: |this| sits within a servo_arc::Arc, i.e. it is preceded by a
     // refcount. So we need to measure it with a function that can handle an
     // interior pointer. We use ServoComputedValuesMallocEnclosingSizeOf to
     // clearly identify in DMD's output the memory measured here.
     *aCVsSize += ServoComputedValuesMallocEnclosingSizeOf(this);
     mSource.AddSizeOfExcludingThis(aSizes);
+
+    if (mNextInheritingAnonBoxStyle &&
+        !aSizes.mState.HaveSeenPtr(mNextInheritingAnonBoxStyle)) {
+      mNextInheritingAnonBoxStyle->AddSizeOfIncludingThis(aSizes, aCVsSize);
+    }
+
+    if (mNextLazyPseudoStyle &&
+        !aSizes.mState.HaveSeenPtr(mNextLazyPseudoStyle)) {
+      mNextLazyPseudoStyle->AddSizeOfIncludingThis(aSizes, aCVsSize);
+    }
   }
 
 private:
   nsPresContext* mPresContext;
   ServoComputedData mSource;
 
   // A linked-list cache of inheriting anon boxes inheriting from this style _if
   // the style isn't an inheriting anon-box_.