Bug 1328420 Part 8: Uplift SizeOfIncludingThis into StyleSheet, with override in CSSStyleSheet. r=heycam

MozReview-Commit-ID: 5f1WldhnP2

--HG--
extra : rebase_source : 28fb1718028961dd5fe3e25c8deeb38ebfd6ee87
This commit is contained in:
Brad Werth 2017-01-23 16:42:31 -08:00
parent f9a4e85ea6
commit 5ef9727540
7 changed files with 21 additions and 21 deletions

View File

@ -208,11 +208,9 @@ CSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder)
size_t
CSSStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = 0;
size_t n = StyleSheet::SizeOfIncludingThis(aMallocSizeOf);
const CSSStyleSheet* s = this;
while (s) {
n += aMallocSizeOf(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
@ -226,8 +224,6 @@ CSSStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// Measurement of the following members may be added later if DMD finds it
// is worthwhile:
// - s->mTitle
// - s->mMedia
// - s->mRuleCollection
// - s->mRuleProcessors
//

View File

@ -169,7 +169,7 @@ public:
// list after we clone a unique inner for ourselves.
static bool RebuildChildList(css::Rule* aRule, void* aBuilder);
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
dom::Element* GetScopeElement() const { return mScopeElement; }
void SetScopeElement(dom::Element* aScopeElement)

View File

@ -109,12 +109,6 @@ ServoStyleSheet::DropRuleList()
}
}
size_t
ServoStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
MOZ_CRASH("stylo: not implemented");
}
css::Rule*
ServoStyleSheet::GetDOMOwnerRule() const
{

View File

@ -53,8 +53,6 @@ public:
*/
void LoadFailed();
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
RawServoStyleSheet* RawSheet() const { return mSheet; }
void SetSheetForImport(RawServoStyleSheet* aSheet) {
MOZ_ASSERT(!mSheet);

View File

@ -432,6 +432,24 @@ StyleSheet::AppendStyleSheet(StyleSheet* aSheet)
DidDirty();
}
size_t
StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = 0;
const StyleSheet* s = this;
while (s) {
n += aMallocSizeOf(s);
// Measurement of the following members may be added later if DMD finds it
// is worthwhile:
// - s->mTitle
// - s->mMedia
s = s->mNext;
}
return n;
}
#ifdef DEBUG
void
StyleSheet::List(FILE* out, int32_t aIndent) const

View File

@ -151,7 +151,7 @@ public:
// Get this style sheet's integrity metadata
inline void GetIntegrity(dom::SRIMetadata& aResult) const;
inline size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
#ifdef DEBUG
virtual void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
#endif

View File

@ -134,12 +134,6 @@ StyleSheet::GetIntegrity(dom::SRIMetadata& aResult) const
aResult = SheetInfo().mIntegrity;
}
size_t
StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
MOZ_STYLO_FORWARD(SizeOfIncludingThis, (aMallocSizeOf))
}
void StyleSheet::WillDirty() { MOZ_STYLO_FORWARD(WillDirty, ()) }
void StyleSheet::DidDirty() { MOZ_STYLO_FORWARD(DidDirty, ()) }