RESOLVED FIXED 22718
Implement WindowTimers interface in Workers
https://bugs.webkit.org/show_bug.cgi?id=22718
Summary Implement WindowTimers interface in Workers
Alexey Proskuryakov
Reported 2008-12-07 03:13:26 PST
We need to make timers function in Workers. [NoInterfaceObject] interface WindowTimers { // timers long setTimeout(in TimeoutHandler handler, in long timeout); long setTimeout(in TimeoutHandler handler, in long timeout, arguments...); long setTimeout(in DOMString code, in long timeout); long setTimeout(in DOMString code, in long timeout, in DOMString language); void clearTimeout(in long handle); long setInterval(in TimeoutHandler handler, in long timeout); long setInterval(in TimeoutHandler handler, in long timeout, arguments...); long setInterval(in DOMString code, in long timeout); long setInterval(in DOMString code, in long timeout, in DOMString language); void clearInterval(in long handle); }; interface TimeoutHandler { void handleEvent([Variadic] in any args); };
Attachments
Proposed patch (15.20 KB, patch)
2009-02-02 18:49 PST, Dmitry Titov
ap: review+
Alexey Proskuryakov
Comment 1 2008-12-07 03:57:24 PST
Dmitry Titov
Comment 2 2008-12-08 00:49:27 PST
*** Bug 22328 has been marked as a duplicate of this bug. ***
Dmitry Titov
Comment 3 2009-01-10 13:39:10 PST
Adding timers to Workers (setTimeout,setInterval,clearTimeout,clearInterval) happened to be a big enough work to split it into multiple patches. So I keep this bug as a "root" and make small patches in separate bugs that refer to this one for context. Here is a rough plan of this work. The main changes are related to sharing timer functionality between Document/DOMWindow and a new WorkerContext, making TimerBase to be threading-aware and changing Worker thread's run loop to support timers. More detailed list (likely to change somewhat as a result of reviews and feedback of others): 1. Move timer-related code from JSDOMWindowBase where it currently lives into a new DOMTimer object, abstract JS engine - related parts into ScheduledAction class. This will allow to use timer functionality from both DOMWindow and WorkerContext. 2. Create a new RunLoop class to encapsulate the worker thread's run loop which has to deal with message queue and timers. This includes changes to WTF::MessageQueue (to add timedWait), TimeBase (to make it able to work on worker threads too) and other threading-related changes. 3. Expose timer functions on WorkerContext/JSWorkerContext.
Dmitry Titov
Comment 4 2009-02-02 18:49:44 PST
Created attachment 27273 [details] Proposed patch Final patch - enables JS API, adds a test.
Dmitry Titov
Comment 5 2009-02-02 19:00:21 PST
This patch depends on a relatively simple patch in bug 23560 for timers to actually fire. But otherwise it doesn't depend on it so it can be reviewed separately. If patch for the bug 23560 will be further modified, it won't affect this one.
Alexey Proskuryakov
Comment 6 2009-02-03 01:48:18 PST
Comment on attachment 27273 [details] Proposed patch r=me
Alexey Proskuryakov
Comment 7 2009-02-03 02:33:31 PST
Committed revision 40534. Nice test case!
Note You need to log in before you can comment on or make changes to this bug.