Closed Bug 584048 Opened 14 years ago Closed 13 years ago

Clean up cycle collection code

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: peterv, Assigned: peterv)

References

Details

Attachments

(5 files)

We should merge BeginCollection and FinishCollection into a Collect function, since nothing needs to call them separately anymore. Also, currently the participants have three hooks: RootAndUnlinkJSObjects, Unlink and Unroot. Since we don't intertwine GC and CC anymore we should make that Root, Unlink and Unroot and just unlink the JS objects from Unlink too.
BeginCollection and FinishCollection need to be separate again since we moved stuff to a different thread, but there is still a bunch of cleanup we can do.
Summary: Merge nsCycleCollector::BeginCollection and ::FinishCollection → Clean up cycle collection code
We needed to do unlinking of JS members from Root because we needed to forget those references before marking black objects and GC sweeping, which happened between Root and Unlink. Since we don't run the GC during the CC anymore we don't need to do that anymore, we can just unlink all members from Unlink.
Attachment #517157 - Flags: review?(bent.mozilla)
Given that we don't unlink from Root anymore.
Attachment #517158 - Flags: review?(bent.mozilla)
We made NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS/NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS identical to NS_IMPL_CYCLE_COLLECTING_ADDREF/NS_IMPL_CYCLE_COLLECTING_RELEASE a long time ago (they don't use the _basetype argument anymore). We might as well remove them.
Attachment #517159 - Flags: review?(bent.mozilla)
Again made possible because we don't run GC during CC anymore.
Attachment #517160 - Flags: review?(bent.mozilla)
Not really cleanup but whatever :-).
Attachment #517161 - Flags: review?(bent.mozilla)
Comment on attachment 517157 [details] [diff] [review]
Move unlinking of JS members from root into unlink

This all looks good.
Attachment #517157 - Flags: review?(bent.mozilla) → review+
Attachment #517158 - Flags: review?(bent.mozilla) → review+
Attachment #517159 - Flags: review?(bent.mozilla) → review+
Attachment #517160 - Flags: review?(bent.mozilla) → review+
Comment on attachment 517161 [details] [diff] [review]
Add some edge names

>+                NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "tearoffs mNative");

Nit: "tearoff's mNative" or "tearoff->mNative"
Attachment #517161 - Flags: review?(bent.mozilla) → review+
Depends on: 648720
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: