Closed Bug 1187134 Opened 5 years ago Closed 5 years ago

Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators

Categories

(Core :: Networking: Cache, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: njn, Assigned: njn)

References

Details

Attachments

(5 files)

Because iterators are so much nicer than enumerate functions.

There are nine occurrences of Enumerate() in these directories.

A note to the assignee: to preserve existing behaviour, you should probably use
nsBaseHashtable::Iterator::Data() rather than nsBaseHashtable::Iterator::UserData(). (The latter should be used when replacing nsBaseHashtable::EnumerateRead()).
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
Attachment #8695106 - Flags: review?(valentin.gosu) → review+
Comment on attachment 8695105 [details] [diff] [review]
(part 1) - Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators

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

::: netwerk/cache/nsCacheService.cpp
@@ +1231,5 @@
>          NS_IF_RELEASE(mOfflineDevice);
>  
> +        for (auto iter = mCustomOfflineDevices.Iter();
> +             !iter.Done();
> +             iter.Next()) {

Nit: you can probably keep it all on one line, since the original was >80 chars anyway.

@@ +2378,5 @@
>          gService->mOfflineDevice->Shutdown();
>      }
> +    for (auto iter = gService->mCustomOfflineDevices.Iter();
> +         !iter.Done();
> +         iter.Next()) {

Nit: maybe move iter.Next() on the line above.
Attachment #8695105 - Flags: review?(valentin.gosu) → review+
Attachment #8695108 - Flags: review?(valentin.gosu) → review+
Attachment #8695110 - Flags: review?(valentin.gosu) → review+
Attachment #8695109 - Flags: review?(valentin.gosu) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/15537c9d06049dcab39e348b9166d370496cdf37
Bug 1187134 (part 1) - Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators. r=valentin.

https://hg.mozilla.org/integration/mozilla-inbound/rev/392260879d56b00d77e76565f592062f7c5814dd
Bug 1187134 (part 2) - Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators. r=valentin.

https://hg.mozilla.org/integration/mozilla-inbound/rev/5d83cecbfc927b08895ba735de34dc1673e38d98
Bug 1187134 (part 3) - Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators. r=valentin.

https://hg.mozilla.org/integration/mozilla-inbound/rev/3de19e88a9d27f53055a2991473325bc9fe6465c
Bug 1187134 (part 4) - Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators. r=valentin.

https://hg.mozilla.org/integration/mozilla-inbound/rev/11db77ba981c464300c7e09a282c52a9ea38fbd1
Bug 1187134 (part 5) - Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators. r=valentin.
You need to log in before you can comment on or make changes to this bug.