Bug 1186810 (part 3) - Replace nsBaseHashtable::EnumerateRead() calls in dom/workers/ with iterators. r=nsm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Sun, 25 Oct 2015 21:35:18 -0700
changeset 306364 280c517655d52015dd2f48ab663347c6602b6ffb
parent 306363 d4d97946fc6fb61de06ee0873306990d13ba9c14
child 306365 c2a383729b77e2e542beed3676e8d3b761bc2e8e
push id1040
push userraliiev@mozilla.com
push dateMon, 29 Feb 2016 17:11:22 +0000
treeherdermozilla-release@8c3167321162 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnsm
bugs1186810
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 1186810 (part 3) - Replace nsBaseHashtable::EnumerateRead() calls in dom/workers/ with iterators. r=nsm.
dom/workers/ServiceWorkerManager.cpp
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -3962,52 +3962,40 @@ ServiceWorkerManager::PropagateRemoveAll
     RefPtr<nsIRunnable> runnable = new PropagateRemoveAllRunnable();
     AppendPendingOperation(runnable);
     return;
   }
 
   mActor->SendPropagateRemoveAll();
 }
 
-static PLDHashOperator
-UpdateEachRegistration(const nsACString& aKey,
-                       ServiceWorkerRegistrationInfo* aInfo,
-                       void* aUserArg) {
-  auto This = static_cast<ServiceWorkerManager*>(aUserArg);
-  MOZ_ASSERT(!aInfo->mScope.IsEmpty());
-
-  This->SoftUpdate(aInfo->mPrincipal, aInfo->mScope);
-  return PL_DHASH_NEXT;
-}
-
 void
 ServiceWorkerManager::RemoveAllRegistrations(OriginAttributes* aParams)
 {
   AssertIsOnMainThread();
 
   MOZ_ASSERT(aParams);
 
   mRegistrationInfos.EnumerateRead(UnregisterIfMatchesClearOriginParams,
                                    aParams);
 }
 
-static PLDHashOperator
-UpdateEachRegistrationPerPrincipal(const nsACString& aKey,
-                                   ServiceWorkerManager::RegistrationDataPerPrincipal* aData,
-                                   void* aUserArg) {
-  aData->mInfos.EnumerateRead(UpdateEachRegistration, aUserArg);
-  return PL_DHASH_NEXT;
-}
-
 NS_IMETHODIMP
 ServiceWorkerManager::UpdateAllRegistrations()
 {
   AssertIsOnMainThread();
 
-  mRegistrationInfos.EnumerateRead(UpdateEachRegistrationPerPrincipal, this);
+  for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
+    for (auto it2 = it1.UserData()->mInfos.Iter(); !it2.Done(); it2.Next()) {
+      ServiceWorkerRegistrationInfo* info = it2.UserData();
+      MOZ_ASSERT(!info->mScope.IsEmpty());
+
+      SoftUpdate(info->mPrincipal, info->mScope);
+    }
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ServiceWorkerManager::Observe(nsISupports* aSubject,
                               const char* aTopic,
                               const char16_t* aData)