Backout change 3285d8bef13f (bug 1113429) due to backout of bug 970307.
authorCervantes Yu <cyu@mozilla.com>
Tue, 19 May 2015 11:26:26 +0800
changeset 266163 1ae2ce91dccab340fa0918f980274c2bfda5be6e
parent 266162 3385678d8fd580f049a59fe9a84b295800ccae5d
child 266164 c7c340d2774cb9295fc15e1c459b4f2de8c11d10
push id2231
push usermichael.l.comella@gmail.com
push dateFri, 22 May 2015 20:04:59 +0000
bugs1113429, 970307
milestone41.0a1
backs out3285d8bef13f9baa5883270b4391bcc63a6fa5fb
Backout change 3285d8bef13f (bug 1113429) due to backout of bug 970307.
dom/workers/WorkerPrivate.cpp
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -80,16 +80,17 @@
 #include "nsJSEnvironment.h"
 #include "nsJSUtils.h"
 #include "nsNetUtil.h"
 #include "nsPrintfCString.h"
 #include "nsProxyRelease.h"
 #include "nsQueryObject.h"
 #include "nsSandboxFlags.h"
 #include "prthread.h"
+#include "nsThread.h"
 #include "xpcpublic.h"
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 #ifdef DEBUG
 #include "nsThreadManager.h"
@@ -5101,16 +5102,27 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
   for (;;) {
     Status currentStatus;
     bool debuggerRunnablesPending = false;
     bool normalRunnablesPending = false;
 
     {
       MutexAutoLock lock(mMutex);
 
+#ifdef MOZ_NUWA_PROCESS
+      {
+        nsThread *thr = static_cast<nsThread*>(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))) {
         WaitForWorkerEvents();
       }
 
       ProcessAllControlRunnablesLocked();
 
@@ -5637,25 +5649,16 @@ WorkerPrivate::WaitForWorkerEvents(PRInt
 
   // Let the main thread know that the worker is blocked and that memory
   // reporting may proceed.
   mBlockedForMemoryReporter = true;
 
   // 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);
 
   // We've gotten some kind of signal but we can't continue until the memory
   // reporter has finished. Wait again.
   while (mMemoryReporterRunning) {
     mMemoryReportCondVar.Wait();
   }