From 836d8fd8d014bd689ed0e0d54b74a7de5ee7c450 Mon Sep 17 00:00:00 2001 From: Cervantes Yu Date: Tue, 19 May 2015 11:26:26 +0800 Subject: [PATCH] Backout change 3285d8bef13f (bug 1113429) due to backout of bug 970307. --- dom/workers/WorkerPrivate.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index a72f04bbb443..36ff3ec7c1de 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -85,6 +85,7 @@ #include "nsQueryObject.h" #include "nsSandboxFlags.h" #include "prthread.h" +#include "nsThread.h" #include "xpcpublic.h" #ifdef ANDROID @@ -5106,6 +5107,17 @@ WorkerPrivate::DoRunLoop(JSContext* aCx) { MutexAutoLock lock(mMutex); +#ifdef MOZ_NUWA_PROCESS + { + nsThread *thr = static_cast(NS_GetCurrentThread()); + ReentrantMonitorAutoEnter mon(thr->ThreadStatusMonitor()); + if (mControlQueue.IsEmpty() && + !(normalRunnablesPending = NS_HasPendingEvents(mThread))) { + thr->SetIdle(); + } + } +#endif // MOZ_NUWA_PROCESS + while (mControlQueue.IsEmpty() && !(debuggerRunnablesPending = !mDebuggerQueue.IsEmpty()) && !(normalRunnablesPending = NS_HasPendingEvents(mThread))) { @@ -5642,15 +5654,6 @@ WorkerPrivate::WaitForWorkerEvents(PRIntervalTime aInterval) // The main thread may be waiting so we must notify. mMemoryReportCondVar.Notify(); -#ifdef MOZ_NUWA_PROCESS - { - MOZ_ASSERT(mThread); - - ReentrantMonitorAutoEnter mon(mThread->ThreadStatusMonitor()); - mThread->SetIdle(); - } -#endif // MOZ_NUWA_PROCESS - // Now wait for an actual worker event. mCondVar.Wait(aInterval);