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

Side by Side Diff: cc/scheduler/frame_rate_controller.cc

Issue 22354007: cc: Add queue of BeginFrames to support long deadlines. (Closed) Base URL: http://git.chromium.org/chromium/src.git@deferredCommit
Patch Set: Created 7 years, 4 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 unified diff | Download patch
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 BeginFrameArgs FrameRateController::SetActive(bool active) { 69 BeginFrameArgs FrameRateController::SetActive(bool active) {
70 if (active_ == active) 70 if (active_ == active)
71 return BeginFrameArgs(); 71 return BeginFrameArgs();
72 TRACE_EVENT1("cc", "FrameRateController::SetActive", "active", active); 72 TRACE_EVENT1("cc", "FrameRateController::SetActive", "active", active);
73 active_ = active; 73 active_ = active;
74 74
75 if (is_time_source_throttling_) { 75 if (is_time_source_throttling_) {
76 base::TimeTicks missed_tick_time = time_source_->SetActive(active); 76 base::TimeTicks missed_tick_time = time_source_->SetActive(active);
77 if (!missed_tick_time.is_null()) { 77 if (!missed_tick_time.is_null()) {
78 base::TimeTicks deadline = NextTickTime(); 78 base::TimeTicks deadline = NextTickTime() + interval_;
79 BeginFrameArgs args = 79 BeginFrameArgs args =
80 BeginFrameArgs::Create(missed_tick_time, deadline, interval_); 80 BeginFrameArgs::Create(missed_tick_time, deadline, interval_);
81 args.AdjustDeadline(deadline_adjustment_); 81 args.AdjustDeadline(deadline_adjustment_);
82 return args; 82 return args;
83 } 83 }
84 } else { 84 } else {
85 if (active) 85 if (active)
86 PostManualTick(); 86 PostManualTick();
87 else 87 else
88 weak_factory_.InvalidateWeakPtrs(); 88 weak_factory_.InvalidateWeakPtrs();
(...skipping 24 matching lines...) Expand all
113 DCHECK(active_); 113 DCHECK(active_);
114 114
115 // Check if we have too many frames in flight. 115 // Check if we have too many frames in flight.
116 bool throttled = 116 bool throttled =
117 max_swaps_pending_ && num_frames_pending_ >= max_swaps_pending_; 117 max_swaps_pending_ && num_frames_pending_ >= max_swaps_pending_;
118 TRACE_COUNTER_ID1("cc", "ThrottledCompositor", task_runner_, throttled); 118 TRACE_COUNTER_ID1("cc", "ThrottledCompositor", task_runner_, throttled);
119 119
120 if (client_) { 120 if (client_) {
121 // TODO(brianderson): Use an adaptive parent compositor deadline. 121 // TODO(brianderson): Use an adaptive parent compositor deadline.
122 base::TimeTicks frame_time = LastTickTime(); 122 base::TimeTicks frame_time = LastTickTime();
123 base::TimeTicks deadline = NextTickTime(); 123 base::TimeTicks deadline = NextTickTime() + interval_;
124 BeginFrameArgs args = 124 BeginFrameArgs args =
125 BeginFrameArgs::Create(frame_time, deadline, interval_); 125 BeginFrameArgs::Create(frame_time, deadline, interval_);
126 args.AdjustDeadline(deadline_adjustment_); 126 args.AdjustDeadline(deadline_adjustment_);
127 client_->FrameRateControllerTick(throttled, args); 127 client_->FrameRateControllerTick(throttled, args);
128 } 128 }
129 129
130 if (!is_time_source_throttling_ && !throttled) 130 if (!is_time_source_throttling_ && !throttled)
131 PostManualTick(); 131 PostManualTick();
132 } 132 }
133 133
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 base::TimeTicks FrameRateController::LastTickTime() { 168 base::TimeTicks FrameRateController::LastTickTime() {
169 if (is_time_source_throttling_) 169 if (is_time_source_throttling_)
170 return time_source_->LastTickTime(); 170 return time_source_->LastTickTime();
171 171
172 return base::TimeTicks::Now(); 172 return base::TimeTicks::Now();
173 } 173 }
174 174
175 } // namespace cc 175 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698