diff options
author | Steve Block <steveblock@google.com> | 2009-10-08 17:19:54 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-10-20 00:41:58 +0100 |
commit | 231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch) | |
tree | a6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebCore/platform/win/SharedTimerWin.cpp | |
parent | e196732677050bd463301566a68a643b6d14b907 (diff) | |
download | external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2 |
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebCore/platform/win/SharedTimerWin.cpp')
-rw-r--r-- | WebCore/platform/win/SharedTimerWin.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/WebCore/platform/win/SharedTimerWin.cpp b/WebCore/platform/win/SharedTimerWin.cpp index da27a53..bc634f9 100644 --- a/WebCore/platform/win/SharedTimerWin.cpp +++ b/WebCore/platform/win/SharedTimerWin.cpp @@ -27,6 +27,7 @@ #include "SharedTimer.h" #include "Page.h" +#include "Settings.h" #include "Widget.h" #include <wtf/Assertions.h> #include <wtf/CurrentTime.h> @@ -160,35 +161,38 @@ void setSharedTimerFireTime(double fireTime) intervalInMS = (unsigned)interval; } - if (interval < highResolutionThresholdMsec) { - if (!highResTimerActive) { - highResTimerActive = true; - timeBeginPeriod(timerResolution); - } - SetTimer(timerWindowHandle, endHighResTimerID, stopHighResTimerInMsec, 0); - } - initializeOffScreenTimerWindow(); bool timerSet = false; - DWORD queueStatus = LOWORD(GetQueueStatus(QS_PAINT | QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT)); - - // Win32 has a tri-level queue with application messages > user input > WM_PAINT/WM_TIMER. - - // If the queue doesn't contains input events, we use a higher priorty timer event posting mechanism. - if (!(queueStatus & (QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT))) { - if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage && !(queueStatus & QS_PAINT)) { - // Call PostMessage immediately if the timer is already expired, unless a paint is pending. - // (we prioritize paints over timers) - if (InterlockedIncrement(&pendingTimers) == 1) - PostMessage(timerWindowHandle, timerFiredMessage, 0, 0); - timerSet = true; - } else { - // Otherwise, delay the PostMessage via a CreateTimerQueueTimer - if (!timerQueue) - timerQueue = CreateTimerQueue(); - if (timer) - DeleteTimerQueueTimer(timerQueue, timer, 0); - timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE); + + if (Settings::shouldUseHighResolutionTimers()) { + if (interval < highResolutionThresholdMsec) { + if (!highResTimerActive) { + highResTimerActive = true; + timeBeginPeriod(timerResolution); + } + SetTimer(timerWindowHandle, endHighResTimerID, stopHighResTimerInMsec, 0); + } + + DWORD queueStatus = LOWORD(GetQueueStatus(QS_PAINT | QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT)); + + // Win32 has a tri-level queue with application messages > user input > WM_PAINT/WM_TIMER. + + // If the queue doesn't contains input events, we use a higher priorty timer event posting mechanism. + if (!(queueStatus & (QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT))) { + if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage && !(queueStatus & QS_PAINT)) { + // Call PostMessage immediately if the timer is already expired, unless a paint is pending. + // (we prioritize paints over timers) + if (InterlockedIncrement(&pendingTimers) == 1) + PostMessage(timerWindowHandle, timerFiredMessage, 0, 0); + timerSet = true; + } else { + // Otherwise, delay the PostMessage via a CreateTimerQueueTimer + if (!timerQueue) + timerQueue = CreateTimerQueue(); + if (timer) + DeleteTimerQueueTimer(timerQueue, timer, 0); + timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE); + } } } |