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

Unified Diff: cc/scheduler/scheduler.cc

Issue 26880010: gfx: Add FrameTime and DisplayTime classes (Closed) Base URL: http://git.chromium.org/chromium/src.git@checkHighResNow4
Patch Set: WIP Created 7 years, 2 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/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler.cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 93b91311e6e94c9f821ad8753cbe56d40d6b27b4..2770aa8f7cbbdff3b2126b4bfd3d85cd36bdd791 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -117,22 +117,24 @@ void Scheduler::DidCreateAndInitializeOutputSurface() {
ProcessScheduledActions();
}
-base::TimeTicks Scheduler::AnticipatedDrawTime() {
+gfx::FrameTime Scheduler::AnticipatedDrawTime() {
TRACE_EVENT0("cc", "Scheduler::AnticipatedDrawTime");
if (!last_set_needs_begin_impl_frame_ ||
last_begin_impl_frame_args_.interval <= base::TimeDelta())
- return base::TimeTicks();
+ return gfx::FrameTime();
- base::TimeTicks now = gfx::FrameTime::Now();
- base::TimeTicks timebase = std::max(last_begin_impl_frame_args_.frame_time,
- last_begin_impl_frame_args_.deadline);
+ gfx::FrameTime now = gfx::FrameTime::Now();
+ gfx::FrameTime timebase =
+ std::max<gfx::FrameTime>(
+ last_begin_impl_frame_args_.frame_time,
+ last_begin_impl_frame_args_.deadline);
int64 intervals =
1 + ((now - timebase) / last_begin_impl_frame_args_.interval);
return timebase + (last_begin_impl_frame_args_.interval * intervals);
}
-base::TimeTicks Scheduler::LastBeginImplFrameTime() {
+gfx::FrameTime Scheduler::LastBeginImplFrameTime() {
return last_begin_impl_frame_args_.frame_time;
}
@@ -182,7 +184,8 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
DCHECK(state_machine_.HasInitializedOutputSurface());
last_begin_impl_frame_args_ = args;
- last_begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate();
+ last_begin_impl_frame_args_.deadline =
+ last_begin_impl_frame_args_.deadline - client_->DrawDurationEstimate();
state_machine_.OnBeginImplFrame(last_begin_impl_frame_args_);
ProcessScheduledActions();
@@ -201,10 +204,10 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
} else if (!settings_.deadline_scheduling_enabled) {
// We emulate the old non-deadline scheduler here by posting the
// deadline task without any delay.
- PostBeginImplFrameDeadline(base::TimeTicks());
+ PostBeginImplFrameDeadline(gfx::FrameTime());
} else if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) {
// We are ready to draw a new active tree immediately.
- PostBeginImplFrameDeadline(base::TimeTicks());
+ PostBeginImplFrameDeadline(gfx::FrameTime());
} else if (state_machine_.needs_redraw()) {
// We have an animation or fast input path on the impl thread that wants
// to draw, so don't wait too long for a new active tree.
@@ -222,7 +225,7 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
}
}
-void Scheduler::PostBeginImplFrameDeadline(base::TimeTicks deadline) {
+void Scheduler::PostBeginImplFrameDeadline(gfx::FrameTime deadline) {
begin_impl_frame_deadline_closure_.Cancel();
begin_impl_frame_deadline_closure_.Reset(
base::Bind(&Scheduler::OnBeginImplFrameDeadline,
@@ -337,7 +340,7 @@ void Scheduler::ProcessScheduledActions() {
client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());
if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly())
- PostBeginImplFrameDeadline(base::TimeTicks());
+ PostBeginImplFrameDeadline(gfx::FrameTime());
}
bool Scheduler::WillDrawIfNeeded() const {
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698