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..252bebafbbc0fb495d2e5f2210a8b7f2f4b0d760 100644 |
--- a/third_party/WebKit/Source/platform/Timer.cpp |
+++ b/third_party/WebKit/Source/platform/Timer.cpp |
@@ -85,6 +85,28 @@ 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 |
+ // If the underlying task runner stays the same, ignore it. |
+ if (m_webTaskRunner->toSingleThreadTaskRunner() == |
+ taskRunner->toSingleThreadTaskRunner()) { |
+ return; |
+ } |
+ |
+ m_weakPtrFactory.revokeAll(); |
+ |
+ m_webTaskRunner = taskRunner->clone(); |
+ |
+ double now = timerMonotonicallyIncreasingTime(); |
+ double nextFireTime = m_nextFireTime; |
+ m_nextFireTime = 0; |
+ |
+ setNextFireTime(now, nextFireTime - now); |
+} |
+ |
// static |
WebTaskRunner* TimerBase::getTimerTaskRunner() { |
return Platform::current()->currentThread()->scheduler()->timerTaskRunner(); |