Bug 901597, part 1 - Move CC logging logic into nsCCParams. r=smaug

This commit is contained in:
Andrew McCreight 2014-02-19 13:27:14 -08:00
parent 8807edd27d
commit 3fd4ecc704

View File

@ -237,6 +237,11 @@ struct nsCycleCollectorParams
mAllTracesAtShutdown (PR_GetEnv("MOZ_CC_ALL_TRACES_AT_SHUTDOWN") != nullptr)
{
}
bool LogThisCC(bool aIsShutdown)
{
return mLogAll || (aIsShutdown && mLogShutdown);
}
};
#ifdef COLLECT_TIME_DEBUG
@ -3306,14 +3311,12 @@ nsCycleCollector::BeginCollection(ccType aCCType,
MOZ_ASSERT(!mListener, "Forgot to clear a previous listener?");
mListener = aManualListener;
aManualListener = nullptr;
if (!mListener) {
if (mParams.mLogAll || (isShutdown && mParams.mLogShutdown)) {
nsRefPtr<nsCycleCollectorLogger> logger = new nsCycleCollectorLogger();
if (isShutdown && mParams.mAllTracesAtShutdown) {
logger->SetAllTraces();
}
mListener = logger.forget();
if (!mListener && mParams.LogThisCC(isShutdown)) {
nsRefPtr<nsCycleCollectorLogger> logger = new nsCycleCollectorLogger();
if (isShutdown && mParams.mAllTracesAtShutdown) {
logger->SetAllTraces();
}
mListener = logger.forget();
}
bool forceGC = isShutdown;