Bug 1113429 - Optimize NUWA idle notifications on workers, r=froydnj.

This commit is contained in:
Ben Turner 2014-12-19 08:27:03 -08:00
parent 5480fb5918
commit 6567898382

View File

@ -73,7 +73,6 @@
#include "nsProxyRelease.h"
#include "nsSandboxFlags.h"
#include "prthread.h"
#include "nsThread.h"
#include "xpcpublic.h"
#ifdef ANDROID
@ -4333,17 +4332,6 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
{
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() &&
!(normalRunnablesPending = NS_HasPendingEvents(mThread))) {
WaitForWorkerEvents();
@ -4853,6 +4841,15 @@ 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);