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

Unified Diff: cc/scheduler/delay_based_time_source.cc

Issue 1200113003: cc: Cleanup DelayBasedTimeSource code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@task_runner_refptr
Patch Set: mithro's review Created 5 years, 6 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
« no previous file with comments | « cc/scheduler/begin_frame_source_unittest.cc ('k') | cc/test/scheduler_test_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/delay_based_time_source.cc
diff --git a/cc/scheduler/delay_based_time_source.cc b/cc/scheduler/delay_based_time_source.cc
index b1f68bd27c94fda46cd5919eed1a76326feeeedb..55a804a4454de62c7e39e3785487149ac6b0441e 100644
--- a/cc/scheduler/delay_based_time_source.cc
+++ b/cc/scheduler/delay_based_time_source.cc
@@ -63,7 +63,11 @@ base::TimeTicks DelayBasedTimeSource::SetActive(bool active) {
return base::TimeTicks();
}
- PostNextTickTask(Now());
+ base::TimeTicks now = Now();
+ PostNextTickTask(now);
+
+ if (current_parameters_.tick_target <= now)
+ return base::TimeTicks();
// Determine if there was a tick that was missed while not active.
base::TimeTicks last_tick_time_if_always_active =
@@ -227,11 +231,10 @@ base::TimeTicks DelayBasedTimeSource::NextTickTarget(base::TimeTicks now) {
void DelayBasedTimeSource::PostNextTickTask(base::TimeTicks now) {
base::TimeTicks new_tick_target = NextTickTarget(now);
+ DCHECK(new_tick_target >= now);
brianderson 2015/06/23 21:00:29 DCHECK_GE
// Post another task *before* the tick and update state
- base::TimeDelta delay;
- if (now <= new_tick_target)
brianderson 2015/06/23 21:00:29 I forget why this was needed. Could small jitter i
sunnyps 2015/06/26 00:45:28 This condition should always be true. See the DCHE
- delay = new_tick_target - now;
+ base::TimeDelta delay = new_tick_target - now;
task_runner_->PostDelayedTask(FROM_HERE,
base::Bind(&DelayBasedTimeSource::OnTimerFired,
weak_factory_.GetWeakPtr()),
« no previous file with comments | « cc/scheduler/begin_frame_source_unittest.cc ('k') | cc/test/scheduler_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698