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

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

Issue 23767011: cc: Always use SetNeedsBeginFrame to request the next BeginFrame (Closed) Base URL: http://git.chromium.org/chromium/src.git@pollForDrawTriggers
Patch Set: Created 7 years, 3 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/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 last_begin_frame_args_.interval); 167 last_begin_frame_args_.interval);
168 } 168 }
169 } else { 169 } else {
170 poll_for_draw_triggers_closure_.Cancel(); 170 poll_for_draw_triggers_closure_.Cancel();
171 } 171 }
172 } 172 }
173 173
174 void Scheduler::BeginFrame(const BeginFrameArgs& args) { 174 void Scheduler::BeginFrame(const BeginFrameArgs& args) {
175 TRACE_EVENT0("cc", "Scheduler::BeginFrame"); 175 TRACE_EVENT0("cc", "Scheduler::BeginFrame");
176 DCHECK(!has_pending_begin_frame_); 176 DCHECK(!has_pending_begin_frame_);
177 has_pending_begin_frame_ = true; 177 has_pending_begin_frame_ = true;
danakj 2013/09/12 20:57:29 Can you explain the purpose of this variable then?
brianderson 2013/09/12 21:54:22 I was able to remove the has_pending_begin_frame i
178 last_begin_frame_args_ = args; 178 last_begin_frame_args_ = args;
179 state_machine_.DidEnterBeginFrame(args); 179 state_machine_.DidEnterBeginFrame(args);
180 ProcessScheduledActions(); 180 ProcessScheduledActions();
181 state_machine_.DidLeaveBeginFrame(); 181 state_machine_.DidLeaveBeginFrame();
182 } 182 }
183 183
184 void Scheduler::PollForAnticipatedDrawTriggers() { 184 void Scheduler::PollForAnticipatedDrawTriggers() {
185 TRACE_EVENT0("cc", "Scheduler::PollForAnticipatedDrawTriggers"); 185 TRACE_EVENT0("cc", "Scheduler::PollForAnticipatedDrawTriggers");
186 state_machine_.PollForAnticipatedDrawTriggers(); 186 state_machine_.PollForAnticipatedDrawTriggers();
187 ProcessScheduledActions(); 187 ProcessScheduledActions();
188 } 188 }
189 189
190 void Scheduler::DrawAndSwapIfPossible() { 190 void Scheduler::DrawAndSwapIfPossible() {
191 DrawSwapReadbackResult result = 191 DrawSwapReadbackResult result =
192 client_->ScheduledActionDrawAndSwapIfPossible(); 192 client_->ScheduledActionDrawAndSwapIfPossible();
193 state_machine_.DidDrawIfPossibleCompleted(result.did_draw); 193 state_machine_.DidDrawIfPossibleCompleted(result.did_draw);
194 if (result.did_swap)
195 has_pending_begin_frame_ = false;
196 } 194 }
197 195
198 void Scheduler::DrawAndSwapForced() { 196 void Scheduler::DrawAndSwapForced() {
199 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndSwapForced(); 197 client_->ScheduledActionDrawAndSwapForced();
200 if (result.did_swap)
201 has_pending_begin_frame_ = false;
202 } 198 }
203 199
204 void Scheduler::DrawAndReadback() { 200 void Scheduler::DrawAndReadback() {
205 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback(); 201 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback();
206 DCHECK(!result.did_swap); 202 DCHECK(!result.did_swap);
207 } 203 }
208 204
209 void Scheduler::ProcessScheduledActions() { 205 void Scheduler::ProcessScheduledActions() {
210 // We do not allow ProcessScheduledActions to be recursive. 206 // We do not allow ProcessScheduledActions to be recursive.
211 // The top-level call will iteratively execute the next action for us anyway. 207 // The top-level call will iteratively execute the next action for us anyway.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 258
263 SetupNextBeginFrameIfNeeded(); 259 SetupNextBeginFrameIfNeeded();
264 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); 260 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());
265 } 261 }
266 262
267 bool Scheduler::WillDrawIfNeeded() const { 263 bool Scheduler::WillDrawIfNeeded() const {
268 return !state_machine_.PendingDrawsShouldBeAborted(); 264 return !state_machine_.PendingDrawsShouldBeAborted();
269 } 265 }
270 266
271 } // namespace cc 267 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698