Backout change 3285d8bef13f (bug 1113429) due to backout of bug 970307.
☠☠ backed out by 280458ef7345 ☠ ☠
authorCervantes Yu <cyu@mozilla.com>
Tue, 19 May 2015 14:31:22 +0800
changeset 244427 1b09d2b41795102dbe40e0a7330e72f6b5a6ceb0
parent 244426 daa19810f688c3b01b765ce41355d13d8c376dc7
child 244428 4d2839eea957ebeb1599260a05a6d74854a53fb0
push id15654
push usercyu@mozilla.com
push dateTue, 19 May 2015 06:37:15 +0000
treeherderb2g-inbound@4d2839eea957 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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();
   }