Bug 1172789 (part 1) - Remove PL_DHashTableEnumerate() uses from nsLoadGroup. r=michal.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 10 Jun 2015 13:07:40 -0700
changeset 248240 dae5852797edaefaced67b3fc5e82c65e5542041
parent 248239 c1db534fad1ec0eaa0b5c6f401c4509b903f94ac
child 248241 757f9f84dcbe6d2017aa24a025984aac23633f89
push id28893
push userkwierso@gmail.com
push dateFri, 12 Jun 2015 00:02:58 +0000
treeherdermozilla-central@8cf9d3e497f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1172789
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1172789 (part 1) - Remove PL_DHashTableEnumerate() uses from nsLoadGroup. r=michal.
netwerk/base/nsLoadGroup.cpp
--- a/netwerk/base/nsLoadGroup.cpp
+++ b/netwerk/base/nsLoadGroup.cpp
@@ -729,34 +729,27 @@ nsLoadGroup::RemoveRequest(nsIRequest *r
         if (mForegroundCount == 0 && mLoadGroup) {
             mLoadGroup->RemoveRequest(this, nullptr, aStatus);
         }
     }
 
     return rv;
 }
 
-// PLDHashTable enumeration callback that appends all items in the
-// hash to an nsCOMArray
-static PLDHashOperator
-AppendRequestsToCOMArray(PLDHashTable *table, PLDHashEntryHdr *hdr,
-                         uint32_t number, void *arg)
-{
-    RequestMapEntry *e = static_cast<RequestMapEntry *>(hdr);
-    static_cast<nsCOMArray<nsIRequest>*>(arg)->AppendObject(e->mKey);
-    return PL_DHASH_NEXT;
-}
-
 NS_IMETHODIMP
 nsLoadGroup::GetRequests(nsISimpleEnumerator * *aRequests)
 {
     nsCOMArray<nsIRequest> requests;
     requests.SetCapacity(mRequests.EntryCount());
 
-    PL_DHashTableEnumerate(&mRequests, AppendRequestsToCOMArray, &requests);
+    PLDHashTable::Iterator iter(&mRequests);
+    while (iter.HasMoreEntries()) {
+      auto e = static_cast<RequestMapEntry*>(iter.NextEntry());
+      requests.AppendObject(e->mKey);
+    }
 
     return NS_NewArrayEnumerator(aRequests, requests);
 }
 
 NS_IMETHODIMP
 nsLoadGroup::SetGroupObserver(nsIRequestObserver* aObserver)
 {
     mObserver = do_GetWeakReference(aObserver);