Bug 1186811 (part 4) - Replace nsBaseHashtable::EnumerateRead() calls in dom/storage/ with iterators. r=baku.
authorNicholas Nethercote <nnethercote@mozilla.com>
Sun, 01 Nov 2015 19:37:45 -0800
changeset 273427 78ffe07a4a498c8284751e4bc04469c2a8daa648
parent 273426 0c6c2f077d829bec4921ed4c47df055dd8608470
child 273428 1946937e23afd1e6783d2f83737b074fa680c9a8
push id68273
push usernnethercote@mozilla.com
push dateFri, 20 Nov 2015 02:17:55 +0000
treeherdermozilla-inbound@78ffe07a4a49 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1186811
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 1186811 (part 4) - Replace nsBaseHashtable::EnumerateRead() calls in dom/storage/ with iterators. r=baku.
dom/storage/DOMStorageCache.cpp
--- a/dom/storage/DOMStorageCache.cpp
+++ b/dom/storage/DOMStorageCache.cpp
@@ -373,41 +373,30 @@ DOMStorageCache::GetKey(const DOMStorage
       break;
     }
     aIndex--;
   }
 
   return NS_OK;
 }
 
-namespace {
-
-static PLDHashOperator
-KeysArrayBuilder(const nsAString& aKey, const nsString aValue, void* aArg)
-{
-  nsTArray<nsString>* keys = static_cast<nsTArray<nsString>* >(aArg);
-
-  keys->AppendElement(aKey);
-  return PL_DHASH_NEXT;
-}
-
-} // namespace
-
 void
 DOMStorageCache::GetKeys(const DOMStorage* aStorage, nsTArray<nsString>& aKeys)
 {
   if (Persist(aStorage)) {
     WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETALLKEYS_BLOCKING_MS);
   }
 
   if (NS_FAILED(mLoadResult)) {
     return;
   }
 
-  DataSet(aStorage).mKeys.EnumerateRead(KeysArrayBuilder, &aKeys);
+  for (auto iter = DataSet(aStorage).mKeys.Iter(); !iter.Done(); iter.Next()) {
+    aKeys.AppendElement(iter.Key());
+  }
 }
 
 nsresult
 DOMStorageCache::GetItem(const DOMStorage* aStorage, const nsAString& aKey,
                          nsAString& aRetval)
 {
   if (Persist(aStorage)) {
     WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETVALUE_BLOCKING_MS);