Bug 1184419 - Part 2: Get rid of HRTFDatabaseLoader::shutdownEnumFunc; r=padenot

This commit is contained in:
Ehsan Akhgari 2015-07-15 22:53:41 -04:00
Родитель 860198febf
Коммит 89d446ad7d
2 изменённых файлов: 3 добавлений и 12 удалений

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

@ -205,14 +205,6 @@ void HRTFDatabaseLoader::waitForLoaderThreadCompletion()
m_databaseLoaderThread = nullptr; m_databaseLoaderThread = nullptr;
} }
PLDHashOperator
HRTFDatabaseLoader::shutdownEnumFunc(LoaderByRateEntry *entry, void* unused)
{
// Ensure the loader thread's reference is removed for leak analysis.
entry->mLoader->waitForLoaderThreadCompletion();
return PLDHashOperator::PL_DHASH_NEXT;
}
void HRTFDatabaseLoader::shutdown() void HRTFDatabaseLoader::shutdown()
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -221,7 +213,9 @@ void HRTFDatabaseLoader::shutdown()
// reference release during enumeration. // reference release during enumeration.
nsTHashtable<LoaderByRateEntry>* loaderMap = s_loaderMap; nsTHashtable<LoaderByRateEntry>* loaderMap = s_loaderMap;
s_loaderMap = nullptr; s_loaderMap = nullptr;
loaderMap->EnumerateEntries(shutdownEnumFunc, nullptr); for (auto iter = loaderMap->Iter(); !iter.Done(); iter.Next()) {
iter.Get()->mLoader->waitForLoaderThreadCompletion();
}
delete loaderMap; delete loaderMap;
} }
} }

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

@ -129,9 +129,6 @@ private:
HRTFDatabaseLoader* mLoader; HRTFDatabaseLoader* mLoader;
}; };
static PLDHashOperator shutdownEnumFunc(LoaderByRateEntry *entry,
void* unused);
// Keeps track of loaders on a per-sample-rate basis. // Keeps track of loaders on a per-sample-rate basis.
static nsTHashtable<LoaderByRateEntry> *s_loaderMap; // singleton static nsTHashtable<LoaderByRateEntry> *s_loaderMap; // singleton