diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp index 147012c37736..7da1ec7d1449 100644 --- a/widget/windows/nsAppShell.cpp +++ b/widget/windows/nsAppShell.cpp @@ -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(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(); } diff --git a/widget/windows/nsAppShell.h b/widget/windows/nsAppShell.h index a91b1b784031..b90b3912c1d7 100644 --- a/widget/windows/nsAppShell.h +++ b/widget/windows/nsAppShell.h @@ -10,8 +10,9 @@ #include #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