Index: cc/scheduler/scheduler.cc |
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc |
index 7110bff7c3ae3c2ea435580d3a1f9bd3fc2b402e..2f43e8fd5ad22ca334de4f30a7d84e55b670cdfe 100644 |
--- a/cc/scheduler/scheduler.cc |
+++ b/cc/scheduler/scheduler.cc |
@@ -18,9 +18,6 @@ Scheduler::Scheduler(SchedulerClient* client, |
weak_factory_(this), |
last_set_needs_begin_frame_(false), |
has_pending_begin_frame_(false), |
- last_begin_frame_time_(base::TimeTicks()), |
- // TODO(brianderson): Pass with BeginFrame in the near future. |
- interval_(base::TimeDelta::FromMicroseconds(16666)), |
state_machine_(scheduler_settings), |
inside_process_scheduled_actions_(false) { |
DCHECK(client_); |
@@ -110,13 +107,21 @@ void Scheduler::DidCreateAndInitializeOutputSurface() { |
base::TimeTicks Scheduler::AnticipatedDrawTime() { |
TRACE_EVENT0("cc", "Scheduler::AnticipatedDrawTime"); |
+ |
+ // TODO(brianderson): Express this in terms of the deadline. |
base::TimeTicks now = base::TimeTicks::Now(); |
- int64 intervals = ((now - last_begin_frame_time_) / interval_) + 1; |
- return last_begin_frame_time_ + (interval_ * intervals); |
+ |
+ if (last_begin_frame_args_.interval() <= base::TimeDelta()) |
+ return now; |
+ |
+ int64 intervals = 1 + ((now - last_begin_frame_args_.frame_time()) / |
+ last_begin_frame_args_.interval()); |
+ return last_begin_frame_args_.frame_time() + |
+ (last_begin_frame_args_.interval() * intervals); |
} |
base::TimeTicks Scheduler::LastBeginFrameOnImplThreadTime() { |
- return last_begin_frame_time_; |
+ return last_begin_frame_args_.frame_time(); |
} |
void Scheduler::SetupNextBeginFrameIfNeeded() { |
@@ -141,13 +146,13 @@ void Scheduler::SetupNextBeginFrameIfNeeded() { |
} |
} |
-void Scheduler::BeginFrame(base::TimeTicks frame_time) { |
+void Scheduler::BeginFrame(BeginFrameArgs args) { |
TRACE_EVENT0("cc", "Scheduler::BeginFrame"); |
+ last_begin_frame_args_ = args; |
DCHECK(!has_pending_begin_frame_); |
has_pending_begin_frame_ = true; |
- last_begin_frame_time_ = frame_time; |
- state_machine_.DidEnterBeginFrame(); |
- state_machine_.SetFrameTime(frame_time); |
+ last_begin_frame_args_ = args; |
Sami
2013/06/13 10:01:07
Dupe assignment?
brianderson
2013/06/14 20:12:02
Will fix.
|
+ state_machine_.DidEnterBeginFrame(args); |
ProcessScheduledActions(); |
state_machine_.DidLeaveBeginFrame(); |
} |