Bug 1186811 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in dom/storage/ with iterators. r=baku.

--HG--
extra : rebase_source : cb471697e38ff330956309e9280aa702adf17714
This commit is contained in:
Nicholas Nethercote 2015-11-01 19:24:46 -08:00
Родитель aa9f82bd36
Коммит 1694f7969f
1 изменённых файлов: 6 добавлений и 15 удалений

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

@ -151,19 +151,6 @@ DOMStorageCache::Persist(const DOMStorage* aStorage) const
!aStorage->IsPrivate();
}
namespace {
PLDHashOperator
CloneSetData(const nsAString& aKey, const nsString aValue, void* aArg)
{
DOMStorageCache::Data* target = static_cast<DOMStorageCache::Data*>(aArg);
target->mKeys.Put(aKey, aValue);
return PL_DHASH_NEXT;
}
} // namespace
DOMStorageCache::Data&
DOMStorageCache::DataSet(const DOMStorage* aStorage)
{
@ -178,7 +165,9 @@ DOMStorageCache::DataSet(const DOMStorage* aStorage)
Data& defaultSet = mData[kDefaultSet];
Data& sessionSet = mData[kSessionSet];
defaultSet.mKeys.EnumerateRead(CloneSetData, &sessionSet);
for (auto iter = defaultSet.mKeys.Iter(); !iter.Done(); iter.Next()) {
sessionSet.mKeys.Put(iter.Key(), iter.UserData());
}
mSessionOnlyDataSetActive = true;
@ -598,7 +587,9 @@ DOMStorageCache::CloneFrom(const DOMStorageCache* aThat)
mSessionOnlyDataSetActive = aThat->mSessionOnlyDataSetActive;
for (uint32_t i = 0; i < kDataSetCount; ++i) {
aThat->mData[i].mKeys.EnumerateRead(CloneSetData, &mData[i]);
for (auto it = aThat->mData[i].mKeys.ConstIter(); !it.Done(); it.Next()) {
mData[i].mKeys.Put(it.Key(), it.UserData());
}
ProcessUsageDelta(i, aThat->mData[i].mOriginQuotaUsage);
}
}