Bug 1187151 (part 5) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey.

This commit is contained in:
Nicholas Nethercote 2015-11-24 16:55:01 -08:00
parent 3ec085d50c
commit a6ee9f76d6

View File

@ -15895,22 +15895,6 @@ FileManager::Init(nsIFile* aDirectory,
nsresult
FileManager::Invalidate()
{
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
ClearDBRefs(const uint64_t& aKey, FileInfo*& aValue, void* aUserArg)
{
MOZ_ASSERT(aValue);
if (aValue->LockedClearDBRefs()) {
return PL_DHASH_NEXT;
}
return PL_DHASH_REMOVE;
}
};
if (IndexedDatabaseManager::IsClosed()) {
MOZ_ASSERT(false, "Shouldn't be called after shutdown!");
return NS_ERROR_UNEXPECTED;
@ -15921,7 +15905,14 @@ FileManager::Invalidate()
MOZ_ASSERT(!mInvalidated);
mInvalidated = true;
mFileInfos.Enumerate(Helper::ClearDBRefs, nullptr);
for (auto iter = mFileInfos.Iter(); !iter.Done(); iter.Next()) {
FileInfo* info = iter.Data();
MOZ_ASSERT(info);
if (!info->LockedClearDBRefs()) {
iter.Remove();
}
}
return NS_OK;
}