Bug 1350789 - Make CSSStyleSheet::SizeOfIncludingThis correctly check for shared inners. r?bradwerth draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 27 Mar 2017 16:49:37 +0800
changeset 551683 0864019c7351466d63c48558c859a72f04ad547b
parent 551502 cc53710589fb500610495da5258b7b9221edf681
child 621615 91ea486ea0077db75856e6a2e00aeac64da3171f
push id51134
push userbmo:cam@mcc.id.au
push dateMon, 27 Mar 2017 08:49:53 +0000
reviewersbradwerth
bugs1350789
milestone55.0a1
Bug 1350789 - Make CSSStyleSheet::SizeOfIncludingThis correctly check for shared inners. r?bradwerth MozReview-Commit-ID: 3hsuiR5SwZT
layout/style/CSSStyleSheet.cpp
--- a/layout/style/CSSStyleSheet.cpp
+++ b/layout/style/CSSStyleSheet.cpp
@@ -180,18 +180,18 @@ CSSStyleSheet::SizeOfIncludingThis(Mallo
   while (s) {
     // Each inner can be shared by multiple sheets.  So we only count the inner
     // if this sheet is the last one in the list of those sharing it.  As a
     // result, the last such sheet takes all the blame for the memory
     // consumption of the inner, which isn't ideal but it's better than
     // double-counting the inner.  We use last instead of first since the first
     // sheet may be held in the nsXULPrototypeCache and not used in a window at
     // all.
-    if (mInner->mSheets.LastElement() == s) {
-      n += Inner()->SizeOfIncludingThis(aMallocSizeOf);
+    if (s->Inner()->mSheets.LastElement() == s) {
+      n += s->Inner()->SizeOfIncludingThis(aMallocSizeOf);
     }
 
     // Measurement of the following members may be added later if DMD finds it
     // is worthwhile:
     // - s->mRuleCollection
     // - s->mRuleProcessors
     //
     // The following members are not measured: