| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "cc/base/thread.h" | 9 #include "cc/base/thread.h" |
| 10 #include "cc/scheduler/delay_based_time_source.h" | 10 #include "cc/scheduler/delay_based_time_source.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 DCHECK_GE(max_frames_pending, 0); | 81 DCHECK_GE(max_frames_pending, 0); |
| 82 max_frames_pending_ = max_frames_pending; | 82 max_frames_pending_ = max_frames_pending; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase, | 85 void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase, |
| 86 base::TimeDelta interval) { | 86 base::TimeDelta interval) { |
| 87 if (is_time_source_throttling_) | 87 if (is_time_source_throttling_) |
| 88 time_source_->SetTimebaseAndInterval(timebase, interval); | 88 time_source_->SetTimebaseAndInterval(timebase, interval); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool FrameRateController::swap_buffers_complete_supported() const { |
| 92 return swap_buffers_complete_supported_; |
| 93 } |
| 94 |
| 91 void FrameRateController::SetSwapBuffersCompleteSupported(bool supported) { | 95 void FrameRateController::SetSwapBuffersCompleteSupported(bool supported) { |
| 92 swap_buffers_complete_supported_ = supported; | 96 swap_buffers_complete_supported_ = supported; |
| 93 } | 97 } |
| 94 | 98 |
| 95 void FrameRateController::OnTimerTick() { | 99 void FrameRateController::OnTimerTick() { |
| 96 DCHECK(active_); | 100 DCHECK(active_); |
| 97 | 101 |
| 98 // Check if we have too many frames in flight. | 102 // Check if we have too many frames in flight. |
| 99 bool throttled = | 103 bool throttled = |
| 100 max_frames_pending_ && num_frames_pending_ >= max_frames_pending_; | 104 max_frames_pending_ && num_frames_pending_ >= max_frames_pending_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 149 } |
| 146 | 150 |
| 147 base::TimeTicks FrameRateController::LastTickTime() { | 151 base::TimeTicks FrameRateController::LastTickTime() { |
| 148 if (is_time_source_throttling_) | 152 if (is_time_source_throttling_) |
| 149 return time_source_->LastTickTime(); | 153 return time_source_->LastTickTime(); |
| 150 | 154 |
| 151 return base::TimeTicks::Now(); | 155 return base::TimeTicks::Now(); |
| 152 } | 156 } |
| 153 | 157 |
| 154 } // namespace cc | 158 } // namespace cc |
| OLD | NEW |