зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1116550 - Part 1: Turn HaveLeaks and Clear into methods. r=froydnj
--HG-- extra : rebase_source : f033cdf0c00b5fd6d9c7b50581cd1f3fc19795a0
This commit is contained in:
Родитель
c02a86e899
Коммит
cf5870400c
|
@ -116,6 +116,17 @@ struct nsTraceRefcntStats
|
|||
{
|
||||
uint64_t mCreates;
|
||||
uint64_t mDestroys;
|
||||
|
||||
bool HaveLeaks() const
|
||||
{
|
||||
return mCreates != mDestroys;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
mCreates = 0;
|
||||
mDestroys = 0;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -249,8 +260,8 @@ public:
|
|||
{
|
||||
NS_ASSERTION(strlen(aClassName) > 0, "BloatEntry name must be non-empty");
|
||||
mClassName = PL_strdup(aClassName);
|
||||
Clear(&mNewStats);
|
||||
Clear(&mAllStats);
|
||||
mNewStats.Clear();
|
||||
mAllStats.Clear();
|
||||
mTotalLeaked = 0;
|
||||
}
|
||||
|
||||
|
@ -268,17 +279,11 @@ public:
|
|||
return mClassName;
|
||||
}
|
||||
|
||||
static void Clear(nsTraceRefcntStats* aStats)
|
||||
{
|
||||
aStats->mCreates = 0;
|
||||
aStats->mDestroys = 0;
|
||||
}
|
||||
|
||||
void Accumulate()
|
||||
{
|
||||
mAllStats.mCreates += mNewStats.mCreates;
|
||||
mAllStats.mDestroys += mNewStats.mDestroys;
|
||||
Clear(&mNewStats);
|
||||
mNewStats.Clear();
|
||||
}
|
||||
|
||||
void Ctor()
|
||||
|
@ -327,11 +332,6 @@ public:
|
|||
Dump(-1, aOut, nsTraceRefcnt::ALL_STATS);
|
||||
}
|
||||
|
||||
static bool HaveLeaks(nsTraceRefcntStats* aStats)
|
||||
{
|
||||
return aStats->mCreates != aStats->mDestroys;
|
||||
}
|
||||
|
||||
bool PrintDumpHeader(FILE* aOut, const char* aMsg,
|
||||
nsTraceRefcnt::StatisticsType aType)
|
||||
{
|
||||
|
@ -339,7 +339,7 @@ public:
|
|||
XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
|
||||
nsTraceRefcntStats& stats =
|
||||
(aType == nsTraceRefcnt::NEW_STATS) ? mNewStats : mAllStats;
|
||||
if (gLogLeaksOnly && !HaveLeaks(&stats)) {
|
||||
if (gLogLeaksOnly && !stats.HaveLeaks()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -357,12 +357,11 @@ public:
|
|||
{
|
||||
nsTraceRefcntStats* stats =
|
||||
(aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats;
|
||||
if (gLogLeaksOnly && !HaveLeaks(stats)) {
|
||||
if (gLogLeaksOnly && !stats->HaveLeaks()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((stats->mCreates - stats->mDestroys) != 0 ||
|
||||
stats->mCreates != 0) {
|
||||
if (stats->HaveLeaks() || stats->mCreates != 0) {
|
||||
fprintf(aOut, "%4d |%-38.38s| %8d %8" PRIu64 "|%8" PRIu64 " %8" PRIu64"|\n",
|
||||
aIndex + 1, mClassName,
|
||||
(int32_t)mClassSize,
|
||||
|
|
Загрузка…
Ссылка в новой задаче