Bug 136402 - Simplify DOMTimer::adjustMinimumTimerInterval -> updateTimerIntervalIfNecessary
Summary: Simplify DOMTimer::adjustMinimumTimerInterval -> updateTimerIntervalIfNecessary
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-29 19:11 PDT by Gavin Barraclough
Modified: 2014-09-03 10:05 PDT (History)
3 users (show)

See Also:


Attachments
Fix (8.49 KB, patch)
2014-08-29 19:17 PDT, Gavin Barraclough
kling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Barraclough 2014-08-29 19:11:55 PDT
When the minimum DOM timer interval changes, the Page updates all DOMTimers accordingly. Updating the fire/repeat internal on TimerBase requires a delta, but in DOMTimer::adjustMinimumTimerInterval we have the new requested interval. In the case of repeating timers we can get the current interval to calculate the delta by calling repeatInterval(), but in the case of one-shot timers neither TimerBase no DOMTimer have store the interval that was actually set for the timer (DOMTimer knows the original, unadjusted timer, but not the actual interval). The way this currently works is that when the minimum interval changes, Page calls adjustMinimumTimerInterval providing the previous minimum. If the timer is one-shot, then adjustMinimumTimerInterval will use this to compute the delta based on what the interval would have been.

We can simplify & unify with the code to throttle interval timers when the nesting threshold is hit, by instead tracking the current timer interval as a member on DOMTimer & using this to compute the delta in all cases.
Comment 1 Gavin Barraclough 2014-08-29 19:17:22 PDT
Created attachment 237403 [details]
Fix
Comment 2 Andreas Kling 2014-08-29 19:50:41 PDT
Comment on attachment 237403 [details]
Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=237403&action=review

r=me

> Source/WebCore/ChangeLog:9
> +        Updating the fire/repeat internal on TimerBase requires a delta, but in

internal -> interval

> Source/WebCore/ChangeLog:12
> +        but in the case of one-shot timers neither TimerBase no DOMTimer have store the interval

no -> nor
Comment 3 Gavin Barraclough 2014-09-03 10:05:53 PDT
Transmitting file data ....
Committed revision 173208.