Closed Bug 951855 Opened 12 years ago Closed 11 years ago

nsICycleCollectorListener's documentation is confusing

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: jimb, Assigned: jimb)

Details

Attachments

(1 file, 3 obsolete files)

The comments in xpcom/base/nsICycleCollectorListener.idl don't make clear the relationship between nsICycleCollectorListener and nsICycleCollectorHandler, and its rationale. bz dared me to improve the docs on IRC, so here's my attempt. It's probably too long-winded, but hopefully it's an improvement.
Attachment #8349667 - Flags: review?(bugs)
Fixed some typos.
Assignee: nobody → jimb
Attachment #8349667 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8349667 - Flags: review?(bugs)
Attachment #8349675 - Flags: review?(bugs)
Comment on attachment 8349667 [details] [diff] [review] Improve documentation for nsICycleCollectionListener and nsICycleCollectionHandler. Could you document disableLog = true and wantAfterProcessing too. JS probably wants disableLog = true; // disables the default print-log-to-file wantAfterProcessing = true; // enables graph recording. And yes, we could have two different implementations of nsICycleCollectorHandler, but so far the setup has worked just fine.
Comment on attachment 8349667 [details] [diff] [review] Improve documentation for nsICycleCollectionListener and nsICycleCollectionHandler. Could you document disableLog = true and wantAfterProcessing too. JS probably wants disableLog = true; // disables the default print-log-to-file wantAfterProcessing = true; // enables graph recording. And yes, we could have two different implementations of nsICycleCollectorHandler, but so far the setup has worked just fine.
Attachment #8349675 - Flags: review?(bugs)
(In reply to Olli Pettay [:smaug] from comment #2) > And yes, we could have two different implementations of > nsICycleCollectorHandler, but so far the setup has worked just fine. Hah, didn't I make some remark to you long ago about using the same underlying C++ class to implement all the different flavors of message managers? nsICycleCollectorListener is the same strategy: have one class that implements two different behaviors, under the guidance of some booleans.
Address review comments: document disableLog and wantAfterProcessing, and describe the general flow of using from JS.
Attachment #8349675 - Attachment is obsolete: true
Attachment #8349751 - Flags: review?(bugs)
Message manager is very different kind of beast, and there it just makes the implementation easier to keep everything in one place, and it doesn't affect to the API. Here keeping everything in one places makes the API look a bit bad.
Document allTraces, too.
Attachment #8349751 - Attachment is obsolete: true
Attachment #8349751 - Flags: review?(bugs)
Attachment #8350157 - Flags: review?(bugs)
(In reply to Olli Pettay [:smaug] from comment #6) > Here keeping everything in one places makes the API look a bit bad. I filed bug 952257 with what I imagine you had in mind.
Comment on attachment 8350157 [details] [diff] [review] Improve documentation for nsICycleCollectionListener and nsICycleCollectionHandler. > [scriptable, builtinclass, uuid(7096e77d-7834-4996-b52c-50564144d4be)] > interface nsICycleCollectorListener : nsISupports > { >+ // Return a listener that directs the cycle collector to traverse objects >+ // that it knows won't be collectable. If your purpose is to build a picture >+ // of the heap, and not simply find garbage, then you should use the >+ // listener this returns. "of the heap" isn't quite right, since CC doesn't know about the whole heap. It knows about the possible garbage (and allTraces() disables optimizations which try to remove certainly alive objects from that set of possible garbage objects) >- attribute boolean wantAfterProcessing; > > // This string will appear somewhere in the log's filename. > attribute AString filenameIdentifier; > >+ // If true, record all method calls in memory, to be retrieved later >+ // using |processNext|. Initially false. >+ attribute boolean wantAfterProcessing; Since you move this attribute, you need to also update uuid of this interface.
Attachment #8350157 - Flags: review?(bugs) → review+
Flags: in-testsuite-
Target Milestone: --- → mozilla31
(In reply to Olli Pettay [:smaug] from comment #9) > >+ // Return a listener that directs the cycle collector to traverse objects > >+ // that it knows won't be collectable. If your purpose is to build a picture > >+ // of the heap, and not simply find garbage, then you should use the > >+ // listener this returns. > "of the heap" isn't quite right, since CC doesn't know about the whole heap. > It knows about the possible garbage > (and allTraces() disables optimizations which try to remove certainly alive > objects from that set of possible garbage objects) I missed this comment. Amended in this push: https://hg.mozilla.org/integration/mozilla-inbound/rev/2bbc1d0a9dbb > Since you move this attribute, you need to also update uuid of this > interface. I did update the UUID in my first push.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: