Bug 836872 - Use TimeStamp::NowLoRes() in nsAppShell, r=roc

This commit is contained in:
Honza Bambas 2013-02-11 22:56:59 +01:00
parent c4a63c79fa
commit ae8873afd8
2 changed files with 10 additions and 6 deletions

View File

@ -110,7 +110,7 @@ nsAppShell::Init()
LSPAnnotate();
#endif
mLastNativeEventScheduled = TimeStamp::Now();
mLastNativeEventScheduled = TimeStamp::NowLoRes();
if (!sMsgId)
sMsgId = RegisterWindowMessageW(kAppShellEventId);
@ -205,7 +205,7 @@ nsAppShell::ScheduleNativeEventCallback()
NS_ADDREF_THIS(); // will be released when the event is processed
// Time stamp this event so we can detect cases where the event gets
// dropping in sub classes / modal loops we do not control.
mLastNativeEventScheduled = TimeStamp::Now();
mLastNativeEventScheduled = TimeStamp::NowLoRes();
::PostMessage(mEventWnd, sMsgId, 0, reinterpret_cast<LPARAM>(this));
}
@ -251,8 +251,11 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
// Check for starved native callbacks. If we haven't processed one
// of these events in NATIVE_EVENT_STARVATION_LIMIT, fire one off.
if ((TimeStamp::Now() - mLastNativeEventScheduled) >
NATIVE_EVENT_STARVATION_LIMIT) {
static const mozilla::TimeDuration nativeEventStarvationLimit =
mozilla::TimeDuration::FromSeconds(NATIVE_EVENT_STARVATION_LIMIT);
if ((TimeStamp::NowLoRes() - mLastNativeEventScheduled) >
nativeEventStarvationLimit) {
ScheduleNativeEventCallback();
}

View File

@ -10,8 +10,9 @@
#include <windows.h>
#include "mozilla/TimeStamp.h"
// The maximum time we allow before forcing a native event callback
#define NATIVE_EVENT_STARVATION_LIMIT mozilla::TimeDuration::FromSeconds(1)
// The maximum time we allow before forcing a native event callback.
// In seconds.
#define NATIVE_EVENT_STARVATION_LIMIT 1
/**
* Native Win32 Application shell wrapper