Bug 1186810 (part 3) - Replace nsBaseHashtable::EnumerateRead() calls in dom/workers/ with iterators. r=nsm.

--HG--
extra : rebase_source : b30e110d8fe10dcbfef51278c1d2178acd88d004
This commit is contained in:
Nicholas Nethercote 2015-10-25 21:35:18 -07:00
Родитель ef9fab3e31
Коммит 5b93c35c8a
1 изменённых файлов: 8 добавлений и 20 удалений

Просмотреть файл

@ -3967,17 +3967,6 @@ ServiceWorkerManager::PropagateRemoveAll()
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)
{
@ -3989,20 +3978,19 @@ ServiceWorkerManager::RemoveAllRegistrations(OriginAttributes* aParams)
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;
}