RESOLVED FIXED 20979
WebCore timers on Windows XP do not fire with high resolution
https://bugs.webkit.org/show_bug.cgi?id=20979
Summary WebCore timers on Windows XP do not fire with high resolution
Steve Falkenburg
Reported 2008-09-21 16:46:05 PDT
Timers on XP are only firing at 16ms intervals. On XP, the test at http://ejohn.org/apps/timers/ generates a line at 15-16ms. On Vista, we get a line at 10ms, which is expected given our timer clamp (we won't go any lower). The bug is due to us not calling timeBeginPeriod/timeEndPeriod on XP, which we weren't doing since it didn't have the desired effect by itself. The reason it wasn't working is that we're calling GetSystemTimeAsFileTime to retrieve the current time (to decide which timers are ready to fire). Turns out on XP, this call is low resolution (15-16ms granularity), even when timeBeginPeriod/timeEndPeriod is used. To fix this, we need to call timeBeginPeriod/timeEndPeriod on all systems (including both XP and Vista) and call through to our JSC high-resolution date/time code instead of using GetSystemTimeAsFileTime. Note that we don't call timeBeginPeriod(1) and leave it there. Instead, we want to fall back to low-resolution mode after 300ms or so to avoid overly taxing the user's CPU.
Attachments
Use high-resolution date/time call in WebCore::currentTime, make SharedTimerWin OS agnostic (7.92 KB, patch)
2008-09-21 16:49 PDT, Steve Falkenburg
mjs: review+
Steve Falkenburg
Comment 1 2008-09-21 16:49:00 PDT
Created attachment 23635 [details] Use high-resolution date/time call in WebCore::currentTime, make SharedTimerWin OS agnostic
Maciej Stachowiak
Comment 2 2008-09-21 17:06:30 PDT
Comment on attachment 23635 [details] Use high-resolution date/time call in WebCore::currentTime, make SharedTimerWin OS agnostic r=me
mitz
Comment 3 2008-09-21 17:09:06 PDT
Comment on attachment 23635 [details] Use high-resolution date/time call in WebCore::currentTime, make SharedTimerWin OS agnostic - if (wParam == sharedTimerID || wParam == lastChanceSharedTimerID && !isDeferringTimers()) { + if (wParam == sharedTimerID && !isDeferringTimers()) { The !isDeferringTimers() check was only needed for the last chance timer.
Note You need to log in before you can comment on or make changes to this bug.