Closed
Bug 855804
Opened 12 years ago
Closed 12 years ago
Add cycle collector traversal helpers for nsRefPtrHashtable
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: ted, Assigned: khuey)
References
Details
Attachments
(1 file, 1 obsolete file)
7.29 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
My gamepad implementation has a nsRefPtrHashTable of nsDOMGamepads on nsGlobalWindow. The WebIDL patches in bug 851542 introduce a cycle because nsDOMGamepad gets a reference to its parent. Implementing cycle collection is a pain because we don't have traversal helpers for nsRefPtrHashTable.
khuey has most of a patch for this, it just needs to be cleaned up a little.
Reporter | ||
Comment 1•12 years ago
|
||
This is Kyle's patch after I fixed a few things and he told me how to fix some other things.
Reporter | ||
Updated•12 years ago
|
Attachment #730839 -
Flags: review?(bzbarsky)
![]() |
||
Comment 2•12 years ago
|
||
Comment on attachment 730839 [details] [diff] [review]
Add cycle collector traversal helpers for nsRefPtrHashtable
>+struct nsRefPtrHashtableCCTraversalData
MOZ_STACK_CLASS
>+ nsRefPtrHashtableCCTraversalData(nsCycleCollectionTraversalCallback& aCallback,
>+ const char* aName,
>+ uint32_t aFlags) : mCallback(aCallback),
Please fix the indentation and move the mCallback() bit to the next line
>+ mFlags(aFlags) {}
{} to next line.
But also, mFlags seems to be unused. Just kill it? Or pass it to CycleCollectionNoteChild? Presumably the latter....
>+ aField.EnumerateRead(ImplCycleCollectionTraverse_EnumFunc<typename K::KeyType,T*>, reinterpret_cast<void*>(&userData));
Newline after comma between the two EnumerateRead arguments, and you shouldn't need the reinterpret_cast.
r=me with the above nits.
Attachment #730839 -
Flags: review?(bzbarsky) → review+
Comment 3•12 years ago
|
||
You should be able to just aField.Clear() in Unlink(), instead of this enumeration rigamarole.
Assignee | ||
Comment 4•12 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #3)
> You should be able to just aField.Clear() in Unlink(), instead of this
> enumeration rigamarole.
Indeed.
Assignee | ||
Comment 5•12 years ago
|
||
Now supporting nsRefPtrHashtable and nsInterfaceHashtable, with some converted uses.
Attachment #730839 -
Attachment is obsolete: true
Attachment #732509 -
Flags: review?(bzbarsky)
![]() |
||
Comment 6•12 years ago
|
||
Comment on attachment 732509 [details] [diff] [review]
Patch
r=me
Attachment #732509 -
Flags: review?(bzbarsky) → review+
Comment 7•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ef873e1fb7e9
https://hg.mozilla.org/mozilla-central/rev/c4cec4613cac
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in
before you can comment on or make changes to this bug.
Description
•