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

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

Issue 22926024: cc: Control activation from the Scheduler (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedOutputSurface4
Patch Set: kill has_active_tree_ 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_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) 14 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
15 : settings_(settings), 15 : settings_(settings),
16 output_surface_state_(OUTPUT_SURFACE_LOST), 16 output_surface_state_(OUTPUT_SURFACE_LOST),
17 commit_state_(COMMIT_STATE_IDLE), 17 commit_state_(COMMIT_STATE_IDLE),
18 commit_count_(0), 18 commit_count_(0),
19 current_frame_number_(0), 19 current_frame_number_(0),
20 last_frame_number_where_begin_frame_sent_to_main_thread_(-1), 20 last_frame_number_where_begin_frame_sent_to_main_thread_(-1),
21 last_frame_number_where_draw_was_called_(-1), 21 last_frame_number_where_draw_was_called_(-1),
22 last_frame_number_where_tree_activation_attempted_(-1),
23 last_frame_number_where_update_visible_tiles_was_called_(-1), 22 last_frame_number_where_update_visible_tiles_was_called_(-1),
24 consecutive_failed_draws_(0), 23 consecutive_failed_draws_(0),
25 maximum_number_of_failed_draws_before_draw_is_forced_(3), 24 maximum_number_of_failed_draws_before_draw_is_forced_(3),
26 needs_redraw_(false), 25 needs_redraw_(false),
27 swap_used_incomplete_tile_(false), 26 swap_used_incomplete_tile_(false),
28 needs_forced_redraw_(false), 27 needs_forced_redraw_(false),
29 needs_forced_redraw_after_next_commit_(false), 28 needs_forced_redraw_after_next_commit_(false),
30 needs_commit_(false), 29 needs_commit_(false),
31 needs_forced_commit_(false), 30 needs_forced_commit_(false),
32 expect_immediate_begin_frame_for_main_thread_(false), 31 expect_immediate_begin_frame_for_main_thread_(false),
33 main_thread_needs_layer_textures_(false), 32 main_thread_needs_layer_textures_(false),
34 inside_begin_frame_(false), 33 inside_begin_frame_(false),
35 visible_(false), 34 visible_(false),
36 can_start_(false), 35 can_start_(false),
37 can_draw_(false), 36 can_draw_(false),
38 has_pending_tree_(false), 37 has_pending_tree_(false),
38 pending_tree_is_ready_for_activation_(false),
39 active_tree_has_been_drawn_(false),
39 draw_if_possible_failed_(false), 40 draw_if_possible_failed_(false),
40 texture_state_(LAYER_TEXTURE_STATE_UNLOCKED), 41 texture_state_(LAYER_TEXTURE_STATE_UNLOCKED),
41 did_create_and_initialize_first_output_surface_(false) {} 42 did_create_and_initialize_first_output_surface_(false) {}
42 43
43 const char* SchedulerStateMachine::OutputSurfaceStateToString( 44 const char* SchedulerStateMachine::OutputSurfaceStateToString(
44 OutputSurfaceState state) { 45 OutputSurfaceState state) {
45 switch (state) { 46 switch (state) {
46 case OUTPUT_SURFACE_ACTIVE: 47 case OUTPUT_SURFACE_ACTIVE:
47 return "OUTPUT_SURFACE_ACTIVE"; 48 return "OUTPUT_SURFACE_ACTIVE";
48 case OUTPUT_SURFACE_LOST: 49 case OUTPUT_SURFACE_LOST:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const char* SchedulerStateMachine::ActionToString(Action action) { 92 const char* SchedulerStateMachine::ActionToString(Action action) {
92 switch (action) { 93 switch (action) {
93 case ACTION_NONE: 94 case ACTION_NONE:
94 return "ACTION_NONE"; 95 return "ACTION_NONE";
95 case ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: 96 case ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD:
96 return "ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD"; 97 return "ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD";
97 case ACTION_COMMIT: 98 case ACTION_COMMIT:
98 return "ACTION_COMMIT"; 99 return "ACTION_COMMIT";
99 case ACTION_UPDATE_VISIBLE_TILES: 100 case ACTION_UPDATE_VISIBLE_TILES:
100 return "ACTION_UPDATE_VISIBLE_TILES"; 101 return "ACTION_UPDATE_VISIBLE_TILES";
101 case ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED: 102 case ACTION_ACTIVATE_PENDING_TREE:
102 return "ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED"; 103 return "ACTION_ACTIVATE_PENDING_TREE";
103 case ACTION_DRAW_IF_POSSIBLE: 104 case ACTION_DRAW_IF_POSSIBLE:
104 return "ACTION_DRAW_IF_POSSIBLE"; 105 return "ACTION_DRAW_IF_POSSIBLE";
105 case ACTION_DRAW_FORCED: 106 case ACTION_DRAW_FORCED:
106 return "ACTION_DRAW_FORCED"; 107 return "ACTION_DRAW_FORCED";
107 case ACTION_DRAW_AND_SWAP_ABORT: 108 case ACTION_DRAW_AND_SWAP_ABORT:
108 return "ACTION_DRAW_AND_SWAP_ABORT"; 109 return "ACTION_DRAW_AND_SWAP_ABORT";
109 case ACTION_BEGIN_OUTPUT_SURFACE_CREATION: 110 case ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
110 return "ACTION_BEGIN_OUTPUT_SURFACE_CREATION"; 111 return "ACTION_BEGIN_OUTPUT_SURFACE_CREATION";
111 case ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: 112 case ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD:
112 return "ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD"; 113 return "ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 state->Set("major_timestamps_in_ms", timestamps_state.release()); 156 state->Set("major_timestamps_in_ms", timestamps_state.release());
156 157
157 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue); 158 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue);
158 minor_state->SetInteger("commit_count", commit_count_); 159 minor_state->SetInteger("commit_count", commit_count_);
159 minor_state->SetInteger("current_frame_number", current_frame_number_); 160 minor_state->SetInteger("current_frame_number", current_frame_number_);
160 minor_state->SetInteger( 161 minor_state->SetInteger(
161 "last_frame_number_where_begin_frame_sent_to_main_thread", 162 "last_frame_number_where_begin_frame_sent_to_main_thread",
162 last_frame_number_where_begin_frame_sent_to_main_thread_); 163 last_frame_number_where_begin_frame_sent_to_main_thread_);
163 minor_state->SetInteger("last_frame_number_where_draw_was_called", 164 minor_state->SetInteger("last_frame_number_where_draw_was_called",
164 last_frame_number_where_draw_was_called_); 165 last_frame_number_where_draw_was_called_);
165 minor_state->SetInteger("last_frame_number_where_tree_activation_attempted",
166 last_frame_number_where_tree_activation_attempted_);
167 minor_state->SetInteger( 166 minor_state->SetInteger(
168 "last_frame_number_where_update_visible_tiles_was_called", 167 "last_frame_number_where_update_visible_tiles_was_called",
169 last_frame_number_where_update_visible_tiles_was_called_); 168 last_frame_number_where_update_visible_tiles_was_called_);
170 minor_state->SetInteger("consecutive_failed_draws", 169 minor_state->SetInteger("consecutive_failed_draws",
171 consecutive_failed_draws_); 170 consecutive_failed_draws_);
172 minor_state->SetInteger( 171 minor_state->SetInteger(
173 "maximum_number_of_failed_draws_before_draw_is_forced", 172 "maximum_number_of_failed_draws_before_draw_is_forced",
174 maximum_number_of_failed_draws_before_draw_is_forced_); 173 maximum_number_of_failed_draws_before_draw_is_forced_);
175 minor_state->SetBoolean("needs_redraw", needs_redraw_); 174 minor_state->SetBoolean("needs_redraw", needs_redraw_);
176 minor_state->SetBoolean("swap_used_incomplete_tile", 175 minor_state->SetBoolean("swap_used_incomplete_tile",
177 swap_used_incomplete_tile_); 176 swap_used_incomplete_tile_);
178 minor_state->SetBoolean("needs_forced_redraw", needs_forced_redraw_); 177 minor_state->SetBoolean("needs_forced_redraw", needs_forced_redraw_);
179 minor_state->SetBoolean("needs_forced_redraw_after_next_commit", 178 minor_state->SetBoolean("needs_forced_redraw_after_next_commit",
180 needs_forced_redraw_after_next_commit_); 179 needs_forced_redraw_after_next_commit_);
181 minor_state->SetBoolean("needs_commit", needs_commit_); 180 minor_state->SetBoolean("needs_commit", needs_commit_);
182 minor_state->SetBoolean("needs_forced_commit", needs_forced_commit_); 181 minor_state->SetBoolean("needs_forced_commit", needs_forced_commit_);
183 minor_state->SetBoolean("expect_immediate_begin_frame_for_main_thread", 182 minor_state->SetBoolean("expect_immediate_begin_frame_for_main_thread",
184 expect_immediate_begin_frame_for_main_thread_); 183 expect_immediate_begin_frame_for_main_thread_);
185 minor_state->SetBoolean("main_thread_needs_layer_textures", 184 minor_state->SetBoolean("main_thread_needs_layer_textures",
186 main_thread_needs_layer_textures_); 185 main_thread_needs_layer_textures_);
187 minor_state->SetBoolean("inside_begin_frame", inside_begin_frame_); 186 minor_state->SetBoolean("inside_begin_frame", inside_begin_frame_);
188 minor_state->SetBoolean("visible", visible_); 187 minor_state->SetBoolean("visible", visible_);
189 minor_state->SetBoolean("can_start", can_start_); 188 minor_state->SetBoolean("can_start", can_start_);
190 minor_state->SetBoolean("can_draw", can_draw_); 189 minor_state->SetBoolean("can_draw", can_draw_);
191 minor_state->SetBoolean("has_pending_tree", has_pending_tree_); 190 minor_state->SetBoolean("has_pending_tree", has_pending_tree_);
191 minor_state->SetBoolean("pending_tree_is_ready_for_activation_",
192 pending_tree_is_ready_for_activation_);
193 minor_state->SetBoolean("active_tree_has_been_drawn_",
194 active_tree_has_been_drawn_);
192 minor_state->SetBoolean("draw_if_possible_failed", draw_if_possible_failed_); 195 minor_state->SetBoolean("draw_if_possible_failed", draw_if_possible_failed_);
193 minor_state->SetBoolean("did_create_and_initialize_first_output_surface", 196 minor_state->SetBoolean("did_create_and_initialize_first_output_surface",
194 did_create_and_initialize_first_output_surface_); 197 did_create_and_initialize_first_output_surface_);
195 state->Set("minor_state", minor_state.release()); 198 state->Set("minor_state", minor_state.release());
196 199
197 return state.PassAs<base::Value>(); 200 return state.PassAs<base::Value>();
198 } 201 }
199 202
200 bool SchedulerStateMachine::HasDrawnThisFrame() const { 203 bool SchedulerStateMachine::HasDrawnThisFrame() const {
201 return current_frame_number_ == last_frame_number_where_draw_was_called_; 204 return current_frame_number_ == last_frame_number_where_draw_was_called_;
202 } 205 }
203 206
204 bool SchedulerStateMachine::HasAttemptedTreeActivationThisFrame() const {
205 return current_frame_number_ ==
206 last_frame_number_where_tree_activation_attempted_;
207 }
208
209 bool SchedulerStateMachine::HasUpdatedVisibleTilesThisFrame() const { 207 bool SchedulerStateMachine::HasUpdatedVisibleTilesThisFrame() const {
210 return current_frame_number_ == 208 return current_frame_number_ ==
211 last_frame_number_where_update_visible_tiles_was_called_; 209 last_frame_number_where_update_visible_tiles_was_called_;
212 } 210 }
213 211
214 bool SchedulerStateMachine::HasSentBeginFrameToMainThreadThisFrame() const { 212 bool SchedulerStateMachine::HasSentBeginFrameToMainThreadThisFrame() const {
215 return current_frame_number_ == 213 return current_frame_number_ ==
216 last_frame_number_where_begin_frame_sent_to_main_thread_; 214 last_frame_number_where_begin_frame_sent_to_main_thread_;
217 } 215 }
218 216
219 void SchedulerStateMachine::HandleCommitInternal(bool commit_was_aborted) {
220 commit_count_++;
221
222 // If we are impl-side-painting but the commit was aborted, then we behave
223 // mostly as if we are not impl-side-painting since there is no pending tree.
224 bool commit_results_in_pending_tree =
225 settings_.impl_side_painting && !commit_was_aborted;
226
227 // Update the commit state.
228 if (expect_immediate_begin_frame_for_main_thread_)
229 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW;
230 else if (!commit_was_aborted)
231 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW;
232 else
233 commit_state_ = COMMIT_STATE_IDLE;
234
235 // Update the output surface state.
236 DCHECK_NE(output_surface_state_,
237 OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION);
238 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) {
239 if (commit_results_in_pending_tree) {
240 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION;
241 } else {
242 output_surface_state_ = OUTPUT_SURFACE_ACTIVE;
243 needs_redraw_ = true;
244 }
245 }
246
247 // if we don't have to wait for activation, update needs_redraw now.
248 if (!commit_results_in_pending_tree) {
249 if (!commit_was_aborted)
250 needs_redraw_ = true;
251 if (expect_immediate_begin_frame_for_main_thread_)
252 needs_redraw_ = true;
253 }
254
255 // This post-commit work is common to both completed and aborted commits.
256 if (draw_if_possible_failed_)
257 last_frame_number_where_draw_was_called_ = -1;
258
259 if (needs_forced_redraw_after_next_commit_) {
260 needs_forced_redraw_after_next_commit_ = false;
261 needs_forced_redraw_ = true;
262 }
263
264 // If we are planing to draw with the new commit, lock the layer textures for
265 // use on the impl thread. Otherwise, leave them unlocked.
266 if (commit_results_in_pending_tree || needs_redraw_ || needs_forced_redraw_)
267 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD;
268 else
269 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED;
270 }
271
272 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const { 217 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const {
273 // These are all the cases where, if we do not abort draws to make 218 // These are all the cases where, if we do not abort draws to make
danakj 2013/08/27 00:59:12 "if we do not perform aborted draws while needs_re
brianderson 2013/08/27 01:45:37 Done.
274 // forward progress, we might deadlock with the main thread. 219 // forward progress, we might deadlock with the main thread.
220 // This should be a superset of PendingActivationsShouldBeForced() since
221 // activation of the pending tree is blocked by drawing of the active tree.
222 if (PendingActivationsShouldBeForced())
223 return true;
224
225 // Additional states where we should abort draws.
226 // Note: We don't force activation in these cases because doing so would
227 // result in checkerboarding on resize, becoming visible, etc.
275 if (!can_draw_) 228 if (!can_draw_)
276 return true; 229 return true;
277 if (!visible_) 230 if (!visible_)
278 return true; 231 return true;
279 if (output_surface_state_ != OUTPUT_SURFACE_ACTIVE) 232 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION)
280 return true;
281 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD)
282 return true; 233 return true;
283 return false; 234 return false;
284 } 235 }
285 236
237 bool SchedulerStateMachine::PendingActivationsShouldBeForced() const {
238 // These are all the cases where, if we do not force activations to make
239 // forward progress, we might deadlock with the main thread.
240 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD)
241 return true;
242 if (output_surface_state_ == OUTPUT_SURFACE_LOST ||
243 output_surface_state_ == OUTPUT_SURFACE_CREATING ||
244 output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT)
245 return true;
246 return false;
247 }
248
249 bool SchedulerStateMachine::ShouldBeginOutputSurfaceCreation() const {
250 // Don't try to initialize too early.
251 if (!can_start_)
252 return false;
253
254 // We need to create the output surface if we don't have one and we haven't
255 // started creating one yet.
256 return output_surface_state_ == OUTPUT_SURFACE_LOST;
257 }
258
286 bool SchedulerStateMachine::ShouldDraw() const { 259 bool SchedulerStateMachine::ShouldDraw() const {
260 // We should not draw or abort draws while we are waiting for the
261 // first activation. Doing so will cause us to transition to
262 // COMMIT_STATE_IDLE and start the 2nd commit before the 1st commit
263 // has been drawn. It will also cause us to fail readbacks when we could
264 // have succeeded by waiting a little longer.
265 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION)
266 return false;
267
268 // When we are waiting for a forced draw, only force draw once
269 // needs_forced_redraw_ is true.
270 if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW)
271 return needs_forced_redraw_;
272
287 // Always handle forced draws ASAP. 273 // Always handle forced draws ASAP.
288 if (needs_forced_redraw_) 274 if (needs_forced_redraw_)
289 return true; 275 return true;
290 276
291 // If we are going to abort draws, we should do so ASAP. 277 // If we are going to abort draws, we should do so ASAP.
danakj 2013/08/27 00:59:12 "...we should do so ASAP. If we're waiting for the
brianderson 2013/08/27 01:45:37 Done.
292 if (PendingDrawsShouldBeAborted()) { 278 if (PendingDrawsShouldBeAborted())
293 // TODO(brianderson): Remove the !has_pending_tree_ condition once 279 return commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW;
294 // the Scheduler controls activation. It's dangerous for us to rely on
295 // an eventual activation if we've lost the output surface.
296 return commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW &&
297 !has_pending_tree_;
298 }
299 280
300 // After this line, we only want to draw once per frame. 281 // After this line, we only want to draw once per frame.
301 if (HasDrawnThisFrame()) 282 if (HasDrawnThisFrame())
302 return false; 283 return false;
303 284
304 // We currently only draw within the BeginFrame. 285 // We currently only draw within the BeginFrame.
305 if (!inside_begin_frame_) 286 if (!inside_begin_frame_)
306 return false; 287 return false;
307 288
308 return needs_redraw_; 289 return needs_redraw_;
309 } 290 }
310 291
311 bool SchedulerStateMachine::ShouldAttemptTreeActivation() const { 292 bool SchedulerStateMachine::ShouldAcquireLayerTexturesForMainThread() const {
312 return has_pending_tree_ && inside_begin_frame_ && 293 if (!main_thread_needs_layer_textures_)
313 !HasAttemptedTreeActivationThisFrame(); 294 return false;
295 if (texture_state_ == LAYER_TEXTURE_STATE_UNLOCKED)
296 return true;
297 DCHECK_EQ(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD);
298 return false;
299 }
300
301 bool SchedulerStateMachine::ShouldActivatePendingTree() const {
302 // There is nothing to activate.
303 if (!has_pending_tree_)
304 return false;
305
306 // We don't want to activate a second tree before drawing the first one.
307 // Note: It is possible that there is no active tree to draw when
308 // output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION,
309 // so we don't block activation on draw in that case.
310 if (!active_tree_has_been_drawn_ &&
311 output_surface_state_ != OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION)
danakj 2013/08/27 01:24:02 What if the active tree hasn't been drawn because
brianderson 2013/08/27 01:45:37 It is true that the draw will be aborted to unbloc
danakj 2013/08/27 02:03:47 Ah, so it's like PendingDrawsShouldBeAborted() ==
312 return false;
313
314 // If we want to force activation, do so ASAP.
315 if (PendingActivationsShouldBeForced())
316 return true;
317
318 // At this point, only activate if we are ready to activate.
319 return pending_tree_is_ready_for_activation_;
314 } 320 }
315 321
316 bool SchedulerStateMachine::ShouldUpdateVisibleTiles() const { 322 bool SchedulerStateMachine::ShouldUpdateVisibleTiles() const {
317 if (!settings_.impl_side_painting) 323 if (!settings_.impl_side_painting)
318 return false; 324 return false;
319 if (HasUpdatedVisibleTilesThisFrame()) 325 if (HasUpdatedVisibleTilesThisFrame())
320 return false; 326 return false;
321 327
322 return ShouldAttemptTreeActivation() || ShouldDraw() || 328 // There's no reason to check for tiles if we don't have an output surface.
329 if (!HasInitializedOutputSurface())
330 return false;
331
332 return ShouldActivatePendingTree() || ShouldDraw() ||
danakj 2013/08/27 01:24:02 Can you comment explaining why these bools are use
brianderson 2013/08/27 01:45:37 Thanks for making me do this exercise! ShouldActiv
323 swap_used_incomplete_tile_; 333 swap_used_incomplete_tile_;
324 } 334 }
325 335
326 bool SchedulerStateMachine::ShouldSendBeginFrameToMainThread() const { 336 bool SchedulerStateMachine::ShouldSendBeginFrameToMainThread() const {
327 if (!needs_commit_) 337 if (!needs_commit_)
328 return false; 338 return false;
329 339
330 // Only send BeginFrame to the main thread when idle. 340 // Only send BeginFrame to the main thread when idle.
331 if (commit_state_ != COMMIT_STATE_IDLE) 341 if (commit_state_ != COMMIT_STATE_IDLE)
332 return false; 342 return false;
(...skipping 19 matching lines...) Expand all
352 if (!visible_) 362 if (!visible_)
353 return false; 363 return false;
354 364
355 // We shouldn't normally accept commits if there isn't an OutputSurface. 365 // We shouldn't normally accept commits if there isn't an OutputSurface.
356 if (!HasInitializedOutputSurface()) 366 if (!HasInitializedOutputSurface())
357 return false; 367 return false;
358 368
359 return true; 369 return true;
360 } 370 }
361 371
362 bool SchedulerStateMachine::ShouldAcquireLayerTexturesForMainThread() const {
363 if (!main_thread_needs_layer_textures_)
364 return false;
365 if (texture_state_ == LAYER_TEXTURE_STATE_UNLOCKED)
366 return true;
367 DCHECK_EQ(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD);
368 return false;
369 }
370
371 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const { 372 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
372 if (ShouldAcquireLayerTexturesForMainThread()) 373 if (ShouldAcquireLayerTexturesForMainThread())
373 return ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD; 374 return ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD;
374 375
375 switch (commit_state_) { 376 switch (commit_state_) {
376 case COMMIT_STATE_IDLE: { 377 case COMMIT_STATE_IDLE:
377 if (output_surface_state_ != OUTPUT_SURFACE_ACTIVE &&
378 needs_forced_redraw_)
379 return ACTION_DRAW_FORCED;
380 if (output_surface_state_ != OUTPUT_SURFACE_ACTIVE &&
381 needs_forced_commit_)
382 // TODO(enne): Should probably drop the active tree on force commit.
383 return has_pending_tree_ ? ACTION_NONE
384 : ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD;
385 if (output_surface_state_ == OUTPUT_SURFACE_LOST && can_start_)
386 return ACTION_BEGIN_OUTPUT_SURFACE_CREATION;
387 if (output_surface_state_ == OUTPUT_SURFACE_CREATING)
388 return ACTION_NONE;
389 if (ShouldUpdateVisibleTiles()) 378 if (ShouldUpdateVisibleTiles())
390 return ACTION_UPDATE_VISIBLE_TILES; 379 return ACTION_UPDATE_VISIBLE_TILES;
391 if (ShouldAttemptTreeActivation()) 380 if (ShouldActivatePendingTree())
392 return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED; 381 return ACTION_ACTIVATE_PENDING_TREE;
393 if (ShouldDraw()) { 382 if (ShouldDraw()) {
394 return needs_forced_redraw_ ? ACTION_DRAW_FORCED 383 return needs_forced_redraw_ ? ACTION_DRAW_FORCED
395 : ACTION_DRAW_IF_POSSIBLE; 384 : ACTION_DRAW_IF_POSSIBLE;
396 } 385 }
397 if (ShouldSendBeginFrameToMainThread()) 386 if (ShouldSendBeginFrameToMainThread())
398 return ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD; 387 return ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD;
388 if (ShouldBeginOutputSurfaceCreation())
389 return ACTION_BEGIN_OUTPUT_SURFACE_CREATION;
399 return ACTION_NONE; 390 return ACTION_NONE;
400 } 391
401 case COMMIT_STATE_FRAME_IN_PROGRESS: 392 case COMMIT_STATE_FRAME_IN_PROGRESS:
402 if (ShouldUpdateVisibleTiles()) 393 if (ShouldUpdateVisibleTiles())
403 return ACTION_UPDATE_VISIBLE_TILES; 394 return ACTION_UPDATE_VISIBLE_TILES;
404 if (ShouldAttemptTreeActivation()) 395 if (ShouldActivatePendingTree())
405 return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED; 396 return ACTION_ACTIVATE_PENDING_TREE;
406 if (ShouldDraw()) { 397 if (ShouldDraw()) {
407 return needs_forced_redraw_ ? ACTION_DRAW_FORCED 398 return needs_forced_redraw_ ? ACTION_DRAW_FORCED
408 : ACTION_DRAW_IF_POSSIBLE; 399 : ACTION_DRAW_IF_POSSIBLE;
409 } 400 }
410 return ACTION_NONE; 401 return ACTION_NONE;
411 402
412 case COMMIT_STATE_READY_TO_COMMIT: 403 case COMMIT_STATE_READY_TO_COMMIT:
413 return ACTION_COMMIT; 404 return ACTION_COMMIT;
414 405
415 case COMMIT_STATE_WAITING_FOR_FIRST_DRAW: { 406 case COMMIT_STATE_WAITING_FOR_FIRST_DRAW:
416 if (ShouldUpdateVisibleTiles()) 407 if (ShouldUpdateVisibleTiles())
417 return ACTION_UPDATE_VISIBLE_TILES; 408 return ACTION_UPDATE_VISIBLE_TILES;
418 if (ShouldAttemptTreeActivation()) 409 if (ShouldActivatePendingTree())
419 return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED; 410 return ACTION_ACTIVATE_PENDING_TREE;
420 if (ShouldDraw()) { 411 if (ShouldDraw()) {
421 if (needs_forced_redraw_) 412 if (needs_forced_redraw_)
422 return ACTION_DRAW_FORCED; 413 return ACTION_DRAW_FORCED;
423 else if (PendingDrawsShouldBeAborted()) 414 else if (PendingDrawsShouldBeAborted())
424 return ACTION_DRAW_AND_SWAP_ABORT; 415 return ACTION_DRAW_AND_SWAP_ABORT;
425 else 416 else
426 return ACTION_DRAW_IF_POSSIBLE; 417 return ACTION_DRAW_IF_POSSIBLE;
427 } 418 }
428 return ACTION_NONE; 419 return ACTION_NONE;
429 }
430 420
431 case COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW: 421 case COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW:
432 if (ShouldUpdateVisibleTiles()) 422 if (ShouldUpdateVisibleTiles())
433 return ACTION_UPDATE_VISIBLE_TILES; 423 return ACTION_UPDATE_VISIBLE_TILES;
434 if (ShouldAttemptTreeActivation()) 424 if (ShouldActivatePendingTree())
435 return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED; 425 return ACTION_ACTIVATE_PENDING_TREE;
436 if (needs_forced_redraw_) 426 if (ShouldDraw())
437 return ACTION_DRAW_FORCED; 427 return ACTION_DRAW_FORCED;
438 return ACTION_NONE; 428 return ACTION_NONE;
439 } 429 }
440 NOTREACHED(); 430 NOTREACHED();
441 return ACTION_NONE; 431 return ACTION_NONE;
442 } 432 }
443 433
444 void SchedulerStateMachine::UpdateState(Action action) { 434 void SchedulerStateMachine::UpdateState(Action action) {
445 switch (action) { 435 switch (action) {
446 case ACTION_NONE: 436 case ACTION_NONE:
447 return; 437 return;
448 438
449 case ACTION_UPDATE_VISIBLE_TILES: 439 case ACTION_UPDATE_VISIBLE_TILES:
450 last_frame_number_where_update_visible_tiles_was_called_ = 440 last_frame_number_where_update_visible_tiles_was_called_ =
451 current_frame_number_; 441 current_frame_number_;
452 return; 442 return;
453 443
454 case ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED: 444 case ACTION_ACTIVATE_PENDING_TREE:
455 last_frame_number_where_tree_activation_attempted_ = 445 UpdateStateOnActivation();
456 current_frame_number_;
457 return; 446 return;
458 447
459 case ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: 448 case ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD:
460 DCHECK(!has_pending_tree_); 449 DCHECK(!has_pending_tree_);
461 if (!needs_forced_commit_ && 450 if (!needs_forced_commit_ &&
462 output_surface_state_ != OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) { 451 output_surface_state_ != OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) {
463 DCHECK(visible_); 452 DCHECK(visible_);
464 DCHECK_GT(current_frame_number_, 453 DCHECK_GT(current_frame_number_,
465 last_frame_number_where_begin_frame_sent_to_main_thread_); 454 last_frame_number_where_begin_frame_sent_to_main_thread_);
466 } 455 }
467 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS; 456 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS;
468 needs_commit_ = false; 457 needs_commit_ = false;
469 needs_forced_commit_ = false; 458 needs_forced_commit_ = false;
470 last_frame_number_where_begin_frame_sent_to_main_thread_ = 459 last_frame_number_where_begin_frame_sent_to_main_thread_ =
471 current_frame_number_; 460 current_frame_number_;
472 return; 461 return;
473 462
474 case ACTION_COMMIT: { 463 case ACTION_COMMIT: {
475 bool commit_was_aborted = false; 464 bool commit_was_aborted = false;
476 HandleCommitInternal(commit_was_aborted); 465 UpdateStateOnCommit(commit_was_aborted);
477 return; 466 return;
478 } 467 }
479 468
480 case ACTION_DRAW_FORCED: 469 case ACTION_DRAW_FORCED:
481 case ACTION_DRAW_IF_POSSIBLE: { 470 case ACTION_DRAW_IF_POSSIBLE: {
482 bool did_swap = true; 471 bool did_swap = true;
483 UpdateStateOnDraw(did_swap); 472 UpdateStateOnDraw(did_swap);
484 return; 473 return;
485 } 474 }
486 475
487 case ACTION_DRAW_AND_SWAP_ABORT: { 476 case ACTION_DRAW_AND_SWAP_ABORT: {
488 bool did_swap = false; 477 bool did_swap = false;
489 UpdateStateOnDraw(did_swap); 478 UpdateStateOnDraw(did_swap);
490 return; 479 return;
491 } 480 }
492 481
493 case ACTION_BEGIN_OUTPUT_SURFACE_CREATION: 482 case ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
494 DCHECK_EQ(commit_state_, COMMIT_STATE_IDLE); 483 DCHECK_EQ(commit_state_, COMMIT_STATE_IDLE);
495 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_LOST); 484 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_LOST);
496 output_surface_state_ = OUTPUT_SURFACE_CREATING; 485 output_surface_state_ = OUTPUT_SURFACE_CREATING;
497 return; 486 return;
498 487
499 case ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: 488 case ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD:
500 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD; 489 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD;
501 main_thread_needs_layer_textures_ = false; 490 main_thread_needs_layer_textures_ = false;
502 return; 491 return;
503 } 492 }
504 } 493 }
505 494
495 void SchedulerStateMachine::UpdateStateOnCommit(bool commit_was_aborted) {
496 commit_count_++;
497
498 // If we are impl-side-painting but the commit was aborted, then we behave
499 // mostly as if we are not impl-side-painting since there is no pending tree.
500 has_pending_tree_ =
501 settings_.impl_side_painting && !commit_was_aborted;
502
503 // Update the commit state.
504 if (expect_immediate_begin_frame_for_main_thread_)
505 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW;
506 else if (!commit_was_aborted)
507 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW;
508 else
509 commit_state_ = COMMIT_STATE_IDLE;
510
511 // Update the output surface state.
512 DCHECK_NE(output_surface_state_,
513 OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION);
514 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) {
515 if (has_pending_tree_) {
516 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION;
517 } else {
518 output_surface_state_ = OUTPUT_SURFACE_ACTIVE;
519 needs_redraw_ = true;
520 }
521 }
522
523 // Update state if we have a new active tree to draw.
danakj 2013/08/27 01:24:02 , or the active tree was unchanged but we're going
brianderson 2013/08/27 01:45:37 Done.
524 if (!has_pending_tree_ &&
525 (!commit_was_aborted || expect_immediate_begin_frame_for_main_thread_)) {
526 needs_redraw_ = true;
danakj 2013/08/27 01:24:02 2 space indent
brianderson 2013/08/27 01:45:37 Done.
527 active_tree_has_been_drawn_ = false;
528 }
529
530 // This post-commit work is common to both completed and aborted commits.
531 pending_tree_is_ready_for_activation_ = false;
532
533 if (draw_if_possible_failed_)
534 last_frame_number_where_draw_was_called_ = -1;
535
536 if (needs_forced_redraw_after_next_commit_) {
537 needs_forced_redraw_after_next_commit_ = false;
538 needs_forced_redraw_ = true;
539 }
540
541 // If we are planing to draw with the new commit, lock the layer textures for
542 // use on the impl thread. Otherwise, leave them unlocked.
543 if (has_pending_tree_ || needs_redraw_ || needs_forced_redraw_)
544 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD;
545 else
546 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED;
547 }
548
549 void SchedulerStateMachine::UpdateStateOnActivation() {
550 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION)
551 output_surface_state_ = OUTPUT_SURFACE_ACTIVE;
552
553 has_pending_tree_ = false;
554 pending_tree_is_ready_for_activation_ = false;
555 active_tree_has_been_drawn_ = false;
556 needs_redraw_ = true;
557 }
558
506 void SchedulerStateMachine::UpdateStateOnDraw(bool did_swap) { 559 void SchedulerStateMachine::UpdateStateOnDraw(bool did_swap) {
507 if (inside_begin_frame_) 560 if (inside_begin_frame_)
508 last_frame_number_where_draw_was_called_ = current_frame_number_; 561 last_frame_number_where_draw_was_called_ = current_frame_number_;
509 if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW) { 562 if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW) {
510 DCHECK(expect_immediate_begin_frame_for_main_thread_); 563 DCHECK(expect_immediate_begin_frame_for_main_thread_);
511 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS; 564 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS;
512 expect_immediate_begin_frame_for_main_thread_ = false; 565 expect_immediate_begin_frame_for_main_thread_ = false;
513 } else if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) { 566 } else if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) {
514 commit_state_ = COMMIT_STATE_IDLE; 567 commit_state_ = COMMIT_STATE_IDLE;
515 } 568 }
516 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD) 569 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD)
517 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED; 570 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED;
518 571
519 needs_redraw_ = false; 572 needs_redraw_ = false;
520 needs_forced_redraw_ = false; 573 needs_forced_redraw_ = false;
521 draw_if_possible_failed_ = false; 574 draw_if_possible_failed_ = false;
575 active_tree_has_been_drawn_ = true;
522 576
523 if (did_swap) 577 if (did_swap)
524 swap_used_incomplete_tile_ = false; 578 swap_used_incomplete_tile_ = false;
525 } 579 }
526 580
527 void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() { 581 void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() {
528 DCHECK(!main_thread_needs_layer_textures_); 582 DCHECK(!main_thread_needs_layer_textures_);
529 DCHECK_NE(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); 583 DCHECK_NE(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD);
530 main_thread_needs_layer_textures_ = true; 584 main_thread_needs_layer_textures_ = true;
531 } 585 }
532 586
533 bool SchedulerStateMachine::BeginFrameNeededToDrawByImplThread() const { 587 bool SchedulerStateMachine::BeginFrameNeededToDrawByImplThread() const {
534 // TODO(brianderson): Remove this hack once the Scheduler controls activation,
535 // otherwise we can get stuck in OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION.
536 // It lies that we actually need to draw, but we won't actually draw
537 // if we can't. This will cause WebView to potentially have corruption
538 // in the first few frames, but this workaround is being removed soon.
539 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION)
540 return true;
541
542 // If we can't draw, don't tick until we are notified that we can draw again. 588 // If we can't draw, don't tick until we are notified that we can draw again.
543 if (!can_draw_) 589 if (!can_draw_)
544 return false; 590 return false;
545 591
546 if (needs_forced_redraw_) 592 if (needs_forced_redraw_)
547 return true; 593 return true;
548 594
549 if (visible_ && swap_used_incomplete_tile_) 595 if (visible_ && swap_used_incomplete_tile_)
550 return true; 596 return true;
551 597
552 return needs_redraw_ && visible_ && HasInitializedOutputSurface(); 598 return needs_redraw_ && visible_ && HasInitializedOutputSurface();
553 } 599 }
554 600
555 bool SchedulerStateMachine::ProactiveBeginFrameWantedByImplThread() const { 601 bool SchedulerStateMachine::ProactiveBeginFrameWantedByImplThread() const {
556 // Do not be proactive when invisible. 602 // Do not be proactive when invisible.
danakj 2013/08/27 01:24:02 can you update this comment to explain the output
brianderson 2013/08/27 01:45:37 Done.
557 if (!visible_ || output_surface_state_ != OUTPUT_SURFACE_ACTIVE) 603 if (!visible_ || !HasInitializedOutputSurface())
558 return false; 604 return false;
559 605
560 // We should proactively request a BeginFrame if a commit or a tree activation 606 // We should proactively request a BeginFrame if a commit or a tree activation
561 // is pending. 607 // is pending.
562 return (needs_commit_ || needs_forced_commit_ || 608 return (needs_commit_ || needs_forced_commit_ ||
563 commit_state_ != COMMIT_STATE_IDLE || has_pending_tree_); 609 commit_state_ != COMMIT_STATE_IDLE || has_pending_tree_);
564 } 610 }
565 611
566 void SchedulerStateMachine::DidEnterBeginFrame(const BeginFrameArgs& args) { 612 void SchedulerStateMachine::DidEnterBeginFrame(const BeginFrameArgs& args) {
567 current_frame_number_++; 613 current_frame_number_++;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 (expect_immediate_begin_frame_for_main_thread_ && 662 (expect_immediate_begin_frame_for_main_thread_ &&
617 commit_state_ != COMMIT_STATE_IDLE)) 663 commit_state_ != COMMIT_STATE_IDLE))
618 << *AsValue(); 664 << *AsValue();
619 commit_state_ = COMMIT_STATE_READY_TO_COMMIT; 665 commit_state_ = COMMIT_STATE_READY_TO_COMMIT;
620 } 666 }
621 667
622 void SchedulerStateMachine::BeginFrameAbortedByMainThread(bool did_handle) { 668 void SchedulerStateMachine::BeginFrameAbortedByMainThread(bool did_handle) {
623 DCHECK_EQ(commit_state_, COMMIT_STATE_FRAME_IN_PROGRESS); 669 DCHECK_EQ(commit_state_, COMMIT_STATE_FRAME_IN_PROGRESS);
624 if (did_handle) { 670 if (did_handle) {
625 bool commit_was_aborted = true; 671 bool commit_was_aborted = true;
626 HandleCommitInternal(commit_was_aborted); 672 UpdateStateOnCommit(commit_was_aborted);
627 } else if (expect_immediate_begin_frame_for_main_thread_) { 673 } else if (expect_immediate_begin_frame_for_main_thread_) {
628 expect_immediate_begin_frame_for_main_thread_ = false; 674 expect_immediate_begin_frame_for_main_thread_ = false;
629 } else { 675 } else {
630 commit_state_ = COMMIT_STATE_IDLE; 676 commit_state_ = COMMIT_STATE_IDLE;
631 SetNeedsCommit(); 677 SetNeedsCommit();
632 } 678 }
633 } 679 }
634 680
635 void SchedulerStateMachine::DidLoseOutputSurface() { 681 void SchedulerStateMachine::DidLoseOutputSurface() {
636 if (output_surface_state_ == OUTPUT_SURFACE_LOST || 682 if (output_surface_state_ == OUTPUT_SURFACE_LOST ||
637 output_surface_state_ == OUTPUT_SURFACE_CREATING) 683 output_surface_state_ == OUTPUT_SURFACE_CREATING)
638 return; 684 return;
639 output_surface_state_ = OUTPUT_SURFACE_LOST; 685 output_surface_state_ = OUTPUT_SURFACE_LOST;
640 needs_redraw_ = false; 686 needs_redraw_ = false;
641 } 687 }
642 688
643 void SchedulerStateMachine::SetHasPendingTree(bool has_pending_tree) { 689 void SchedulerStateMachine::NotifyReadyToActivate() {
644 if (has_pending_tree_ && !has_pending_tree) { 690 if (has_pending_tree_)
645 // There is a new active tree. 691 pending_tree_is_ready_for_activation_ = true;
646 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION)
647 output_surface_state_ = OUTPUT_SURFACE_ACTIVE;
648
649 needs_redraw_ = true;
650 }
651 has_pending_tree_ = has_pending_tree;
652 } 692 }
653 693
654 void SchedulerStateMachine::SetCanDraw(bool can) { can_draw_ = can; } 694 void SchedulerStateMachine::SetCanDraw(bool can) { can_draw_ = can; }
655 695
656 void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() { 696 void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() {
657 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_CREATING); 697 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_CREATING);
658 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT; 698 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT;
659 699
660 if (did_create_and_initialize_first_output_surface_) { 700 if (did_create_and_initialize_first_output_surface_) {
661 // TODO(boliu): See if we can remove this when impl-side painting is always 701 // TODO(boliu): See if we can remove this when impl-side painting is always
(...skipping 17 matching lines...) Expand all
679 NOTREACHED(); 719 NOTREACHED();
680 return false; 720 return false;
681 } 721 }
682 722
683 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( 723 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced(
684 int num_draws) { 724 int num_draws) {
685 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; 725 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws;
686 } 726 }
687 727
688 } // namespace cc 728 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698