Chromium Code Reviews| Index: third_party/WebKit/Source/platform/Timer.cpp |
| diff --git a/third_party/WebKit/Source/platform/Timer.cpp b/third_party/WebKit/Source/platform/Timer.cpp |
| index b02e8b6c8e52b447cd9e6b50c130d73445ec50f8..022329002b560e085d494d7aeac285143bd3dd1d 100644 |
| --- a/third_party/WebKit/Source/platform/Timer.cpp |
| +++ b/third_party/WebKit/Source/platform/Timer.cpp |
| @@ -85,6 +85,24 @@ double TimerBase::nextFireInterval() const { |
| return m_nextFireTime - current; |
| } |
| +void TimerBase::moveToNewTaskRunner(WebTaskRunner* taskRunner) { |
| +#if DCHECK_IS_ON() |
| + DCHECK_EQ(m_thread, currentThread()); |
| + DCHECK(taskRunner->runsTasksOnCurrentThread()); |
| +#endif |
| + TRACE_EVENT0("blink", "TimerBase::moveToNewTaskRunner"); |
|
Sami
2016/12/07 18:58:13
Might want to check if we're already on |taskRunne
haraken
2016/12/08 01:37:20
Do you really want to have the trace event? moveTo
altimin
2016/12/08 14:14:38
Done.
altimin
2016/12/08 14:14:38
Agreed, removed.
|
| + |
| + m_weakPtrFactory.revokeAll(); |
| + |
| + m_webTaskRunner = std::unique_ptr<WebTaskRunner>(taskRunner->clone()); |
|
dcheng
2016/12/07 18:59:57
Nit: clone() already returns a unique_ptr, doesn't
altimin
2016/12/08 14:14:38
Thanks.
|
| + |
| + double now = timerMonotonicallyIncreasingTime(); |
| + double nextFireTime = m_nextFireTime; |
| + m_nextFireTime = 0; |
|
haraken
2016/12/08 01:37:20
Line 100 and 101 wouldn't be needed. I think you c
altimin
2016/12/08 14:14:38
They are needed because of line 127. setNextFireTi
|
| + |
| + setNextFireTime(now, nextFireTime - now); |
| +} |
| + |
| // static |
| WebTaskRunner* TimerBase::getTimerTaskRunner() { |
| return Platform::current()->currentThread()->scheduler()->timerTaskRunner(); |