Remove NS_CycleCollectorForget2 and friends

RESOLVED FIXED in mozilla23

Status

()

defect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mccr8, Assigned: mccr8)

Tracking

(Blocks 1 bug)

Trunk
mozilla23
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

Thanks to Olli's ref counting improvements the cycle collector never forgets, so we should just get rid of this function.  See bug 785666 for the changes that may be required for the xpcom/{stub, build} stuff.
Looks like xpcom/stub is gone.
Comment on attachment 743751 [details] [diff] [review]
part 1: gut NS_CycleCollectorForget2 and rename nsCycleCollector::Suspect2 to Suspect

># HG changeset patch
># User Andrew McCreight <amccreight@mozilla.com>
># Date 1367345699 25200
># Node ID a6d1e489f366523583d6365ec5608ada430ffcf9
># Parent  122a97fd3d4d8a99ffa5287c0cf49c9d0ff6f9da
>Bug 863085, part 1 - Gut NS_CycleCollectorForget2 and rename CC:Suspect2. r=smaug
>
>diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp
>--- a/xpcom/base/nsCycleCollector.cpp
>+++ b/xpcom/base/nsCycleCollector.cpp
>@@ -1064,18 +1064,17 @@ public:
>     bool CollectWhite(nsICycleCollectorListener *aListener);
> 
>     nsCycleCollector(CCThreadingModel aModel);
>     ~nsCycleCollector();
> 
>     nsresult Init();
>     void ShutdownThreads();
> 
>-    nsPurpleBufferEntry* Suspect2(void *n, nsCycleCollectionParticipant *cp);
>-    bool Forget2(nsPurpleBufferEntry *e);
>+    nsPurpleBufferEntry* Suspect(void *n, nsCycleCollectionParticipant *cp);
> 
>     void CheckThreadSafety();
> 
> private:
>     void ShutdownCollect(nsICycleCollectorListener *aListener);
> 
> public:
>     void Collect(ccType aCCType,
>@@ -2596,17 +2595,17 @@ nsCycleCollector_isScanSafe(void *s, nsC
>     nsXPCOMCycleCollectionParticipant *xcp;
>     ToParticipant(static_cast<nsISupports*>(s), &xcp);
> 
>     return xcp != nullptr;
> }
> #endif
> 
> nsPurpleBufferEntry*
>-nsCycleCollector::Suspect2(void *n, nsCycleCollectionParticipant *cp)
>+nsCycleCollector::Suspect(void *n, nsCycleCollectionParticipant *cp)
> {
>     CheckThreadSafety();
> 
>     // Re-entering ::Suspect during collection used to be a fault, but
>     // we are canonicalizing nsISupports pointers using QI, so we will
>     // see some spurious refcount traffic here. 
> 
>     if (mScanInProgress)
>@@ -2617,33 +2616,16 @@ nsCycleCollector::Suspect2(void *n, nsCy
> 
>     if (mParams.mDoNothing)
>         return nullptr;
> 
>     // Caller is responsible for filling in result's mRefCnt.
>     return mPurpleBuf.Put(n, cp);
> }
> 
>-
>-bool
>-nsCycleCollector::Forget2(nsPurpleBufferEntry *e)
>-{
>-    CheckThreadSafety();
>-
>-    // Re-entering ::Forget during collection used to be a fault, but
>-    // we are canonicalizing nsISupports pointers using QI, so we will
>-    // see some spurious refcount traffic here. 
>-
>-    if (mScanInProgress)
>-        return false;
>-
>-    mPurpleBuf.Remove(e);
>-    return true;
>-}
>-
> void
> nsCycleCollector::CheckThreadSafety()
> {
> #ifdef DEBUG
>     MOZ_ASSERT(mThread == PR_GetCurrentThread());
> #endif
> }
> 
>@@ -2990,34 +2972,23 @@ NS_CycleCollectorSuspect2(void *n, nsCyc
>     }
> 
>     if (collector == (nsCycleCollector*)1) {
>         // This is our special sentinel value that tells us that we've shut
>         // down this thread's CC.
>         return nullptr;
>     }
> 
>-    return collector->Suspect2(n, cp);
>+    return collector->Suspect(n, cp);
> }
> 
> bool
> NS_CycleCollectorForget2(nsPurpleBufferEntry *e)
> {
>-    nsCycleCollector *collector = sCollector.get();
>-
>-    if (!collector)
>-        MOZ_CRASH();
>-
>-    if (collector == (nsCycleCollector*)1) {
>-        // This is our special sentinel value that tells us that we've shut
>-        // down this thread's CC.
>-        return true;
>-    }
>-
>-    return collector->Forget2(e);
>+    return true;
> }
> 
> uint32_t
> nsCycleCollector_suspectedCount()
> {
>     nsCycleCollector *collector = sCollector.get();
> 
>     if (collector == (nsCycleCollector*)1) {
Attachment #743751 - Attachment description: gut NS_CycleCollectorForget2 and rename nsCycleCollector::Suspect2 to Suspect → part 1: gut NS_CycleCollectorForget2 and rename nsCycleCollector::Suspect2 to Suspect
I should also update the comments in nsCycleCollector.cpp which talk about forget and are horribly outdated at this point.
I updated the comments in the file so they are not quite so out-of-date.
Attachment #743751 - Attachment is obsolete: true
Attachment #743758 - Flags: review?(benjamin)
Attachment #743888 - Flags: review?(bugs)
Attachment #743758 - Flags: review?(benjamin) → review+
Comment on attachment 743888 [details] [diff] [review]
part 1: gut NS_CycleCollectorForget2 and rename nsCycleCollector::Suspect2 to Suspect

So we have empty NS_CycleCollectorForget2?
Could we at least add a warning if one tries to use it.
Oh, the other patch removes it.
Attachment #743888 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/210b52cdd7eb
https://hg.mozilla.org/mozilla-central/rev/5aceec8a1222
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.