зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1187149 - Replace nsBaseHashtable::Enumerate() calls in image/ with iterators r=njn
This commit is contained in:
Родитель
ad0dd8414a
Коммит
7246d92be6
|
@ -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])) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче