Bug 147992 - WorkQueue::dispatchAfter() on Windows fires early
Summary: WorkQueue::dispatchAfter() on Windows fires early
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-13 14:08 PDT by Mark Lam
Modified: 2015-08-13 16:39 PDT (History)
6 users (show)

See Also:


Attachments
the fix. (2.81 KB, patch)
2015-08-13 14:16 PDT, Mark Lam
no flags Details | Formatted Diff | Diff
the fix. (2.79 KB, patch)
2015-08-13 14:18 PDT, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2015-08-13 14:08:27 PDT
The Windows implementation of WorkQueue::dispatchAfter() uses CreateTimerQueueTimer().  Unfortunately, CreateTimerQueueTimer() is sloppy and can fire early.  We need to compensate for this slop to ensure that the specified duration does expire before the callback function is called (or the JSC watchdog which depends on this can fail randomly).
Comment 1 Brent Fulgham 2015-08-13 14:15:24 PDT
It looks like the standard Windows timer ticks at ~64 ticks/second -> 15ms interval.

http://download.microsoft.com/download/3/0/2/3027D574-C433-412A-A8B65E0A75D5B237/Timer-Resolution.docx
See also https://msdn.microsoft.com/enus/library/system.timers.timer.interval(v=vs.110).aspx
Another one: <https://msdn.microsoft.com/enus/library/windows/hardware/dn265247(v=vs.85).aspx>, check the "Controlling timer accuracy" section's first paragraph.
Comment 2 Mark Lam 2015-08-13 14:16:37 PDT
Created attachment 258932 [details]
the fix.
Comment 3 Mark Lam 2015-08-13 14:18:29 PDT
Created attachment 258933 [details]
the fix.
Comment 4 Brent Fulgham 2015-08-13 14:24:43 PDT
Comment on attachment 258933 [details]
the fix.

r=me.
Comment 5 WebKit Commit Bot 2015-08-13 16:39:20 PDT
Comment on attachment 258933 [details]
the fix.

Clearing flags on attachment: 258933

Committed r188415: <http://trac.webkit.org/changeset/188415>
Comment 6 WebKit Commit Bot 2015-08-13 16:39:26 PDT
All reviewed patches have been landed.  Closing bug.