Backout bug 901597 for valgrind leaks
authorAndrew McCreight <amccreight@mozilla.com>
Wed, 19 Feb 2014 17:19:17 -0800
changeset 169980 a4c2d5bb71728c94dfbd48620b71720f09ee94a7
parent 169979 d163502f0c6fbadce80bdd7791e8b25d0e07c186
child 169981 d7f83da8e0fef9931f8cdcabd4f444944037b674
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs901597
milestone30.0a1
Backout bug 901597 for valgrind leaks
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -232,21 +232,16 @@ struct nsCycleCollectorParams
     bool mAllTracesAtShutdown;
 
     nsCycleCollectorParams() :
         mLogAll      (PR_GetEnv("MOZ_CC_LOG_ALL") != nullptr),
         mLogShutdown (PR_GetEnv("MOZ_CC_LOG_SHUTDOWN") != nullptr),
         mAllTracesAtShutdown (PR_GetEnv("MOZ_CC_ALL_TRACES_AT_SHUTDOWN") != nullptr)
     {
     }
-
-    bool LogThisCC(bool aIsShutdown)
-    {
-        return mLogAll || (aIsShutdown && mLogShutdown);
-    }
 };
 
 #ifdef COLLECT_TIME_DEBUG
 class TimeLog
 {
 public:
     TimeLog() : mLastCheckpoint(TimeStamp::Now()) {}
 
@@ -3306,22 +3301,24 @@ nsCycleCollector::BeginCollection(ccType
 
     bool isShutdown = (aCCType == ShutdownCC);
 
     // Set up the listener for this CC.
     MOZ_ASSERT_IF(isShutdown, !aManualListener);
     MOZ_ASSERT(!mListener, "Forgot to clear a previous listener?");
     mListener = aManualListener;
     aManualListener = nullptr;
-    if (!mListener && mParams.LogThisCC(isShutdown)) {
-        nsRefPtr<nsCycleCollectorLogger> logger = new nsCycleCollectorLogger();
-        if (isShutdown && mParams.mAllTracesAtShutdown) {
-            logger->SetAllTraces();
+    if (!mListener) {
+        if (mParams.mLogAll || (isShutdown && mParams.mLogShutdown)) {
+            nsRefPtr<nsCycleCollectorLogger> logger = new nsCycleCollectorLogger();
+            if (isShutdown && mParams.mAllTracesAtShutdown) {
+                logger->SetAllTraces();
+            }
+            mListener = logger.forget();
         }
-        mListener = logger.forget();
     }
 
     bool forceGC = isShutdown;
     if (!forceGC && mListener) {
         // On a WantAllTraces CC, force a synchronous global GC to prevent
         // hijinks from ForgetSkippable and compartmental GCs.
         mListener->GetWantAllTraces(&forceGC);
     }