зеркало из https://github.com/mozilla/gecko-dev.git
Bug 921923 (part 3) - Make multi-output sizeOfFoo() functions more consistent in content/, dom/ and layout/. r=till.
--HG-- extra : rebase_source : ac8aebe86b4b7ee5acc0f541be5645abf73b6a98
This commit is contained in:
Родитель
40ead0eeb0
Коммит
75f194c48c
|
@ -1880,11 +1880,11 @@ public:
|
|||
// SizeOfExcludingThis function. However, because nsIDocument objects can
|
||||
// only appear at the top of the DOM tree, we have a specialized measurement
|
||||
// function which returns multiple sizes.
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
// DocSizeOfIncludingThis doesn't need to be overridden by sub-classes
|
||||
virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
// DocAddSizeOfIncludingThis doesn't need to be overridden by sub-classes
|
||||
// because nsIDocument inherits from nsINode; see the comment above the
|
||||
// declaration of nsINode::SizeOfIncludingThis.
|
||||
virtual void DocSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
virtual void DocAddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
|
||||
bool MayHaveDOMMutationObservers()
|
||||
{
|
||||
|
|
|
@ -11040,18 +11040,18 @@ nsDocument::GetVisibilityState(nsAString& aState)
|
|||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsIDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
nsIDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOMOther +=
|
||||
nsINode::SizeOfExcludingThis(aWindowSizes->mMallocSizeOf);
|
||||
|
||||
if (mPresShell) {
|
||||
mPresShell->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf,
|
||||
&aWindowSizes->mArenaStats,
|
||||
&aWindowSizes->mLayoutPresShell,
|
||||
&aWindowSizes->mLayoutStyleSets,
|
||||
&aWindowSizes->mLayoutTextRuns,
|
||||
&aWindowSizes->mLayoutPresContext);
|
||||
mPresShell->AddSizeOfIncludingThis(aWindowSizes->mMallocSizeOf,
|
||||
&aWindowSizes->mArenaStats,
|
||||
&aWindowSizes->mLayoutPresShell,
|
||||
&aWindowSizes->mLayoutStyleSets,
|
||||
&aWindowSizes->mLayoutTextRuns,
|
||||
&aWindowSizes->mLayoutPresContext);
|
||||
}
|
||||
|
||||
aWindowSizes->mPropertyTables +=
|
||||
|
@ -11068,10 +11068,10 @@ nsIDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
|||
}
|
||||
|
||||
void
|
||||
nsIDocument::DocSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
||||
nsIDocument::DocAddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOMOther += aWindowSizes->mMallocSizeOf(this);
|
||||
DocSizeOfExcludingThis(aWindowSizes);
|
||||
DocAddSizeOfExcludingThis(aWindowSizes);
|
||||
}
|
||||
|
||||
static size_t
|
||||
|
@ -11087,15 +11087,15 @@ nsDocument::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
|||
{
|
||||
// This SizeOfExcludingThis() overrides the one from nsINode. But
|
||||
// nsDocuments can only appear at the top of the DOM tree, and we use the
|
||||
// specialized DocSizeOfExcludingThis() in that case. So this should never
|
||||
// specialized DocAddSizeOfExcludingThis() in that case. So this should never
|
||||
// be called.
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
nsIDocument::DocSizeOfExcludingThis(aWindowSizes);
|
||||
nsIDocument::DocAddSizeOfExcludingThis(aWindowSizes);
|
||||
|
||||
for (nsIContent* node = nsINode::GetFirstChild();
|
||||
node;
|
||||
|
|
|
@ -1011,8 +1011,8 @@ public:
|
|||
// Posts an event to call UpdateVisibilityState
|
||||
virtual void PostVisibilityUpdateEvent() MOZ_OVERRIDE;
|
||||
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
|
||||
// DocSizeOfIncludingThis is inherited from nsIDocument.
|
||||
virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
|
||||
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
|
||||
|
||||
|
|
|
@ -3750,9 +3750,9 @@ nsHTMLDocument::RemovedFromDocShell()
|
|||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsHTMLDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
nsHTMLDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
nsDocument::DocSizeOfExcludingThis(aWindowSizes);
|
||||
nsDocument::DocAddSizeOfExcludingThis(aWindowSizes);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
|
|
|
@ -166,8 +166,8 @@ public:
|
|||
return nsDocument::GetElementById(aElementId);
|
||||
}
|
||||
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
|
||||
// DocSizeOfIncludingThis is inherited from nsIDocument.
|
||||
virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
|
||||
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
|
||||
|
||||
virtual bool WillIgnoreCharsetOverride() MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -584,13 +584,13 @@ XMLDocument::EndLoad()
|
|||
nsEvent event(true, NS_LOAD);
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIDocument*>(this), nullptr,
|
||||
&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
XMLDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
XMLDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
nsDocument::DocSizeOfExcludingThis(aWindowSizes);
|
||||
nsDocument::DocAddSizeOfExcludingThis(aWindowSizes);
|
||||
}
|
||||
|
||||
// nsIDOMDocument interface
|
||||
|
|
|
@ -47,8 +47,8 @@ public:
|
|||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
|
||||
// DocSizeOfIncludingThis is inherited from nsIDocument.
|
||||
virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE;
|
||||
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
|
||||
|
||||
|
||||
// WebIDL API
|
||||
|
|
|
@ -11517,7 +11517,7 @@ SizeOfEventTargetObjectsEntryExcludingThisFun(
|
|||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::SizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
||||
nsGlobalWindow::AddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOMOther += aWindowSizes->mMallocSizeOf(this);
|
||||
|
||||
|
@ -11529,13 +11529,14 @@ nsGlobalWindow::SizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
|||
elm->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf);
|
||||
}
|
||||
if (mDoc) {
|
||||
mDoc->DocSizeOfIncludingThis(aWindowSizes);
|
||||
mDoc->DocAddSizeOfIncludingThis(aWindowSizes);
|
||||
}
|
||||
}
|
||||
|
||||
aWindowSizes->mDOMOther +=
|
||||
mNavigator ?
|
||||
mNavigator->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf) : 0;
|
||||
if (mNavigator) {
|
||||
aWindowSizes->mDOMOther +=
|
||||
mNavigator->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf);
|
||||
}
|
||||
|
||||
aWindowSizes->mDOMEventTargets +=
|
||||
mEventTargetObjects.SizeOfExcludingThis(
|
||||
|
|
|
@ -654,7 +654,7 @@ public:
|
|||
return sWindowsById;
|
||||
}
|
||||
|
||||
void SizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
void AddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
|
||||
void UnmarkGrayTimers();
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
|
|||
} while (0)
|
||||
|
||||
nsWindowSizes windowSizes(WindowsMallocSizeOf);
|
||||
aWindow->SizeOfIncludingThis(&windowSizes);
|
||||
aWindow->AddSizeOfIncludingThis(&windowSizes);
|
||||
|
||||
REPORT("/dom/element-nodes", windowSizes.mDOMElementNodes,
|
||||
"Memory used by the element nodes in a window's DOM.");
|
||||
|
|
|
@ -1297,12 +1297,12 @@ public:
|
|||
virtual bool IsVisible() = 0;
|
||||
virtual void DispatchSynthMouseMove(nsGUIEvent *aEvent, bool aFlushOnHoverChange) = 0;
|
||||
|
||||
virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats *aArenaObjectsSize,
|
||||
size_t *aPresShellSize,
|
||||
size_t *aStyleSetsSize,
|
||||
size_t *aTextRunsSize,
|
||||
size_t *aPresContextSize) = 0;
|
||||
virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats *aArenaObjectsSize,
|
||||
size_t *aPresShellSize,
|
||||
size_t *aStyleSetsSize,
|
||||
size_t *aTextRunsSize,
|
||||
size_t *aPresContextSize) = 0;
|
||||
|
||||
/**
|
||||
* Methods that retrieve the cached font inflation preferences.
|
||||
|
|
|
@ -177,8 +177,8 @@ nsPresArena::FreeListEnumerator(FreeList* aEntry, void* aData)
|
|||
}
|
||||
|
||||
void
|
||||
nsPresArena::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats* aArenaStats)
|
||||
nsPresArena::AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats* aArenaStats)
|
||||
{
|
||||
// We do a complicated dance here because we want to measure the
|
||||
// space taken up by the different kinds of objects in the arena,
|
||||
|
@ -197,5 +197,5 @@ nsPresArena::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
|||
|
||||
EnumerateData data = { aArenaStats, 0 };
|
||||
mFreeLists.EnumerateEntries(FreeListEnumerator, &data);
|
||||
aArenaStats->mOther = mallocSize - data.total;
|
||||
aArenaStats->mOther += mallocSize - data.total;
|
||||
}
|
||||
|
|
|
@ -82,11 +82,11 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Fill aArenaStats with sizes of interesting objects allocated in
|
||||
* this arena and its mOther field with the size of everything else.
|
||||
* Increment aArenaStats with sizes of interesting objects allocated in this
|
||||
* arena and its mOther field with the size of everything else.
|
||||
*/
|
||||
void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats* aArenaStats);
|
||||
void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats* aArenaStats);
|
||||
|
||||
private:
|
||||
NS_HIDDEN_(void*) Allocate(uint32_t aCode, size_t aSize);
|
||||
|
|
|
@ -9529,22 +9529,22 @@ PresShell::GetRootPresShell()
|
|||
}
|
||||
|
||||
void
|
||||
PresShell::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats *aArenaObjectsSize,
|
||||
size_t *aPresShellSize,
|
||||
size_t *aStyleSetsSize,
|
||||
size_t *aTextRunsSize,
|
||||
size_t *aPresContextSize)
|
||||
PresShell::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats *aArenaObjectsSize,
|
||||
size_t *aPresShellSize,
|
||||
size_t *aStyleSetsSize,
|
||||
size_t *aTextRunsSize,
|
||||
size_t *aPresContextSize)
|
||||
{
|
||||
mFrameArena.SizeOfExcludingThis(aMallocSizeOf, aArenaObjectsSize);
|
||||
*aPresShellSize = aMallocSizeOf(this);
|
||||
mFrameArena.AddSizeOfExcludingThis(aMallocSizeOf, aArenaObjectsSize);
|
||||
*aPresShellSize += aMallocSizeOf(this);
|
||||
*aPresShellSize += aArenaObjectsSize->mOther;
|
||||
|
||||
*aStyleSetsSize = StyleSet()->SizeOfIncludingThis(aMallocSizeOf);
|
||||
*aStyleSetsSize += StyleSet()->SizeOfIncludingThis(aMallocSizeOf);
|
||||
|
||||
*aTextRunsSize = SizeOfTextRuns(aMallocSizeOf);
|
||||
*aTextRunsSize += SizeOfTextRuns(aMallocSizeOf);
|
||||
|
||||
*aPresContextSize = mPresContext->SizeOfIncludingThis(aMallocSizeOf);
|
||||
*aPresContextSize += mPresContext->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
@ -314,12 +314,12 @@ public:
|
|||
IsLayoutFlushObserver(this);
|
||||
}
|
||||
|
||||
void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats *aArenaObjectsSize,
|
||||
size_t *aPresShellSize,
|
||||
size_t *aStyleSetsSize,
|
||||
size_t *aTextRunsSize,
|
||||
size_t *aPresContextSize) MOZ_OVERRIDE;
|
||||
void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
nsArenaMemoryStats *aArenaObjectsSize,
|
||||
size_t *aPresShellSize,
|
||||
size_t *aStyleSetsSize,
|
||||
size_t *aTextRunsSize,
|
||||
size_t *aPresContextSize) MOZ_OVERRIDE;
|
||||
size_t SizeOfTextRuns(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) MOZ_OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче