Bug 1487237. Add some content lists stored in DOM slots to memory reporting. r=smaug

This reports the memory as part of element-nodes, but I think that's OK for
now.  If we want to, we can try to add more nsWindowSizes buckets for this stuff.

Differential Revision: https://phabricator.services.mozilla.com/D4811

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2018-09-01 14:55:47 +00:00
Родитель dbc64fd7ba
Коммит 295c5598a9
3 изменённых файлов: 19 добавлений и 6 удалений

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

@ -747,14 +747,15 @@ FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) c
n += mAttributeMap->SizeOfIncludingThis(aMallocSizeOf);
}
if (mChildrenList) {
n += mChildrenList->SizeOfIncludingThis(aMallocSizeOf);
}
// Measurement of the following members may be added later if DMD finds it is
// worthwhile:
// - Superclass members (nsINode::nsSlots)
// - mStyle
// - mDataSet
// - mSMILOverrideStyle
// - mSMILOverrideStyleDeclaration
// - mChildrenList
// - mClassList
// The following member are not measured:
@ -835,10 +836,8 @@ FragmentOrElement::nsExtendedDOMSlots::SizeOfExcludingThis(MallocSizeOf aMallocS
n += aMallocSizeOf(mControllers);
}
// We don't seem to have memory reporting for nsLabelsNodeList. At least
// report the memory it's using directly.
if (mLabelsList) {
n += aMallocSizeOf(mLabelsList);
n += mLabelsList->SizeOfIncludingThis(aMallocSizeOf);
}
// mShadowRoot should be handled during normal DOM tree memory reporting, just

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

@ -105,6 +105,14 @@ nsBaseContentList::IndexOf(nsIContent* aContent)
return IndexOf(aContent, true);
}
size_t
nsBaseContentList::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = aMallocSizeOf(this);
n += mElements.ShallowSizeOfExcludingThis(aMallocSizeOf);
return n;
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsSimpleContentList, nsBaseContentList,
mRoot)

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

@ -27,6 +27,7 @@
#include "nsWrapperCache.h"
#include "nsHashKeys.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/NameSpaceConstants.h"
namespace mozilla {
@ -94,6 +95,11 @@ public:
virtual void LastRelease() {}
// Memory reporting. For now, subclasses of nsBaseContentList don't really
// need to report any members that are not part of the object itself, so we
// don't need to make this virtual.
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
protected:
virtual ~nsBaseContentList();