Bug 1225731 - Early bailout from TaskQueue::DispatchLocked(). r=froydnj

MozReview-Commit-ID: Xhj87WeRID

--HG--
extra : rebase_source : 0de51688f506a1e302129e69a6353a9d48e6bfed
This commit is contained in:
JW Wang 2016-11-10 15:45:45 +08:00
parent fa5d7da911
commit edcebe85dc

View File

@ -95,16 +95,17 @@ TaskQueue::DispatchLocked(nsCOMPtr<nsIRunnable>& aRunnable,
DispatchFailureHandling aFailureHandling,
DispatchReason aReason)
{
mQueueMonitor.AssertCurrentThreadOwns();
if (mIsShutdown) {
return NS_ERROR_FAILURE;
}
AbstractThread* currentThread;
if (aReason != TailDispatch && (currentThread = GetCurrent()) && RequiresTailDispatch(currentThread)) {
currentThread->TailDispatcher().AddTask(this, aRunnable.forget(), aFailureHandling);
return NS_OK;
}
mQueueMonitor.AssertCurrentThreadOwns();
if (mIsShutdown) {
return NS_ERROR_FAILURE;
}
mTasks.push(aRunnable.forget());
if (mIsRunning) {
return NS_OK;