mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 836872 - Use TimeStamp::NowLoRes() in nsAppShell, r=roc
This commit is contained in:
parent
3e6e5d6690
commit
b46bfabe74
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user