Bug 1187151 (part 5) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 24 Nov 2015 16:55:01 -0800
changeset 274523 c336a29d0318f730be6cd814586371d116e52241
parent 274522 f2c4d5ae4fd0ffb9bb90c4cb65e480a0a728967d
child 274524 f9045a2712a76bc2d048fcbb462e6395885b0fb1
push id68617
push usernnethercote@mozilla.com
push dateSun, 29 Nov 2015 22:22:17 +0000
treeherdermozilla-inbound@c336a29d0318 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1187151
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 1187151 (part 5) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey.
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -15890,43 +15890,34 @@ FileManager::Init(nsIFile* aDirectory,
   }
 
   return NS_OK;
 }
 
 nsresult
 FileManager::Invalidate()
 {
-  class MOZ_STACK_CLASS Helper final
-  {
-  public:
-    static PLDHashOperator
-    ClearDBRefs(const uint64_t& aKey, FileInfo*& aValue, void* aUserArg)
-    {
-      MOZ_ASSERT(aValue);
-
-      if (aValue->LockedClearDBRefs()) {
-        return PL_DHASH_NEXT;
-      }
-
-      return PL_DHASH_REMOVE;
-    }
-  };
-
   if (IndexedDatabaseManager::IsClosed()) {
     MOZ_ASSERT(false, "Shouldn't be called after shutdown!");
     return NS_ERROR_UNEXPECTED;
   }
 
   MutexAutoLock lock(IndexedDatabaseManager::FileMutex());
 
   MOZ_ASSERT(!mInvalidated);
   mInvalidated = true;
 
-  mFileInfos.Enumerate(Helper::ClearDBRefs, nullptr);
+  for (auto iter = mFileInfos.Iter(); !iter.Done(); iter.Next()) {
+    FileInfo* info = iter.Data();
+    MOZ_ASSERT(info);
+
+    if (!info->LockedClearDBRefs()) {
+      iter.Remove();
+    }
+  }
 
   return NS_OK;
 }
 
 already_AddRefed<nsIFile>
 FileManager::GetDirectory()
 {
   return GetFileForPath(mDirectoryPath);