mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187116 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in dom/indexedDB/ with iterators. r=khuey.
This commit is contained in:
parent
6dda3cbb55
commit
c086d42e44
@ -398,7 +398,7 @@ public:
|
||||
MOZ_ASSERT(aId);
|
||||
|
||||
SelfType closure(aId, aName);
|
||||
aEnumerable.EnumerateRead(Enumerate, &closure);
|
||||
MatchHelper(aEnumerable, &closure);
|
||||
|
||||
return closure.mMetadata;
|
||||
}
|
||||
@ -411,7 +411,7 @@ public:
|
||||
MOZ_ASSERT(aId);
|
||||
|
||||
SelfType closure(aId);
|
||||
aEnumerable.EnumerateRead(Enumerate, &closure);
|
||||
MatchHelper(aEnumerable, &closure);
|
||||
|
||||
return closure.mMetadata;
|
||||
}
|
||||
@ -436,25 +436,29 @@ private:
|
||||
MOZ_ASSERT(aId);
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
Enumerate(const uint64_t& aKey, MetadataType* aValue, void* aClosure)
|
||||
template <class Enumerable>
|
||||
static void
|
||||
MatchHelper(const Enumerable& aEnumerable, SelfType* aClosure)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aKey);
|
||||
MOZ_ASSERT(aValue);
|
||||
MOZ_ASSERT(aClosure);
|
||||
|
||||
auto* closure = static_cast<SelfType*>(aClosure);
|
||||
for (auto iter = aEnumerable.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
#ifdef DEBUG
|
||||
const uint64_t key = iter.Key();
|
||||
#endif
|
||||
MetadataType* value = iter.UserData();
|
||||
MOZ_ASSERT(key != 0);
|
||||
MOZ_ASSERT(value);
|
||||
|
||||
if (!aValue->mDeleted &&
|
||||
(closure->mId == aValue->mCommonMetadata.id() ||
|
||||
(closure->mCheckName &&
|
||||
closure->mName == aValue->mCommonMetadata.name()))) {
|
||||
closure->mMetadata = aValue;
|
||||
return PL_DHASH_STOP;
|
||||
if (!value->mDeleted &&
|
||||
(aClosure->mId == value->mCommonMetadata.id() ||
|
||||
(aClosure->mCheckName &&
|
||||
aClosure->mName == value->mCommonMetadata.name()))) {
|
||||
aClosure->mMetadata = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user