mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 795128: Add memory reporting for attribute maps and nodes. r=smaug
This commit is contained in:
parent
e5eb83ac5a
commit
9de7b7f765
@ -348,6 +348,8 @@ public:
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL);
|
||||
void Unlink(bool aIsXUL);
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
/**
|
||||
* The .style attribute (an interface that forwards to the actual
|
||||
* style rules)
|
||||
|
@ -598,6 +598,30 @@ FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL)
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
|
||||
if (mAttributeMap) {
|
||||
n += mAttributeMap->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - Superclass members (nsINode::nsSlots)
|
||||
// - mStyle
|
||||
// - mDataSet
|
||||
// - mSMILOverrideStyle
|
||||
// - mSMILOverrideStyleRule
|
||||
// - mChildrenList
|
||||
// - mClassList
|
||||
|
||||
// The following members are not measured:
|
||||
// - mBindingParent / mControllers: because they're non-owning
|
||||
return n;
|
||||
}
|
||||
|
||||
FragmentOrElement::FragmentOrElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsIContent(aNodeInfo)
|
||||
{
|
||||
@ -1938,6 +1962,14 @@ FragmentOrElement::FireNodeRemovedForChildren()
|
||||
size_t
|
||||
FragmentOrElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return nsIContent::SizeOfExcludingThis(aMallocSizeOf) +
|
||||
mAttrsAndChildren.SizeOfExcludingThis(aMallocSizeOf);
|
||||
size_t n = 0;
|
||||
n += nsIContent::SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mAttrsAndChildren.SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
nsDOMSlots* slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
n += slots->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -501,3 +501,23 @@ nsDOMAttributeMap::Enumerate(AttrCache::EnumReadFunction aFunc,
|
||||
{
|
||||
return mAttributeCache.EnumerateRead(aFunc, aUserArg);
|
||||
}
|
||||
|
||||
size_t
|
||||
AttrCacheSizeEnumerator(const nsAttrKey& aKey,
|
||||
const nsRefPtr<nsDOMAttribute>& aValue,
|
||||
nsMallocSizeOfFun aMallocSizeOf,
|
||||
void* aUserArg)
|
||||
{
|
||||
return aMallocSizeOf(aValue.get());
|
||||
}
|
||||
|
||||
size_t
|
||||
nsDOMAttributeMap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mAttributeCache.SizeOfExcludingThis(AttrCacheSizeEnumerator,
|
||||
aMallocSizeOf);
|
||||
|
||||
// NB: mContent is non-owning and thus not counted.
|
||||
return n;
|
||||
}
|
||||
|
@ -159,6 +159,8 @@ public:
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMAttributeMap)
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
Element *mContent; // Weak reference
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user