Bug 1448728 part 2 - Remove style sizes for the old style system from nsWindowSizes.h. r?njn draft
authorXidorn Quan <me@upsuper.org>
Mon, 26 Mar 2018 14:56:15 +1100
changeset 772412 4c7d20a0b29967465e9fc07441c6f4681a68c621
parent 772411 985dd66fdcfc31ca7c07ef86b179dd9e780c250e
child 772413 1faf8a9ac19f4bf5dcdfbe00bf97e82db3d2e928
push id103904
push userxquan@mozilla.com
push dateMon, 26 Mar 2018 04:13:50 +0000
reviewersnjn
bugs1448728
milestone61.0a1
Bug 1448728 part 2 - Remove style sizes for the old style system from nsWindowSizes.h. r?njn MozReview-Commit-ID: 5FqJWoCjlto
dom/base/nsWindowMemoryReporter.cpp
dom/base/nsWindowSizes.h
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -353,19 +353,16 @@ CollectWindowReports(nsGlobalWindowInner
   REPORT_SIZE("/layout/style-sheets", mLayoutStyleSheetsSize,
               "Memory used by style sheets within a window.");
 
   REPORT_SIZE("/layout/pres-shell", mLayoutPresShellSize,
               "Memory used by layout's PresShell, along with any structures "
               "allocated in its arena and not measured elsewhere, "
               "within a window.");
 
-  REPORT_SIZE("/layout/gecko-style-sets", mLayoutGeckoStyleSets,
-              "Memory used by Gecko style sets within a window.");
-
   REPORT_SIZE("/layout/servo-style-sets/stylist/rule-tree",
               mLayoutServoStyleSetsStylistRuleTree,
               "Memory used by rule trees within Servo style sets within a "
               "window.");
 
   REPORT_SIZE("/layout/servo-style-sets/stylist/element-and-pseudos-maps",
               mLayoutServoStyleSetsStylistElementAndPseudosMaps,
               "Memory used by element and pseudos maps within Servo style "
@@ -446,44 +443,16 @@ CollectWindowReports(nsGlobalWindowInner
               "Memory used by style contexts within a window.");
 
   // There are many different kinds of style structs, but it is likely that
   // only a few matter. Implement a cutoff so we don't bloat about:memory with
   // many uninteresting entries.
   const size_t STYLE_SUNDRIES_THRESHOLD =
     js::MemoryReportingSundriesThreshold();
 
-  // This is the Gecko style structs, which are in the nsPresArena.
-  size_t geckoStyleSundriesSize = 0;
-#define STYLE_STRUCT(name_, cb_) \
-  { \
-    size_t size = \
-      windowSizes.mArenaSizes.mGeckoStyleSizes.NS_STYLE_SIZES_FIELD(name_); \
-    if (size < STYLE_SUNDRIES_THRESHOLD) { \
-      geckoStyleSundriesSize += size; \
-    } else { \
-      REPORT_SUM_SIZE( \
-        "/layout/gecko-style-structs/" # name_, size, \
-        "Memory used by the " #name_ " Gecko style structs within a window."); \
-    } \
-    aWindowTotalSizes->mArenaSizes.mGeckoStyleSizes.NS_STYLE_SIZES_FIELD(name_) += \
-      size; \
-  }
-#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
-
-  if (geckoStyleSundriesSize > 0) {
-    REPORT_SUM_SIZE(
-      "/layout/gecko-style-structs/sundries", geckoStyleSundriesSize,
-      "The sum of all memory used by Gecko style structs which were too small "
-      "to be shown individually.");
-  }
-
   // There are many different kinds of frames, but it is very likely
   // that only a few matter.  Implement a cutoff so we don't bloat
   // about:memory with many uninteresting entries.
   const size_t FRAME_SUNDRIES_THRESHOLD =
     js::MemoryReportingSundriesThreshold();
 
   size_t frameSundriesSize = 0;
 #define FRAME_ID(classname, ...) \
@@ -655,20 +624,16 @@ nsWindowMemoryReporter::CollectReports(n
   REPORT("window-objects/layout/style-sheets",
          windowTotalSizes.mLayoutStyleSheetsSize,
          "This is the sum of all windows' 'layout/style-sheets' numbers.");
 
   REPORT("window-objects/layout/pres-shell",
          windowTotalSizes.mLayoutPresShellSize,
          "This is the sum of all windows' 'layout/arenas' numbers.");
 
-  REPORT("window-objects/layout/gecko-style-sets",
-         windowTotalSizes.mLayoutGeckoStyleSets,
-         "This is the sum of all windows' 'layout/gecko-style-sets' numbers.");
-
   REPORT("window-objects/layout/servo-style-sets",
          windowTotalSizes.mLayoutServoStyleSetsStylistRuleTree +
          windowTotalSizes.mLayoutServoStyleSetsStylistElementAndPseudosMaps +
          windowTotalSizes.mLayoutServoStyleSetsStylistInvalidationMap +
          windowTotalSizes.mLayoutServoStyleSetsStylistRevalidationSelectors +
          windowTotalSizes.mLayoutServoStyleSetsStylistOther +
          windowTotalSizes.mLayoutServoStyleSetsOther,
          "This is the sum of all windows' 'layout/servo-style-sets/' numbers.");
@@ -706,29 +671,16 @@ nsWindowMemoryReporter::CollectReports(n
   REPORT("window-objects/layout/rule-nodes",
          windowTotalSizes.mArenaSizes.mRuleNodes,
          "This is the sum of all windows' 'layout/rule-nodes' numbers.");
 
   REPORT("window-objects/layout/style-contexts",
          windowTotalSizes.mArenaSizes.mComputedStyles,
          "This is the sum of all windows' 'layout/style-contexts' numbers.");
 
-  size_t geckoStyleTotal = 0;
-#define STYLE_STRUCT(name_, cb_) \
-  geckoStyleTotal += \
-    windowTotalSizes.mArenaSizes.mGeckoStyleSizes.NS_STYLE_SIZES_FIELD(name_);
-#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
-
-  REPORT("window-objects/layout/gecko-style-structs", geckoStyleTotal,
-         "Memory used for style structs within windows. This is the sum of "
-         "all windows' 'layout/gecko-style-structs/' numbers.");
-
   size_t frameTotal = 0;
 #define FRAME_ID(classname, ...) \
   frameTotal += windowTotalSizes.mArenaSizes.NS_ARENA_SIZES_FIELD(classname);
 #define ABSTRACT_FRAME_ID(...)
 #include "nsFrameIdList.h"
 #undef FRAME_ID
 #undef ABSTRACT_FRAME_ID
 
--- a/dom/base/nsWindowSizes.h
+++ b/dom/base/nsWindowSizes.h
@@ -111,63 +111,58 @@ struct nsArenaSizes {
 
       #define FRAME_ID(classname, ...) \
         NS_ARENA_SIZES_FIELD(classname)(0),
       #define ABSTRACT_FRAME_ID(...)
       #include "nsFrameIdList.h"
       #undef FRAME_ID
       #undef ABSTRACT_FRAME_ID
 
-      mGeckoStyleSizes()
+      dummy()
   {}
 
   void addToTabSizes(nsTabSizes* aSizes) const
   {
     FOR_EACH_SIZE(ADD_TO_TAB_SIZES)
 
     #define FRAME_ID(classname, ...) \
       aSizes->add(nsTabSizes::Other, NS_ARENA_SIZES_FIELD(classname));
     #define ABSTRACT_FRAME_ID(...)
     #include "nsFrameIdList.h"
     #undef FRAME_ID
     #undef ABSTRACT_FRAME_ID
-
-    mGeckoStyleSizes.addToTabSizes(aSizes);
   }
 
   size_t getTotalSize() const
   {
     size_t total = 0;
 
     FOR_EACH_SIZE(ADD_TO_TOTAL_SIZE)
 
     #define FRAME_ID(classname, ...) \
       total += NS_ARENA_SIZES_FIELD(classname);
     #define ABSTRACT_FRAME_ID(...)
     #include "nsFrameIdList.h"
     #undef FRAME_ID
     #undef ABSTRACT_FRAME_ID
 
-    total += mGeckoStyleSizes.getTotalSize();
-
     return total;
   }
 
   FOR_EACH_SIZE(DECL_SIZE)
 
   #define FRAME_ID(classname, ...) \
     size_t NS_ARENA_SIZES_FIELD(classname);
   #define ABSTRACT_FRAME_ID(...)
   #include "nsFrameIdList.h"
   #undef FRAME_ID
   #undef ABSTRACT_FRAME_ID
 
-  // This is Gecko-only because in Stylo these style structs are stored outside
-  // the nsPresArena, and so measured elsewhere.
-  nsStyleSizes mGeckoStyleSizes;
+  // Present just to absorb the trailing comma in the constructor.
+  int dummy;
 
 #undef FOR_EACH_SIZE
 };
 
 class nsWindowSizes
 {
 #define FOR_EACH_SIZE(macro) \
   macro(DOM,   mDOMElementNodesSize) \
@@ -175,17 +170,16 @@ class nsWindowSizes
   macro(DOM,   mDOMCDATANodesSize) \
   macro(DOM,   mDOMCommentNodesSize) \
   macro(DOM,   mDOMEventTargetsSize) \
   macro(DOM,   mDOMPerformanceUserEntries) \
   macro(DOM,   mDOMPerformanceResourceEntries) \
   macro(DOM,   mDOMOtherSize) \
   macro(Style, mLayoutStyleSheetsSize) \
   macro(Other, mLayoutPresShellSize) \
-  macro(Style, mLayoutGeckoStyleSets) \
   macro(Style, mLayoutServoStyleSetsStylistRuleTree) \
   macro(Style, mLayoutServoStyleSetsStylistElementAndPseudosMaps) \
   macro(Style, mLayoutServoStyleSetsStylistInvalidationMap) \
   macro(Style, mLayoutServoStyleSetsStylistRevalidationSelectors) \
   macro(Style, mLayoutServoStyleSetsStylistOther) \
   macro(Style, mLayoutServoStyleSetsOther) \
   macro(Style, mLayoutServoElementDataObjects) \
   macro(Other, mLayoutTextRunsSize) \
@@ -228,18 +222,16 @@ public:
 
   FOR_EACH_SIZE(DECL_SIZE);
 
   uint32_t mDOMEventTargetsCount;
   uint32_t mDOMEventListenersCount;
 
   nsArenaSizes mArenaSizes;
 
-  // This is Stylo-only because in Gecko these style structs are stored in the
-  // nsPresArena, and so are measured as part of that.
   nsStyleSizes mServoStyleSizes;
 
   mozilla::SizeOfState& mState;
 
 #undef FOR_EACH_SIZE
 };
 
 #undef ZERO_SIZE