mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 19:47:32 +09:00
Issue #2828 - Part 12: Implement cascade layer SizeOfIncludingThis
This commit is contained in:
parent
cbb019a862
commit
e3476d33ed
3 changed files with 33 additions and 2 deletions
|
|
@ -223,8 +223,9 @@ CascadeLayerRuleProcessor::SizeOfExcludingThis(
|
||||||
mozilla::MallocSizeOf aMallocSizeOf) const
|
mozilla::MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
n += mCascade->SizeOfIncludingThis(aMallocSizeOf);
|
// The cascade layer owns the rule cascade, so we don't count it here.
|
||||||
// FIXME: size of attached cascade layer is not included.
|
// We do count the layer itself, though.
|
||||||
|
n += mLayer->SizeOfIncludingThis(aMallocSizeOf);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1642,6 +1642,34 @@ CascadeLayer::~CascadeLayer()
|
||||||
delete mData;
|
delete mData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
CascadeLayer::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
size_t n = aMallocSizeOf(this);
|
||||||
|
if (mData) {
|
||||||
|
n += mData->SizeOfIncludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
n += mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||||
|
n += mStyleRules.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
// While we do create the child layers, they are not owned by us, so we
|
||||||
|
// don't count them. Their ownership is managed by the rule processor
|
||||||
|
// to which they are eventually attached (see nsCSSRuleProcessor).
|
||||||
|
n += mPreLayers.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
n += mPostLayers.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
n += mLayers.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
for (auto iter = mLayers.ConstIter(); !iter.Done(); iter.Next()) {
|
||||||
|
// We don't own the CascadeLayer objects so we don't count them. We
|
||||||
|
// do care about the size of the keys' nsAString members' buffers though.
|
||||||
|
//
|
||||||
|
// Note that we depend on nsStringHashKey::GetKey() returning a reference,
|
||||||
|
// since otherwise aKey would be a copy of the string key and we would not
|
||||||
|
// be measuring the right object here.
|
||||||
|
n += iter.Key().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
CascadeLayer*
|
CascadeLayer*
|
||||||
CascadeLayer::CreateNamedChildLayer(const nsTArray<nsString>& aPath)
|
CascadeLayer::CreateNamedChildLayer(const nsTArray<nsString>& aPath)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,8 @@ struct CascadeLayer
|
||||||
nsMediaQueryResultCacheKey& aCacheKey);
|
nsMediaQueryResultCacheKey& aCacheKey);
|
||||||
~CascadeLayer();
|
~CascadeLayer();
|
||||||
|
|
||||||
|
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
||||||
|
|
||||||
nsPresContext* mPresContext;
|
nsPresContext* mPresContext;
|
||||||
nsString mName;
|
nsString mName;
|
||||||
bool mIsAnonymous;
|
bool mIsAnonymous;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue