mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187149 - Replace nsBaseHashtable::Enumerate() calls in image/ with iterators r=njn
This commit is contained in:
parent
7215329de9
commit
716ba038a6
@ -1903,19 +1903,6 @@ imgLoader::RemoveFromCache(imgCacheEntry* entry)
|
||||
return false;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
EnumEvictEntries(const ImageCacheKey&,
|
||||
RefPtr<imgCacheEntry>& aData,
|
||||
void* data)
|
||||
{
|
||||
nsTArray<RefPtr<imgCacheEntry> >* entries =
|
||||
reinterpret_cast<nsTArray<RefPtr<imgCacheEntry> > *>(data);
|
||||
|
||||
entries->AppendElement(aData);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
imgLoader::EvictEntries(imgCacheTable& aCacheToClear)
|
||||
{
|
||||
@ -1924,7 +1911,10 @@ imgLoader::EvictEntries(imgCacheTable& aCacheToClear)
|
||||
// We have to make a temporary, since RemoveFromCache removes the element
|
||||
// from the queue, invalidating iterators.
|
||||
nsTArray<RefPtr<imgCacheEntry> > entries;
|
||||
aCacheToClear.Enumerate(EnumEvictEntries, &entries);
|
||||
for (auto iter = aCacheToClear.Iter(); !iter.Done(); iter.Next()) {
|
||||
RefPtr<imgCacheEntry>& data = iter.Data();
|
||||
entries.AppendElement(data);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < entries.Length(); ++i) {
|
||||
if (!RemoveFromCache(entries[i])) {
|
||||
|
Loading…
Reference in New Issue
Block a user