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

Unified Diff: cc/scheduler/frame_rate_controller.cc

Issue 16833003: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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/frame_rate_controller.h ('k') | cc/scheduler/frame_rate_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/frame_rate_controller.cc
diff --git a/cc/scheduler/frame_rate_controller.cc b/cc/scheduler/frame_rate_controller.cc
index b4f1272e2d2c52513365371e2fa7d757e194c3d3..90cf0d72071228e911a6a12c267d07566be32075 100644
--- a/cc/scheduler/frame_rate_controller.cc
+++ b/cc/scheduler/frame_rate_controller.cc
@@ -21,7 +21,9 @@ class FrameRateControllerTimeSourceAdapter : public TimeSourceClient {
}
virtual ~FrameRateControllerTimeSourceAdapter() {}
- virtual void OnTimerTick() OVERRIDE { frame_rate_controller_->OnTimerTick(); }
+ virtual void OnTimerTick() OVERRIDE {
+ frame_rate_controller_->OnTimerTick();
+ }
private:
explicit FrameRateControllerTimeSourceAdapter(
@@ -34,7 +36,7 @@ class FrameRateControllerTimeSourceAdapter : public TimeSourceClient {
FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer)
: client_(NULL),
num_frames_pending_(0),
- max_frames_pending_(0),
+ max_swaps_pending_(0),
time_source_(timer),
active_(false),
is_time_source_throttling_(true),
@@ -48,7 +50,7 @@ FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer)
FrameRateController::FrameRateController(Thread* thread)
: client_(NULL),
num_frames_pending_(0),
- max_frames_pending_(0),
+ max_swaps_pending_(0),
active_(false),
is_time_source_throttling_(false),
weak_factory_(this),
@@ -75,9 +77,9 @@ void FrameRateController::SetActive(bool active) {
}
}
-void FrameRateController::SetMaxFramesPending(int max_frames_pending) {
- DCHECK_GE(max_frames_pending, 0);
- max_frames_pending_ = max_frames_pending;
+void FrameRateController::SetMaxSwapsPending(int max_swaps_pending) {
+ DCHECK_GE(max_swaps_pending, 0);
+ max_swaps_pending_ = max_swaps_pending;
}
void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase,
@@ -87,15 +89,17 @@ void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase,
}
void FrameRateController::OnTimerTick() {
+ TRACE_EVENT0("cc", "FrameRateController::OnTimerTick");
DCHECK(active_);
// Check if we have too many frames in flight.
bool throttled =
- max_frames_pending_ && num_frames_pending_ >= max_frames_pending_;
+ max_swaps_pending_ && num_frames_pending_ >= max_swaps_pending_;
TRACE_COUNTER_ID1("cc", "ThrottledCompositor", thread_, throttled);
- if (client_)
- client_->BeginFrame(throttled);
+ if (client_) {
+ client_->FrameRateControllerTick(throttled);
+ }
if (!is_time_source_throttling_ && !throttled)
PostManualTick();
@@ -108,7 +112,9 @@ void FrameRateController::PostManualTick() {
}
}
-void FrameRateController::ManualTick() { OnTimerTick(); }
+void FrameRateController::ManualTick() {
+ OnTimerTick();
+}
void FrameRateController::DidSwapBuffers() {
num_frames_pending_++;
« no previous file with comments | « cc/scheduler/frame_rate_controller.h ('k') | cc/scheduler/frame_rate_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698