From 23ba47d9f1402db016876f0716f7d479078f167d Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Mon, 27 Apr 2015 20:52:52 -0400 Subject: [PATCH] Bug 1157908 - Give Gecko thread Looper low priority; r=snorp --- ipc/glue/MessagePump.cpp | 13 ------------- widget/android/nsAppShell.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ipc/glue/MessagePump.cpp b/ipc/glue/MessagePump.cpp index 48d9398c1756..62c0f1cde2df 100644 --- a/ipc/glue/MessagePump.cpp +++ b/ipc/glue/MessagePump.cpp @@ -23,10 +23,6 @@ #include "nsXULAppAPI.h" #include "prthread.h" -#ifdef MOZ_WIDGET_ANDROID -#include "AndroidBridge.h" -#endif - #ifdef MOZ_NUWA_PROCESS #include "ipc/Nuwa.h" #endif @@ -105,15 +101,6 @@ MessagePump::Run(MessagePump::Delegate* aDelegate) // equal priority, we sensitively rely on processing exactly one // Task per DoWorkRunnable XPCOM event. -#ifdef MOZ_WIDGET_ANDROID - // This processes messages in the Android Looper. Note that we only - // get here if the normal Gecko event loop has been awoken above. - // Bug 750713 - if (MOZ_LIKELY(AndroidBridge::HasEnv())) { - did_work |= mozilla::widget::GeckoAppShell::PumpMessageLoop(); - } -#endif - did_work |= aDelegate->DoDelayedWork(&delayed_work_time_); if (did_work && delayed_work_time_.is_null() diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index 42546e3fb484..f6c5ae26d78d 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -243,6 +243,15 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) curEvent = PopNextEvent(); if (!curEvent && mayWait) { + // This processes messages in the Android Looper. Note that we only + // get here if the normal Gecko event loop has been awoken + // (bug 750713). Looper messages effectively have the lowest + // priority because we only process them before we're about to + // wait for new events. + if (widget::GeckoAppShell::PumpMessageLoop()) { + return true; + } + PROFILER_LABEL("nsAppShell", "ProcessNextNativeEvent::Wait", js::ProfileEntry::Category::EVENTS); mozilla::HangMonitor::Suspend();