зеркало из https://github.com/mozilla/gecko-dev.git
Bug 760831 - split out per-node type stats in about:memory; r=njn, bz
This commit is contained in:
Родитель
9d780315ce
Коммит
0bacdb189a
|
@ -9658,7 +9658,7 @@ nsDocument::GetMozVisibilityState(nsAString& aState)
|
|||
/* virtual */ void
|
||||
nsIDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOM +=
|
||||
aWindowSizes->mDOMOther +=
|
||||
nsINode::SizeOfExcludingThis(aWindowSizes->mMallocSizeOf);
|
||||
|
||||
if (mPresShell) {
|
||||
|
@ -9677,7 +9677,7 @@ nsIDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
|||
void
|
||||
nsIDocument::DocSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOM += aWindowSizes->mMallocSizeOf(this);
|
||||
aWindowSizes->mDOMOther += aWindowSizes->mMallocSizeOf(this);
|
||||
DocSizeOfExcludingThis(aWindowSizes);
|
||||
}
|
||||
|
||||
|
@ -9709,14 +9709,34 @@ nsDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
|||
node;
|
||||
node = node->GetNextNode(this))
|
||||
{
|
||||
aWindowSizes->mDOM +=
|
||||
node->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf);
|
||||
size_t nodeSize = node->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf);
|
||||
size_t* p;
|
||||
|
||||
switch (node->NodeType()) {
|
||||
case nsIDOMNode::ELEMENT_NODE:
|
||||
p = &aWindowSizes->mDOMElementNodes;
|
||||
break;
|
||||
case nsIDOMNode::TEXT_NODE:
|
||||
p = &aWindowSizes->mDOMTextNodes;
|
||||
break;
|
||||
case nsIDOMNode::CDATA_SECTION_NODE:
|
||||
p = &aWindowSizes->mDOMCDATANodes;
|
||||
break;
|
||||
case nsIDOMNode::COMMENT_NODE:
|
||||
p = &aWindowSizes->mDOMCommentNodes;
|
||||
break;
|
||||
default:
|
||||
p = &aWindowSizes->mDOMOther;
|
||||
break;
|
||||
}
|
||||
|
||||
*p += nodeSize;
|
||||
}
|
||||
|
||||
aWindowSizes->mStyleSheets +=
|
||||
mStyleSheets.SizeOfExcludingThis(SizeOfStyleSheetsElementIncludingThis,
|
||||
aWindowSizes->mMallocSizeOf);
|
||||
aWindowSizes->mDOM +=
|
||||
aWindowSizes->mDOMOther +=
|
||||
mAttrStyleSheet ?
|
||||
mAttrStyleSheet->DOMSizeOfIncludingThis(aWindowSizes->mMallocSizeOf) :
|
||||
0;
|
||||
|
|
|
@ -10131,13 +10131,13 @@ nsGlobalWindow::HasPerformanceSupport()
|
|||
void
|
||||
nsGlobalWindow::SizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOM += aWindowSizes->mMallocSizeOf(this);
|
||||
aWindowSizes->mDOMOther += aWindowSizes->mMallocSizeOf(this);
|
||||
|
||||
if (IsInnerWindow()) {
|
||||
nsEventListenerManager* elm =
|
||||
const_cast<nsGlobalWindow*>(this)->GetListenerManager(false);
|
||||
if (elm) {
|
||||
aWindowSizes->mDOM +=
|
||||
aWindowSizes->mDOMOther +=
|
||||
elm->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf);
|
||||
}
|
||||
if (mDoc) {
|
||||
|
@ -10145,7 +10145,7 @@ nsGlobalWindow::SizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
|||
}
|
||||
}
|
||||
|
||||
aWindowSizes->mDOM +=
|
||||
aWindowSizes->mDOMOther +=
|
||||
mNavigator ?
|
||||
mNavigator->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf) : 0;
|
||||
}
|
||||
|
|
|
@ -156,9 +156,26 @@ CollectWindowReports(nsGlobalWindow *aWindow,
|
|||
nsWindowSizes windowSizes(DOMStyleMallocSizeOf);
|
||||
aWindow->SizeOfIncludingThis(&windowSizes);
|
||||
|
||||
REPORT("/dom", windowSizes.mDOM,
|
||||
"Memory used by a window and the DOM within it.");
|
||||
aWindowTotalSizes->mDOM += windowSizes.mDOM;
|
||||
REPORT("/dom/other", windowSizes.mDOMOther,
|
||||
"Memory used by a window's DOM, excluding element, text, CDATA, "
|
||||
"and comment nodes.");
|
||||
aWindowTotalSizes->mDOMOther += windowSizes.mDOMOther;
|
||||
|
||||
REPORT("/dom/element-nodes", windowSizes.mDOMElementNodes,
|
||||
"Memory used by the element nodes in a window's DOM.");
|
||||
aWindowTotalSizes->mDOMElementNodes += windowSizes.mDOMElementNodes;
|
||||
|
||||
REPORT("/dom/text-nodes", windowSizes.mDOMTextNodes,
|
||||
"Memory used by the text nodes in a window's DOM.");
|
||||
aWindowTotalSizes->mDOMTextNodes += windowSizes.mDOMTextNodes;
|
||||
|
||||
REPORT("/dom/cdata-nodes", windowSizes.mDOMCDATANodes,
|
||||
"Memory used by the CDATA nodes in a window's DOM.");
|
||||
aWindowTotalSizes->mDOMCDATANodes += windowSizes.mDOMCDATANodes;
|
||||
|
||||
REPORT("/dom/comment-nodes", windowSizes.mDOMCommentNodes,
|
||||
"Memory used by the comment nodes in a window's DOM.");
|
||||
aWindowTotalSizes->mDOMCommentNodes += windowSizes.mDOMCommentNodes;
|
||||
|
||||
REPORT("/style-sheets", windowSizes.mStyleSheets,
|
||||
"Memory used by style sheets within a window.");
|
||||
|
@ -246,10 +263,27 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryMultiReporterCallback* aCb,
|
|||
NS_ENSURE_SUCCESS(rv, rv); \
|
||||
} while (0)
|
||||
|
||||
REPORT("window-objects-dom", windowTotalSizes.mDOM,
|
||||
"Memory used for the DOM within windows. "
|
||||
"This is the sum of all windows' 'dom' numbers.");
|
||||
|
||||
REPORT("window-objects-dom-other", windowTotalSizes.mDOMOther,
|
||||
"Memory used for the DOM within windows, "
|
||||
"excluding element, text, CDATA, and comment nodes. "
|
||||
"This is the sum of all windows' 'dom/other' numbers.");
|
||||
|
||||
REPORT("window-objects-dom-element-nodes", windowTotalSizes.mDOMElementNodes,
|
||||
"Memory used for DOM element nodes within windows. "
|
||||
"This is the sum of all windows' 'dom/element-nodes' numbers.");
|
||||
|
||||
REPORT("window-objects-dom-text-nodes", windowTotalSizes.mDOMTextNodes,
|
||||
"Memory used for DOM text nodes within windows. "
|
||||
"This is the sum of all windows' 'dom/text-nodes' numbers.");
|
||||
|
||||
REPORT("window-objects-dom-cdata-nodes", windowTotalSizes.mDOMCDATANodes,
|
||||
"Memory used for DOM CDATA nodes within windows. "
|
||||
"This is the sum of all windows' 'dom/cdata-nodes' numbers.");
|
||||
|
||||
REPORT("window-objects-dom-comment-nodes", windowTotalSizes.mDOMCommentNodes,
|
||||
"Memory used for DOM comment nodes within windows. "
|
||||
"This is the sum of all windows' 'dom/comment-nodes' numbers.");
|
||||
|
||||
REPORT("window-objects-style-sheets", windowTotalSizes.mStyleSheets,
|
||||
"Memory used for style sheets within windows. "
|
||||
"This is the sum of all windows' 'style-sheets' numbers.");
|
||||
|
|
|
@ -27,7 +27,11 @@ public:
|
|||
mMallocSizeOf = aMallocSizeOf;
|
||||
}
|
||||
nsMallocSizeOfFun mMallocSizeOf;
|
||||
size_t mDOM;
|
||||
size_t mDOMElementNodes;
|
||||
size_t mDOMTextNodes;
|
||||
size_t mDOMCDATANodes;
|
||||
size_t mDOMCommentNodes;
|
||||
size_t mDOMOther;
|
||||
size_t mStyleSheets;
|
||||
size_t mLayoutArenas;
|
||||
size_t mLayoutStyleSets;
|
||||
|
|
Загрузка…
Ссылка в новой задаче