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

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 27710005: cc: Use HighResNow as timebase if it is fast and reliable (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix DCHECK Created 7 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/scheduler/frame_rate_controller.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "cc/debug/traced_value.h" 11 #include "cc/debug/traced_value.h"
12 #include "ui/gfx/frame_time.h"
12 13
13 namespace cc { 14 namespace cc {
14 15
15 Scheduler::Scheduler(SchedulerClient* client, 16 Scheduler::Scheduler(SchedulerClient* client,
16 const SchedulerSettings& scheduler_settings) 17 const SchedulerSettings& scheduler_settings)
17 : settings_(scheduler_settings), 18 : settings_(scheduler_settings),
18 client_(client), 19 client_(client),
19 last_set_needs_begin_impl_frame_(false), 20 last_set_needs_begin_impl_frame_(false),
20 state_machine_(scheduler_settings), 21 state_machine_(scheduler_settings),
21 inside_process_scheduled_actions_(false), 22 inside_process_scheduled_actions_(false),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ProcessScheduledActions(); 117 ProcessScheduledActions();
117 } 118 }
118 119
119 base::TimeTicks Scheduler::AnticipatedDrawTime() { 120 base::TimeTicks Scheduler::AnticipatedDrawTime() {
120 TRACE_EVENT0("cc", "Scheduler::AnticipatedDrawTime"); 121 TRACE_EVENT0("cc", "Scheduler::AnticipatedDrawTime");
121 122
122 if (!last_set_needs_begin_impl_frame_ || 123 if (!last_set_needs_begin_impl_frame_ ||
123 last_begin_impl_frame_args_.interval <= base::TimeDelta()) 124 last_begin_impl_frame_args_.interval <= base::TimeDelta())
124 return base::TimeTicks(); 125 return base::TimeTicks();
125 126
126 base::TimeTicks now = base::TimeTicks::Now(); 127 base::TimeTicks now = gfx::FrameTime::Now();
127 base::TimeTicks timebase = std::max(last_begin_impl_frame_args_.frame_time, 128 base::TimeTicks timebase = std::max(last_begin_impl_frame_args_.frame_time,
128 last_begin_impl_frame_args_.deadline); 129 last_begin_impl_frame_args_.deadline);
129 int64 intervals = 130 int64 intervals =
130 1 + ((now - timebase) / last_begin_impl_frame_args_.interval); 131 1 + ((now - timebase) / last_begin_impl_frame_args_.interval);
131 return timebase + (last_begin_impl_frame_args_.interval * intervals); 132 return timebase + (last_begin_impl_frame_args_.interval * intervals);
132 } 133 }
133 134
134 base::TimeTicks Scheduler::LastBeginImplFrameTime() { 135 base::TimeTicks Scheduler::LastBeginImplFrameTime() {
135 return last_begin_impl_frame_args_.frame_time; 136 return last_begin_impl_frame_args_.frame_time;
136 } 137 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 338
338 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) 339 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly())
339 PostBeginImplFrameDeadline(base::TimeTicks()); 340 PostBeginImplFrameDeadline(base::TimeTicks());
340 } 341 }
341 342
342 bool Scheduler::WillDrawIfNeeded() const { 343 bool Scheduler::WillDrawIfNeeded() const {
343 return !state_machine_.PendingDrawsShouldBeAborted(); 344 return !state_machine_.PendingDrawsShouldBeAborted();
344 } 345 }
345 346
346 } // namespace cc 347 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/frame_rate_controller.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698