Skip to content

Instantly share code, notes, and snippets.

@deepal
Last active August 15, 2020 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepal/73655c50f60eefd9d6299eee3e0b73f0 to your computer and use it in GitHub Desktop.
Save deepal/73655c50f60eefd9d6299eee3e0b73f0 to your computer and use it in GitHub Desktop.
DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtrWillBeRawPtr<ScheduledAction> action, int interval, bool singleShot, int timeoutID)
: SuspendableTimer(context)
, m_timeoutID(timeoutID)
, m_nestingLevel(context->timers()->timerNestingLevel() + 1)
, m_action(action)
{
// ... redacted ...
double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillisecond);
if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNestingLevel)
intervalMilliseconds = minimumInterval;
if (singleShot)
startOneShot(intervalMilliseconds, FROM_HERE);
else
startRepeating(intervalMilliseconds, FROM_HERE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment