Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: third_party/WebKit/Source/platform/Timer.cpp

Issue 1646583002: [Reland] Per WebViewScheduler virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try to fix the broken tests Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4dbaea668b3d160958b7f8a841bbf7e4de65d237..a7bd109dd79a5552f68555182d812fd2bbeff59b 100644
--- a/third_party/WebKit/Source/platform/Timer.cpp
+++ b/third_party/WebKit/Source/platform/Timer.cpp
@@ -65,7 +65,7 @@ void TimerBase::start(double nextFireInterval, double repeatInterval, const WebT
m_location = caller;
m_repeatInterval = repeatInterval;
- setNextFireTime(monotonicallyIncreasingTime(), nextFireInterval);
+ setNextFireTime(time(), nextFireInterval);
}
void TimerBase::stop()
@@ -82,7 +82,7 @@ void TimerBase::stop()
double TimerBase::nextFireInterval() const
{
ASSERT(isActive());
- double current = monotonicallyIncreasingTime();
+ double current = time();
if (m_nextFireTime < current)
return 0;
return m_nextFireTime - current;
@@ -121,13 +121,13 @@ void TimerBase::runInternal()
TRACE_EVENT_SET_SAMPLING_STATE("blink", "BlinkInternal");
if (m_repeatInterval) {
- double now = monotonicallyIncreasingTime();
+ double now = time();
// This computation should be drift free, and it will cope if we miss a beat,
// which can easily happen if the thread is busy. It will also cope if we get
// called slightly before m_unalignedNextFireTime, which can happen due to lack
// of timer precision.
double intervalToNextFireTime = m_repeatInterval - fmod(now - m_nextFireTime, m_repeatInterval);
- setNextFireTime(monotonicallyIncreasingTime(), intervalToNextFireTime);
+ setNextFireTime(time(), intervalToNextFireTime);
} else {
m_nextFireTime = 0;
}
@@ -140,6 +140,11 @@ bool TimerBase::Comparator::operator()(const TimerBase* a, const TimerBase* b) c
return a->m_nextFireTime < b->m_nextFireTime;
}
+double TimerBase::time() const
+{
+ return Platform::current()->monotonicallyIncreasingVirtualTimeSeconds();
Sami 2016/02/03 18:03:44 This is going to get called fairly often so it mig
alex clarke (OOO till 29th) 2016/02/04 15:00:10 Done.
+}
+
// static
WebTaskRunner* TimerBase::UnthrottledWebTaskRunner()
{

Powered by Google App Engine
This is Rietveld 408576698