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

--HG--
extra : rebase_source : 76f747c7ac22df28cc78a8afea0e25f3b4b2aa07
This commit is contained in:
Nicholas Nethercote 2015-07-09 16:54:59 -07:00
parent d367971294
commit f32a629f7d

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