Index: cc/scheduler/frame_rate_controller.cc |
diff --git a/cc/scheduler/frame_rate_controller.cc b/cc/scheduler/frame_rate_controller.cc |
index 90cf0d72071228e911a6a12c267d07566be32075..177031cd83048fff25284cba2456698796b587f5 100644 |
--- a/cc/scheduler/frame_rate_controller.cc |
+++ b/cc/scheduler/frame_rate_controller.cc |
@@ -37,6 +37,7 @@ FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer) |
: client_(NULL), |
num_frames_pending_(0), |
max_swaps_pending_(0), |
+ interval_(base::TimeDelta::FromMicroseconds(16666)), |
Sami
2013/06/13 10:01:07
It might be worth making the default frame interva
brianderson
2013/06/14 20:12:02
Good idea.
|
time_source_(timer), |
active_(false), |
is_time_source_throttling_(true), |
@@ -51,6 +52,7 @@ FrameRateController::FrameRateController(Thread* thread) |
: client_(NULL), |
num_frames_pending_(0), |
max_swaps_pending_(0), |
+ interval_(base::TimeDelta::FromMicroseconds(16666)), |
active_(false), |
is_time_source_throttling_(false), |
weak_factory_(this), |
@@ -84,10 +86,15 @@ void FrameRateController::SetMaxSwapsPending(int max_swaps_pending) { |
void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase, |
base::TimeDelta interval) { |
+ interval_ = interval; |
if (is_time_source_throttling_) |
time_source_->SetTimebaseAndInterval(timebase, interval); |
} |
+void FrameRateController::SetDeadlineAdjustment(base::TimeDelta delta) { |
+ deadline_adjustment_ = delta; |
+} |
+ |
void FrameRateController::OnTimerTick() { |
TRACE_EVENT0("cc", "FrameRateController::OnTimerTick"); |
DCHECK(active_); |
@@ -98,7 +105,12 @@ void FrameRateController::OnTimerTick() { |
TRACE_COUNTER_ID1("cc", "ThrottledCompositor", thread_, throttled); |
if (client_) { |
- client_->FrameRateControllerTick(throttled); |
+ // TODO(brianderson): Use an adaptive parent compositor deadline. |
+ base::TimeTicks frame_time = LastTickTime(); |
+ base::TimeTicks deadline = NextTickTime() + deadline_adjustment_; |
+ client_->FrameRateControllerTick( |
+ throttled, |
+ BeginFrameArgs::CreateBeginFrame(frame_time, deadline, interval_)); |
} |
if (!is_time_source_throttling_ && !throttled) |