Bug 1393636 (part 4) - Move ComputedValues measurements from nsStyleSizes to nsWindowSizes. r=heycam.

Another plumbing-only change, which is a precursor for the next patch.
ComputedValues are a Servo-only thing, so in order to use nsStyleSizes for both
Gecko and Servo, the ComputedValues sizes must be moved out.

MozReview-Commit-ID: BOnQSzzV0vC

--HG--
extra : rebase_source : 025c6161e509401a36525349083dd98bfda35621
This commit is contained in:
Nicholas Nethercote 2017-08-25 14:50:26 +10:00
Родитель 7e120ce35e
Коммит f2751f3072
5 изменённых файлов: 33 добавлений и 47 удалений

Просмотреть файл

@ -4195,8 +4195,7 @@ Element::AddSizeOfExcludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const
if (Servo_Element_HasPrimaryComputedValues(this)) {
sc = Servo_Element_GetPrimaryComputedValues(this).Consume();
if (!aSizes.mState.HaveSeenPtr(sc.get())) {
sc->AddSizeOfIncludingThis(aSizes,
&aSizes.mStyleSizes.mComputedValuesDom);
sc->AddSizeOfIncludingThis(aSizes, &aSizes.mLayoutComputedValuesDom);
}
for (size_t i = 0; i < nsCSSPseudoElements::kEagerPseudoCount; i++) {
@ -4204,7 +4203,7 @@ Element::AddSizeOfExcludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const
sc = Servo_Element_GetPseudoComputedValues(this, i).Consume();
if (!aSizes.mState.HaveSeenPtr(sc.get())) {
sc->AddSizeOfIncludingThis(aSizes,
&aSizes.mStyleSizes.mComputedValuesDom);
&aSizes.mLayoutComputedValuesDom);
}
}
}

Просмотреть файл

@ -386,6 +386,26 @@ CollectWindowReports(nsGlobalWindow *aWindow,
aWindowTotalSizes->mLayoutFramePropertiesSize +=
windowSizes.mLayoutFramePropertiesSize;
REPORT_SIZE("/layout/computed-values/dom",
windowSizes.mLayoutComputedValuesDom,
"Memory used by ComputedValues objects accessible from DOM "
"elements.");
aWindowTotalSizes->mLayoutComputedValuesDom +=
windowSizes.mLayoutComputedValuesDom;
REPORT_SIZE("/layout/computed-values/non-dom",
windowSizes.mLayoutComputedValuesNonDom,
"Memory used by ComputedValues objects not accessible from DOM "
"elements.");
aWindowTotalSizes->mLayoutComputedValuesNonDom +=
windowSizes.mLayoutComputedValuesNonDom;
REPORT_SIZE("/layout/computed-values/visited",
windowSizes.mLayoutComputedValuesVisited,
"Memory used by ComputedValues objects used for visited styles.");
aWindowTotalSizes->mLayoutComputedValuesVisited +=
windowSizes.mLayoutComputedValuesVisited;
REPORT_SIZE("/property-tables",
windowSizes.mPropertyTablesSize,
"Memory used for the property tables within a window.");
@ -453,26 +473,6 @@ CollectWindowReports(nsGlobalWindow *aWindow,
"to be shown individually.");
}
REPORT_SIZE("/layout/computed-values/dom",
windowSizes.mStyleSizes.mComputedValuesDom,
"Memory used by ComputedValues objects accessible from DOM "
"elements.");
aWindowTotalSizes->mStyleSizes.mComputedValuesDom +=
windowSizes.mStyleSizes.mComputedValuesDom;
REPORT_SIZE("/layout/computed-values/non-dom",
windowSizes.mStyleSizes.mComputedValuesNonDom,
"Memory used by ComputedValues objects not accessible from DOM "
"elements.");
aWindowTotalSizes->mStyleSizes.mComputedValuesNonDom +=
windowSizes.mStyleSizes.mComputedValuesNonDom;
REPORT_SIZE("/layout/computed-values/visited",
windowSizes.mStyleSizes.mComputedValuesVisited,
"Memory used by ComputedValues objects used for visited styles.");
aWindowTotalSizes->mStyleSizes.mComputedValuesVisited +=
windowSizes.mStyleSizes.mComputedValuesVisited;
// 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.
@ -630,6 +630,12 @@ nsWindowMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
windowTotalSizes.mLayoutFramePropertiesSize,
"This is the sum of all windows' 'layout/frame-properties' numbers.");
REPORT("window-objects/layout/computed-values",
windowTotalSizes.mLayoutComputedValuesDom +
windowTotalSizes.mLayoutComputedValuesNonDom +
windowTotalSizes.mLayoutComputedValuesVisited,
"This is the sum of all windows' 'layout/computed-values/' numbers.");
REPORT("window-objects/property-tables",
windowTotalSizes.mPropertyTablesSize,
"This is the sum of all windows' 'property-tables' numbers.");
@ -662,13 +668,6 @@ nsWindowMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
"Memory used for layout frames within windows. "
"This is the sum of all windows' 'layout/frames/' numbers.");
REPORT("window-objects/layout/computed-values",
windowTotalSizes.mStyleSizes.mComputedValuesDom +
windowTotalSizes.mStyleSizes.mComputedValuesNonDom +
windowTotalSizes.mStyleSizes.mComputedValuesVisited,
"This is the sum of all windows' 'layout/computed-values/' "
"numbers.");
size_t styleTotal = 0;
#define STYLE_STRUCT(name_, cb_) \
styleTotal += windowTotalSizes.mStyleSizes.NS_STYLE_SIZES_FIELD(name_);

Просмотреть файл

@ -111,15 +111,8 @@ struct nsArenaSizes {
struct nsStyleSizes
{
#define FOR_EACH_SIZE(macro) \
macro(Style, mComputedValuesDom) \
macro(Style, mComputedValuesNonDom) \
macro(Style, mComputedValuesVisited)
nsStyleSizes()
:
FOR_EACH_SIZE(ZERO_SIZE)
#define STYLE_STRUCT(name_, cb_) \
NS_STYLE_SIZES_FIELD(name_)(0),
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
@ -132,8 +125,6 @@ struct nsStyleSizes
void addToTabSizes(nsTabSizes* aSizes) const
{
FOR_EACH_SIZE(ADD_TO_TAB_SIZES)
#define STYLE_STRUCT(name_, cb_) \
aSizes->add(nsTabSizes::Style, NS_STYLE_SIZES_FIELD(name_));
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
@ -146,8 +137,6 @@ struct nsStyleSizes
{
size_t total = 0;
FOR_EACH_SIZE(ADD_TO_TOTAL_SIZE)
#define STYLE_STRUCT(name_, cb_) \
total += NS_STYLE_SIZES_FIELD(name_);
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
@ -158,8 +147,6 @@ struct nsStyleSizes
return total;
}
FOR_EACH_SIZE(DECL_SIZE)
#define STYLE_STRUCT(name_, cb_) \
size_t NS_STYLE_SIZES_FIELD(name_);
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
@ -169,8 +156,6 @@ struct nsStyleSizes
// Present just to absorb the trailing comma in the constructor.
int dummy;
#undef FOR_EACH_SIZE
};
class nsWindowSizes
@ -190,6 +175,9 @@ class nsWindowSizes
macro(Other, mLayoutTextRunsSize) \
macro(Other, mLayoutPresContextSize) \
macro(Other, mLayoutFramePropertiesSize) \
macro(Style, mLayoutComputedValuesDom) \
macro(Style, mLayoutComputedValuesNonDom) \
macro(Style, mLayoutComputedValuesVisited) \
macro(Other, mPropertyTablesSize) \
public:

Просмотреть файл

@ -10722,7 +10722,7 @@ nsIFrame::AddSizeOfExcludingThisForTree(nsWindowSizes& aSizes) const
ServoStyleContext* sc = mStyleContext->AsServo();
if (!aSizes.mState.HaveSeenPtr(sc)) {
sc->AddSizeOfIncludingThis(aSizes,
&aSizes.mStyleSizes.mComputedValuesNonDom);
&aSizes.mLayoutComputedValuesNonDom);
}
}

Просмотреть файл

@ -265,7 +265,7 @@ ServoComputedData::AddSizeOfExcludingThis(nsWindowSizes& aSizes) const
if (visited_style.mPtr && !aSizes.mState.HaveSeenPtr(visited_style.mPtr)) {
visited_style.mPtr->AddSizeOfIncludingThis(
aSizes, &aSizes.mStyleSizes.mComputedValuesVisited);
aSizes, &aSizes.mLayoutComputedValuesVisited);
}
// Measurement of the following members may be added later if DMD finds it is