Bug 913881, part 4 - Change nsCycleCollector::ClearGraph to GCGraph::Clear. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Tue, 10 Sep 2013 08:56:36 -0700
changeset 146439 d722282fdc4dde056610a04cb4db82c16e018aac
parent 146438 8ac551efe4e110a439212a70002807fa1b7e9bac
child 146440 a36c944c929ed44a0ca361743cab150eca1be7c6
push id25260
push userryanvm@gmail.com
push dateWed, 11 Sep 2013 00:29:30 +0000
treeherdermozilla-central@f73bed2856a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs913881
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 913881, part 4 - Change nsCycleCollector::ClearGraph to GCGraph::Clear. r=smaug There's no reason I can see to have this in nsCC instead of GCGraph.
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -602,16 +602,24 @@ struct GCGraph
     nsTArray<WeakMapping> mWeakMaps;
     uint32_t mRootCount;
 
     GCGraph() : mRootCount(0) {
     }
     ~GCGraph() {
     }
 
+    void Clear()
+    {
+        mNodes.Clear();
+        mEdges.Clear();
+        mWeakMaps.Clear();
+        mRootCount = 0;
+    }
+
     void SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
                              size_t *aNodesSize, size_t *aEdgesSize) const {
         *aNodesSize = mNodes.SizeOfExcludingThis(aMallocSizeOf);
         *aEdgesSize = mEdges.SizeOfExcludingThis(aMallocSizeOf);
 
         // These fields are deliberately not measured:
         // - mWeakMaps entries, because the pointers are non-owning
     }
@@ -984,24 +992,16 @@ private:
     void MarkRoots(GCGraphBuilder &aBuilder);
     void ScanRoots();
     void ScanWeakMaps();
 
     // returns whether anything was collected
     bool CollectWhite(nsICycleCollectorListener *aListener);
 
     void CleanupAfterCollection();
-
-    void ClearGraph()
-    {
-        mGraph.mNodes.Clear();
-        mGraph.mEdges.Clear();
-        mGraph.mWeakMaps.Clear();
-        mGraph.mRootCount = 0;
-    }
 };
 
 /**
  * GraphWalker is templatized over a Visitor class that must provide
  * the following two methods:
  *
  * bool ShouldVisitNode(PtrInfo const *pi);
  * void VisitNode(PtrInfo *pi);
@@ -2610,17 +2610,17 @@ nsCycleCollector::PrepareForCollection(n
     timeLog.Checkpoint("PrepareForCollection()");
 }
 
 void
 nsCycleCollector::CleanupAfterCollection()
 {
     mWhiteNodes->Clear();
     mWhiteNodes = nullptr;
-    ClearGraph();
+    mGraph.Clear();
     mCollectionInProgress = false;
 
 #ifdef XP_OS2
     // Now that the cycle collector has freed some memory, we can try to
     // force the C library to give back as much memory to the system as
     // possible.
     _heapmin();
 #endif