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

This commit is contained in:
Jim Chen 2015-04-22 11:30:13 -04:00
parent acc6804a18
commit c3c75478fa
2 changed files with 15 additions and 2 deletions

View File

@ -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; }

View File

@ -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());