Bug 1181445 (part 12) - Use nsBaseHashTable::Iterator in xpcom/threads/. r=froydnj.

This commit is contained in:
Nicholas Nethercote 2015-07-09 16:54:59 -07:00
parent 8b5bd66a0f
commit 4d241772da

View File

@ -48,14 +48,6 @@ ReleaseObject(void* aData)
static_cast<nsISupports*>(aData)->Release();
}
static PLDHashOperator
AppendAndRemoveThread(PRThread* aKey, nsRefPtr<nsThread>& aThread, void* aArg)
{
nsThreadArray* threads = static_cast<nsThreadArray*>(aArg);
threads->AppendElement(aThread);
return PL_DHASH_REMOVE;
}
// statically allocated instance
NS_IMETHODIMP_(MozExternalRefCountType)
nsThreadManager::AddRef()
@ -139,7 +131,11 @@ nsThreadManager::Shutdown()
nsThreadArray threads;
{
OffTheBooksMutexAutoLock lock(mLock);
mThreadsByPRThread.Enumerate(AppendAndRemoveThread, &threads);
for (auto iter = mThreadsByPRThread.Iter(); !iter.Done(); iter.Next()) {
nsRefPtr<nsThread>& thread = iter.GetData();
threads.AppendElement(thread);
iter.Remove();
}
}
// It's tempting to walk the list of threads here and tell them each to stop