Bug 1182966 - Part 1: Use nsTHashTable::Iterator in DomainSet::CloneSet. r=mrbkap
authorAndrew McCreight <continuation@gmail.com>
Tue, 14 Jul 2015 07:58:00 -0400
changeset 284946 c25cbd21c1689948575f21a68f8600433796ba7c
parent 284945 bd3b1119982a606aeae33e08c4930c9adf902ffd
child 284947 7de43f04cd0a68453f047897ae3255af85b53823
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1182966
milestone42.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 1182966 - Part 1: Use nsTHashTable::Iterator in DomainSet::CloneSet. r=mrbkap
caps/DomainPolicy.cpp
--- a/caps/DomainPolicy.cpp
+++ b/caps/DomainPolicy.cpp
@@ -241,29 +241,22 @@ DomainSet::ContainsSuperDomain(nsIURI* a
 
 NS_IMETHODIMP
 DomainSet::GetType(uint32_t* aType)
 {
     *aType = mType;
     return NS_OK;
 }
 
-static
-PLDHashOperator
-DomainEnumerator(nsURIHashKey* aEntry, void* aUserArg)
-{
-    InfallibleTArray<URIParams>* uris = static_cast<InfallibleTArray<URIParams>*>(aUserArg);
-    nsIURI* key = aEntry->GetKey();
-
-    URIParams uri;
-    SerializeURI(key, uri);
-
-    uris->AppendElement(uri);
-    return PL_DHASH_NEXT;
-}
-
 void
 DomainSet::CloneSet(InfallibleTArray<URIParams>* aDomains)
 {
-    mHashTable.EnumerateEntries(DomainEnumerator, aDomains);
+    for (auto iter = mHashTable.Iter(); !iter.Done(); iter.Next()) {
+        nsIURI* key = iter.Get()->GetKey();
+
+        URIParams uri;
+        SerializeURI(key, uri);
+
+        aDomains->AppendElement(uri);
+    }
 }
 
 } /* namespace mozilla */