Bug 1109928, part 4 - Make CCBuilder::AddNode private by adding a new AddPurpleRoot method. r=smaug

This commit is contained in:
Andrew McCreight 2014-12-20 13:35:23 -05:00
parent 764969e15b
commit b519d1244c

View File

@ -2064,7 +2064,7 @@ public:
return nsCycleCollectionNoteRootCallback::WantAllTraces();
}
PtrInfo* AddNode(void* aPtr, nsCycleCollectionParticipant* aParticipant);
bool AddPurpleRoot(void* aRoot, nsCycleCollectionParticipant* aParti);
// This is called when all roots have been added to the graph, to prepare for BuildGraph().
void DoneAddingRoots();
@ -2073,6 +2073,7 @@ public:
bool BuildGraph(SliceBudget& aBudget);
private:
PtrInfo* AddNode(void* aPtr, nsCycleCollectionParticipant* aParticipant);
PtrInfo* AddWeakMapNode(JS::GCCellPtr aThing);
PtrInfo* AddWeakMapNode(JSObject* aObject);
@ -2215,6 +2216,21 @@ CCGraphBuilder::AddNode(void* aPtr, nsCycleCollectionParticipant* aParticipant)
return result;
}
bool
CCGraphBuilder::AddPurpleRoot(void* aRoot, nsCycleCollectionParticipant* aParti)
{
CanonicalizeParticipant(&aRoot, &aParti);
if (WantAllTraces() || !aParti->CanSkipInCC(aRoot)) {
PtrInfo* pinfo = AddNode(aRoot, aParti);
if (!pinfo) {
return false;
}
}
return true;
}
void
CCGraphBuilder::DoneAddingRoots()
{
@ -2463,16 +2479,7 @@ static bool
AddPurpleRoot(CCGraphBuilder& aBuilder, void* aRoot,
nsCycleCollectionParticipant* aParti)
{
CanonicalizeParticipant(&aRoot, &aParti);
if (aBuilder.WantAllTraces() || !aParti->CanSkipInCC(aRoot)) {
PtrInfo* pinfo = aBuilder.AddNode(aRoot, aParti);
if (!pinfo) {
return false;
}
}
return true;
return aBuilder.AddPurpleRoot(aRoot, aParti);
}
// MayHaveChild() will be false after a Traverse if the object does