Bug 1361164 - Add infallible IsOnCurrentThread to nsIEventTarget (r=froydnj)

MozReview-Commit-ID: 12bk9hQ7Wnv
This commit is contained in:
Bill McCloskey
2017-05-22 11:26:39 -07:00
parent 8f42af4624
commit 04b1343a42
18 changed files with 192 additions and 35 deletions

View File

@@ -282,6 +282,20 @@ nsThreadPool::DelayedDispatch(already_AddRefed<nsIRunnable>, uint32_t)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP_(bool)
nsThreadPool::IsOnCurrentThreadInfallible()
{
MutexAutoLock lock(mMutex);
nsIThread* thread = NS_GetCurrentThread();
for (uint32_t i = 0; i < static_cast<uint32_t>(mThreads.Count()); ++i) {
if (mThreads[i] == thread) {
return true;
}
}
return false;
}
NS_IMETHODIMP
nsThreadPool::IsOnCurrentThread(bool* aResult)
{