Closed Bug 1186806 Opened 9 years ago Closed 9 years ago

Replace nsBaseHashtable::EnumerateRead() calls in dom/html/ with iterators

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: n.nethercote, Assigned: poiru)

References

Details

Attachments

(4 files, 1 obsolete file)

Because iterators are so much nicer than enumerate functions.

There are five occurrences of EnumerateRead() in this directory.

A note to the assignee: to preserve existing behaviour, you should probably use
nsBaseHashtable::Iterator::UserData() rather than nsBaseHashtable::Iterator::Data(). (The latter should be used when replacing nsBaseHashtable::Enumerate()).
Assignee: nobody → birunthan
Status: NEW → ASSIGNED
Comment on attachment 8638345 [details] [diff] [review]
Replace nsBaseHashtable::EnumerateRead() with iterators in HTMLFormElement

Review of attachment 8638345 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/html/HTMLFormElement.cpp
@@ +141,5 @@
>    NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPastNameLookupTable)
> +  for (auto iter = tmp->mSelectedRadioButtons.Iter(); !iter.Done();
> +       iter.Next()) {
> +    cb.NoteXPCOMChild(ToSupports(iter.UserData()));
> +  }

Can this just use NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSelectedRadioButtons)?
Comment on attachment 8638345 [details] [diff] [review]
Replace nsBaseHashtable::EnumerateRead() with iterators in HTMLFormElement

Review of attachment 8638345 [details] [diff] [review]:
-----------------------------------------------------------------

Perhaps an r- will elicit a response to my question :D
Attachment #8638345 - Flags: review?(khuey) → review-
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #5)
> Comment on attachment 8638345 [details] [diff] [review]
> Replace nsBaseHashtable::EnumerateRead() with iterators in HTMLFormElement
> 
> Review of attachment 8638345 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/html/HTMLFormElement.cpp
> @@ +141,5 @@
> >    NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPastNameLookupTable)
> > +  for (auto iter = tmp->mSelectedRadioButtons.Iter(); !iter.Done();
> > +       iter.Next()) {
> > +    cb.NoteXPCOMChild(ToSupports(iter.UserData()));
> > +  }
> 
> Can this just use NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSelectedRadioButtons)?

I assumed the manual traversal was there for a reason, but seems like it's just from ancient times. Sorry for the delay!
Attachment #8638345 - Attachment is obsolete: true
Attachment #8639445 - Flags: review?(khuey)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: