OLD | NEW |
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/frame_rate_controller.h" | 5 #include "cc/scheduler/frame_rate_controller.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 DCHECK(active_); | 112 DCHECK(active_); |
113 | 113 |
114 // Check if we have too many frames in flight. | 114 // Check if we have too many frames in flight. |
115 bool throttled = | 115 bool throttled = |
116 max_swaps_pending_ && num_frames_pending_ >= max_swaps_pending_; | 116 max_swaps_pending_ && num_frames_pending_ >= max_swaps_pending_; |
117 TRACE_COUNTER_ID1("cc", "ThrottledCompositor", task_runner_, throttled); | 117 TRACE_COUNTER_ID1("cc", "ThrottledCompositor", task_runner_, throttled); |
118 | 118 |
119 if (client_) { | 119 if (client_) { |
120 // TODO(brianderson): Use an adaptive parent compositor deadline. | 120 // TODO(brianderson): Use an adaptive parent compositor deadline. |
121 base::TimeTicks frame_time = LastTickTime(); | 121 base::TimeTicks frame_time = LastTickTime(); |
122 base::TimeTicks deadline = NextTickTime() + deadline_adjustment_; | 122 base::TimeTicks deadline = NextTickTime(); |
123 client_->FrameRateControllerTick( | 123 BeginFrameArgs args = |
124 throttled, | 124 BeginFrameArgs::Create(frame_time, deadline, interval_); |
125 BeginFrameArgs::Create(frame_time, deadline, interval_)); | 125 args.AdjustDeadline(deadline_adjustment_); |
| 126 client_->FrameRateControllerTick(throttled, args); |
126 } | 127 } |
127 | 128 |
128 if (!is_time_source_throttling_ && !throttled) | 129 if (!is_time_source_throttling_ && !throttled) |
129 PostManualTick(); | 130 PostManualTick(); |
130 } | 131 } |
131 | 132 |
132 void FrameRateController::PostManualTick() { | 133 void FrameRateController::PostManualTick() { |
133 if (active_) { | 134 if (active_) { |
134 task_runner_->PostTask(FROM_HERE, | 135 task_runner_->PostTask(FROM_HERE, |
135 base::Bind(&FrameRateController::ManualTick, | 136 base::Bind(&FrameRateController::ManualTick, |
(...skipping 28 matching lines...) Expand all Loading... |
164 } | 165 } |
165 | 166 |
166 base::TimeTicks FrameRateController::LastTickTime() { | 167 base::TimeTicks FrameRateController::LastTickTime() { |
167 if (is_time_source_throttling_) | 168 if (is_time_source_throttling_) |
168 return time_source_->LastTickTime(); | 169 return time_source_->LastTickTime(); |
169 | 170 |
170 return base::TimeTicks::Now(); | 171 return base::TimeTicks::Now(); |
171 } | 172 } |
172 | 173 |
173 } // namespace cc | 174 } // namespace cc |
OLD | NEW |