Bug 1156943 - Make proper HangMonitor calls in Android nsAppShell; r=snorp

--HG--
extra : rebase_source : 9940cd2807f32c057a3e6e67d6c90712e773a784
This commit is contained in:
Jim Chen 2015-04-22 11:30:13 -04:00
Родитель d86fde1bcd
Коммит b2a2f73211
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -505,6 +505,16 @@ public:
return event;
}
bool IsInputEvent() const {
return mType == AndroidGeckoEvent::MOTION_EVENT ||
mType == AndroidGeckoEvent::NATIVE_GESTURE_EVENT ||
mType == AndroidGeckoEvent::LONG_PRESS ||
mType == AndroidGeckoEvent::KEY_EVENT ||
mType == AndroidGeckoEvent::IME_EVENT ||
mType == AndroidGeckoEvent::IME_KEY_EVENT ||
mType == AndroidGeckoEvent::APZ_INPUT_EVENT;
}
int Action() { return mAction; }
int Type() { return mType; }
bool AckNeeded() { return mAckNeeded; }

Просмотреть файл

@ -26,7 +26,7 @@
#include "nsINetworkLinkService.h"
#include "nsCategoryManagerUtils.h"
#include "mozilla/BackgroundHangMonitor.h"
#include "mozilla/HangMonitor.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
@ -244,6 +244,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
if (!curEvent && mayWait) {
PROFILER_LABEL("nsAppShell", "ProcessNextNativeEvent::Wait",
js::ProfileEntry::Category::EVENTS);
mozilla::HangMonitor::Suspend();
// hmm, should we really hardcode this 10s?
#if defined(DEBUG_ANDROID_EVENTS)
@ -264,7 +265,9 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
if (!curEvent)
return false;
mozilla::BackgroundHangMonitor().NotifyActivity();
mozilla::HangMonitor::NotifyActivity(curEvent->IsInputEvent() ?
mozilla::HangMonitor::kUIActivity :
mozilla::HangMonitor::kGeneralActivity);
EVLOG("nsAppShell: event %p %d", (void*)curEvent.get(), curEvent->Type());