| Index: Source/platform/Timer.cpp
|
| diff --git a/Source/platform/Timer.cpp b/Source/platform/Timer.cpp
|
| index 7295542ee380a30e94c68d4dc566a03e93eb6896..796bc2cf95a4d569e80673e3ab5441f0a9ebacbd 100644
|
| --- a/Source/platform/Timer.cpp
|
| +++ b/Source/platform/Timer.cpp
|
| @@ -105,7 +105,12 @@
|
| // TODO(skyostil): Move timer alignment into the scheduler.
|
| m_webScheduler->postTimerTaskAt(m_location, m_cancellableTimerTask, m_nextFireTime);
|
| } else {
|
| - m_webScheduler->postTimerTask(m_location, m_cancellableTimerTask, newTime - now);
|
| + // Round the delay up to the nearest millisecond to be consistant with the
|
| + // previous behavior of BlinkPlatformImpl::setSharedTimerFireInterval.
|
| + long long delayMs = static_cast<long long>(ceil((newTime - now) * 1000.0));
|
| + if (delayMs < 0)
|
| + delayMs = 0;
|
| + m_webScheduler->postTimerTask(m_location, m_cancellableTimerTask, delayMs);
|
| }
|
| }
|
| }
|
| @@ -121,14 +126,10 @@
|
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "BlinkInternal");
|
|
|
| m_nextFireTime = 0;
|
| - if (m_repeatInterval) {
|
| - double now = monotonicallyIncreasingTime();
|
| - ASSERT(now >= m_unalignedNextFireTime);
|
| - // This computation should be drift free, and it will cope if we miss a beat,
|
| - // which can easily happen if the thread is busy.
|
| - double intervalToNextFireTime = m_repeatInterval - fmod(now - m_unalignedNextFireTime, m_repeatInterval);
|
| - setNextFireTime(now, intervalToNextFireTime);
|
| - }
|
| + // Note: repeating timers drift, but this is preserving the functionality of the old timer heap.
|
| + // See crbug.com/328700.
|
| + if (m_repeatInterval)
|
| + setNextFireTime(monotonicallyIncreasingTime(), m_repeatInterval);
|
| fired();
|
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "Sleeping");
|
| }
|
|
|