Bug 968016 - Implement nsThreadPool::IsOnCurrentThread() to return true when the current thread is in the thread pool. r=bsmedberg

This is so that we can assert that media decode threads are in the decode thread pool.
This commit is contained in:
Chris Pearce 2014-02-18 11:53:52 +13:00
parent 898150675c
commit 9bc6df1d23

View File

@ -251,10 +251,14 @@ nsThreadPool::Dispatch(nsIRunnable *event, uint32_t flags)
NS_IMETHODIMP
nsThreadPool::IsOnCurrentThread(bool *result)
{
// No one should be calling this method. If this assertion gets hit, then we
// need to think carefully about what this method should be returning.
NS_NOTREACHED("implement me");
ReentrantMonitorAutoEnter mon(mEvents.GetReentrantMonitor());
nsIThread* thread = NS_GetCurrentThread();
for (uint32_t i = 0; i < mThreads.Count(); ++i) {
if (mThreads[i] == thread) {
*result = true;
return NS_OK;
}
}
*result = false;
return NS_OK;
}