mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 674922 - report on most common objects allocated in a PresShell's arena; r=roc,njn
This commit is contained in:
parent
07dd9516f2
commit
df08b6c5cc
@ -187,6 +187,21 @@ CollectWindowReports(nsGlobalWindow *aWindow,
|
||||
"within a window.");
|
||||
aWindowTotalSizes->mLayoutPresShell += windowSizes.mLayoutPresShell;
|
||||
|
||||
REPORT("/layout/line-boxes", windowSizes.mArenaStats.mLineBoxes,
|
||||
"Memory used by line boxes within a window.");
|
||||
aWindowTotalSizes->mArenaStats.mLineBoxes
|
||||
+= windowSizes.mArenaStats.mLineBoxes;
|
||||
|
||||
REPORT("/layout/rule-nodes", windowSizes.mArenaStats.mRuleNodes,
|
||||
"Memory used by CSS rule nodes within a window.");
|
||||
aWindowTotalSizes->mArenaStats.mRuleNodes
|
||||
+= windowSizes.mArenaStats.mRuleNodes;
|
||||
|
||||
REPORT("/layout/style-contexts", windowSizes.mArenaStats.mStyleContexts,
|
||||
"Memory used by style contexts within a window.");
|
||||
aWindowTotalSizes->mArenaStats.mStyleContexts
|
||||
+= windowSizes.mArenaStats.mStyleContexts;
|
||||
|
||||
REPORT("/layout/style-sets", windowSizes.mLayoutStyleSets,
|
||||
"Memory used by style sets within a window.");
|
||||
aWindowTotalSizes->mLayoutStyleSets += windowSizes.mLayoutStyleSets;
|
||||
@ -322,6 +337,21 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryMultiReporterCallback* aCb,
|
||||
"areas within windows. This is the sum of all windows' "
|
||||
"'layout/arenas' numbers.");
|
||||
|
||||
REPORT("window-objects-layout-line-boxes",
|
||||
windowTotalSizes.mArenaStats.mLineBoxes,
|
||||
"Memory used for line-boxes within windows. "
|
||||
"This is the sum of all windows' 'layout/line-boxes' numbers.");
|
||||
|
||||
REPORT("window-objects-layout-rule-nodes",
|
||||
windowTotalSizes.mArenaStats.mRuleNodes,
|
||||
"Memory used for CSS rule nodes within windows. "
|
||||
"This is the sum of all windows' 'layout/rule-nodes' numbers.");
|
||||
|
||||
REPORT("window-objects-layout-style-contexts",
|
||||
windowTotalSizes.mArenaStats.mStyleContexts,
|
||||
"Memory used for style contexts within windows. "
|
||||
"This is the sum of all windows' 'layout/style-contexts' numbers.");
|
||||
|
||||
REPORT("window-objects-layout-style-sets", windowTotalSizes.mLayoutStyleSets,
|
||||
"Memory used for style sets within windows. "
|
||||
"This is the sum of all windows' 'layout/style-sets' numbers.");
|
||||
|
@ -11,6 +11,9 @@ struct nsArenaMemoryStats {
|
||||
#define FRAME_ID(classname) size_t FRAME_ID_STAT_FIELD(classname);
|
||||
#include "nsFrameIdList.h"
|
||||
#undef FRAME_ID
|
||||
size_t mLineBoxes;
|
||||
size_t mRuleNodes;
|
||||
size_t mStyleContexts;
|
||||
size_t mOther;
|
||||
};
|
||||
|
||||
|
@ -398,6 +398,15 @@ struct nsPresArena::State {
|
||||
break;
|
||||
#include "nsFrameIdList.h"
|
||||
#undef FRAME_ID
|
||||
case nsLineBox_id:
|
||||
p = &data->stats->mLineBoxes;
|
||||
break;
|
||||
case nsRuleNode_id:
|
||||
p = &data->stats->mRuleNodes;
|
||||
break;
|
||||
case nsStyleContext_id:
|
||||
p = &data->stats->mStyleContexts;
|
||||
break;
|
||||
default:
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ public:
|
||||
|
||||
enum ObjectID {
|
||||
nsLineBox_id = nsQueryFrame::NON_FRAME_MARKER,
|
||||
nsRuleNode_id,
|
||||
nsStyleContext_id,
|
||||
|
||||
// The PresArena implementation uses this bit to distinguish objects
|
||||
// allocated by size from objects allocated by type ID (that is, frames
|
||||
|
@ -1129,7 +1129,7 @@ void*
|
||||
nsRuleNode::operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW
|
||||
{
|
||||
// Check the recycle list first.
|
||||
return aPresContext->AllocateFromShell(sz);
|
||||
return aPresContext->PresShell()->AllocateByObjectID(nsPresArena::nsRuleNode_id, sz);
|
||||
}
|
||||
|
||||
/* static */ PLDHashOperator
|
||||
@ -1192,7 +1192,7 @@ nsRuleNode::DestroyInternal(nsRuleNode ***aDestroyQueueTail)
|
||||
|
||||
// Don't let the memory be freed, since it will be recycled
|
||||
// instead. Don't call the global operator delete.
|
||||
mPresContext->FreeToShell(sizeof(nsRuleNode), this);
|
||||
mPresContext->PresShell()->FreeByObjectID(nsPresArena::nsRuleNode_id, this);
|
||||
}
|
||||
|
||||
nsRuleNode* nsRuleNode::CreateRootNode(nsPresContext* aPresContext)
|
||||
|
@ -665,7 +665,7 @@ void*
|
||||
nsStyleContext::operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW
|
||||
{
|
||||
// Check the recycle list first.
|
||||
return aPresContext->AllocateFromShell(sz);
|
||||
return aPresContext->PresShell()->AllocateByObjectID(nsPresArena::nsStyleContext_id, sz);
|
||||
}
|
||||
|
||||
// Overridden to prevent the global delete from being called, since the memory
|
||||
@ -681,7 +681,7 @@ nsStyleContext::Destroy()
|
||||
|
||||
// Don't let the memory be freed, since it will be recycled
|
||||
// instead. Don't call the global operator delete.
|
||||
presContext->FreeToShell(sizeof(nsStyleContext), this);
|
||||
presContext->PresShell()->FreeByObjectID(nsPresArena::nsStyleContext_id, this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
|
Loading…
Reference in New Issue
Block a user