Bug 1186787 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 17 Nov 2015 17:58:36 -0800
changeset 273036 4e0a66f7b693d055ef52c5b17d55cb117d6296b0
parent 273035 401949c4008ed49464a7fd13781bee79b432a0b4
child 273037 66d66e4a2b320878f946736eb8e9324a070ca96f
push id68143
push usernnethercote@mozilla.com
push dateWed, 18 Nov 2015 01:59:05 +0000
treeherdermozilla-inbound@4e0a66f7b693 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1186787
milestone45.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 1186787 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj.
chrome/nsChromeRegistryChrome.cpp
--- a/chrome/nsChromeRegistryChrome.cpp
+++ b/chrome/nsChromeRegistryChrome.cpp
@@ -391,36 +391,16 @@ SerializeURI(nsIURI* aURI,
 {
   if (!aURI)
     return;
 
   aURI->GetSpec(aSerializedURI.spec);
   aURI->GetOriginCharset(aSerializedURI.charset);
 }
 
-static PLDHashOperator
-EnumerateOverride(nsIURI* aURIKey,
-                  nsIURI* aURI,
-                  void* aArg)
-{
-  nsTArray<OverrideMapping>* overrides =
-      static_cast<nsTArray<OverrideMapping>*>(aArg);
-
-  SerializedURI chromeURI, overrideURI;
-
-  SerializeURI(aURIKey, chromeURI);
-  SerializeURI(aURI, overrideURI);
-
-  OverrideMapping override = {
-    chromeURI, overrideURI
-  };
-  overrides->AppendElement(override);
-  return (PLDHashOperator)PL_DHASH_NEXT;
-}
-
 void
 nsChromeRegistryChrome::SendRegisteredChrome(
     mozilla::dom::PContentParent* aParent)
 {
   InfallibleTArray<ChromePackage> packages;
   InfallibleTArray<SubstitutionMapping> resources;
   InfallibleTArray<OverrideMapping> overrides;
 
@@ -442,17 +422,25 @@ nsChromeRegistryChrome::SendRegisteredCh
     nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
     NS_ENSURE_SUCCESS_VOID(rv);
 
     nsCOMPtr<nsIResProtocolHandler> irph (do_QueryInterface(ph));
     nsResProtocolHandler* rph = static_cast<nsResProtocolHandler*>(irph.get());
     rph->CollectSubstitutions(resources);
   }
 
-  mOverrideTable.EnumerateRead(&EnumerateOverride, &overrides);
+  for (auto iter = mOverrideTable.Iter(); !iter.Done(); iter.Next()) {
+    SerializedURI chromeURI, overrideURI;
+
+    SerializeURI(iter.Key(), chromeURI);
+    SerializeURI(iter.UserData(), overrideURI);
+
+    OverrideMapping override = { chromeURI, overrideURI };
+    overrides.AppendElement(override);
+  }
 
   if (aParent) {
     bool success = aParent->SendRegisterChrome(packages, resources, overrides,
                                                mSelectedLocale, false);
     NS_ENSURE_TRUE_VOID(success);
   } else {
     nsTArray<ContentParent*> parents;
     ContentParent::GetAll(parents);