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

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

Issue 23907006: cc: Allow sending BeginMainFrame before draw or activation (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedDeadline3
Patch Set: rebase Created 6 years, 9 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
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/scheduler/scheduler.h" 7 #include "cc/scheduler/scheduler.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 #define EXPECT_ACTION_UPDATE_STATE(action) \ 10 #define EXPECT_ACTION_UPDATE_STATE(action) \
11 EXPECT_EQ(action, state.NextAction()) << *state.AsValue(); \ 11 EXPECT_EQ(action, state.NextAction()) << *state.AsValue(); \
12 if (action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE || \ 12 if (action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE || \
13 action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED) { \ 13 action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED) { \
14 if (SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW == \
15 state.CommitState() && \
16 SchedulerStateMachine::OUTPUT_SURFACE_ACTIVE != \
17 state.output_surface_state()) \
18 return; \
19 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, \ 14 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, \
20 state.begin_impl_frame_state()) \ 15 state.begin_impl_frame_state()) \
21 << *state.AsValue(); \ 16 << *state.AsValue(); \
22 } \ 17 } \
23 state.UpdateState(action); \ 18 state.UpdateState(action); \
24 if (action == SchedulerStateMachine::ACTION_NONE) { \ 19 if (action == SchedulerStateMachine::ACTION_NONE) { \
25 if (state.begin_impl_frame_state() == \ 20 if (state.begin_impl_frame_state() == \
26 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING) \ 21 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING) \
27 state.OnBeginImplFrameDeadlinePending(); \ 22 state.OnBeginImplFrameDeadlinePending(); \
28 if (state.begin_impl_frame_state() == \ 23 if (state.begin_impl_frame_state() == \
29 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) \ 24 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) \
30 state.OnBeginImplFrameIdle(); \ 25 state.OnBeginImplFrameIdle(); \
31 } 26 }
32 27
33 namespace cc { 28 namespace cc {
34 29
35 namespace { 30 namespace {
36 31
37 const SchedulerStateMachine::BeginImplFrameState all_begin_impl_frame_states[] = 32 const SchedulerStateMachine::BeginImplFrameState all_begin_impl_frame_states[] =
38 {SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE, 33 {SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE,
39 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING, 34 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING,
40 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME, 35 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME,
41 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, }; 36 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, };
42 37
43 const SchedulerStateMachine::CommitState all_commit_states[] = { 38 const SchedulerStateMachine::CommitState all_commit_states[] = {
44 SchedulerStateMachine::COMMIT_STATE_IDLE, 39 SchedulerStateMachine::COMMIT_STATE_IDLE,
45 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, 40 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT,
46 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED, 41 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED,
47 SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, 42 SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
48 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, }; 43 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_ACTIVATION,
44 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW};
49 45
50 // Exposes the protected state fields of the SchedulerStateMachine for testing 46 // Exposes the protected state fields of the SchedulerStateMachine for testing
51 class StateMachine : public SchedulerStateMachine { 47 class StateMachine : public SchedulerStateMachine {
52 public: 48 public:
53 explicit StateMachine(const SchedulerSettings& scheduler_settings) 49 explicit StateMachine(const SchedulerSettings& scheduler_settings)
54 : SchedulerStateMachine(scheduler_settings) {} 50 : SchedulerStateMachine(scheduler_settings) {}
55 51
56 void CreateAndInitializeOutputSurfaceWithActivatedCommit() { 52 void CreateAndInitializeOutputSurfaceWithActivatedCommit() {
57 DidCreateAndInitializeOutputSurface(); 53 DidCreateAndInitializeOutputSurface();
58 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; 54 output_surface_state_ = OUTPUT_SURFACE_ACTIVE;
(...skipping 19 matching lines...) Expand all
78 } 74 }
79 75
80 SynchronousReadbackState readback_state() const { return readback_state_; } 76 SynchronousReadbackState readback_state() const { return readback_state_; }
81 77
82 bool NeedsCommit() const { return needs_commit_; } 78 bool NeedsCommit() const { return needs_commit_; }
83 79
84 void SetNeedsRedraw(bool b) { needs_redraw_ = b; } 80 void SetNeedsRedraw(bool b) { needs_redraw_ = b; }
85 81
86 void SetNeedsForcedRedrawForTimeout(bool b) { 82 void SetNeedsForcedRedrawForTimeout(bool b) {
87 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT; 83 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT;
88 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW; 84 active_tree_needs_first_draw_ = true;
89 } 85 }
90 bool NeedsForcedRedrawForTimeout() const { 86 bool NeedsForcedRedrawForTimeout() const {
91 return forced_redraw_state_ != FORCED_REDRAW_STATE_IDLE; 87 return forced_redraw_state_ != FORCED_REDRAW_STATE_IDLE;
92 } 88 }
93 89
94 void SetNeedsForcedRedrawForReadback() { 90 void SetNeedsForcedRedrawForReadback() {
95 readback_state_ = READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK; 91 readback_state_ = READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK;
96 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW; 92 active_tree_needs_first_draw_ = true;
97 } 93 }
98 94
99 bool NeedsForcedRedrawForReadback() const { 95 bool NeedsForcedRedrawForReadback() const {
100 return readback_state_ != READBACK_STATE_IDLE; 96 return readback_state_ != READBACK_STATE_IDLE;
101 } 97 }
102 98
103 void SetActiveTreeNeedsFirstDraw(bool needs_first_draw) { 99 void SetActiveTreeNeedsFirstDraw(bool needs_first_draw) {
104 active_tree_needs_first_draw_ = needs_first_draw; 100 active_tree_needs_first_draw_ = needs_first_draw;
105 } 101 }
106 102
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 state.UpdateState(state.NextAction()); 174 state.UpdateState(state.NextAction());
179 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 175 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
180 state.SetVisible(true); 176 state.SetVisible(true);
181 state.UpdateState(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 177 state.UpdateState(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
182 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, 178 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT,
183 state.CommitState()); 179 state.CommitState());
184 EXPECT_FALSE(state.NeedsCommit()); 180 EXPECT_FALSE(state.NeedsCommit());
185 } 181 }
186 } 182 }
187 183
184 // Explicitly test main_frame_before_draw_enabled = false
185 TEST(SchedulerStateMachineTest, MainFrameBeforeDrawDisabled) {
186 SchedulerSettings scheduler_settings;
187 scheduler_settings.impl_side_painting = true;
188 scheduler_settings.main_frame_before_draw_enabled = false;
189 StateMachine state(scheduler_settings);
190 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
191 state.SetCanStart();
192 state.UpdateState(state.NextAction());
193 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
194 state.SetNeedsRedraw(false);
195 state.SetVisible(true);
196 state.SetCanDraw(true);
197 state.SetNeedsCommit();
198
199 EXPECT_TRUE(state.BeginImplFrameNeeded());
200
201 // Commit to the pending tree.
202 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
203 EXPECT_ACTION_UPDATE_STATE(
204 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
205 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
206 state.NotifyBeginMainFrameStarted();
207 state.NotifyReadyToCommit();
208 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
209 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
210 EXPECT_EQ(state.CommitState(),
211 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
212
213 state.OnBeginImplFrameDeadline();
214 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
215 EXPECT_EQ(state.CommitState(),
216 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
217
218 // Verify that the next commit doesn't start until the previous
219 // commit has been drawn.
220 state.SetNeedsCommit();
221 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
222 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
223
224 // Verify NotifyReadyToActivate unblocks activation, draw, and
225 // commit in that order.
226 state.NotifyReadyToActivate();
227 EXPECT_ACTION_UPDATE_STATE(
228 SchedulerStateMachine::ACTION_ACTIVATE_PENDING_TREE);
229 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
230 EXPECT_EQ(state.CommitState(),
231 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
232
233 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
234 state.OnBeginImplFrameDeadline();
235 EXPECT_ACTION_UPDATE_STATE(
236 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
237 EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
238 EXPECT_ACTION_UPDATE_STATE(
239 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
240 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
241 EXPECT_EQ(state.CommitState(),
242 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
243
244 state.NotifyBeginMainFrameStarted();
245 state.NotifyReadyToCommit();
246 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
247 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
248 EXPECT_EQ(state.CommitState(),
249 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
250 }
251
252 // Explicitly test main_frame_before_activation_enabled = true
253 TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) {
254 SchedulerSettings scheduler_settings;
255 scheduler_settings.impl_side_painting = true;
256 scheduler_settings.main_frame_before_activation_enabled = true;
257 StateMachine state(scheduler_settings);
258 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
259 state.SetCanStart();
260 state.UpdateState(state.NextAction());
261 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
262 state.SetNeedsRedraw(false);
263 state.SetVisible(true);
264 state.SetCanDraw(true);
265 state.SetNeedsCommit();
266
267 EXPECT_TRUE(state.BeginImplFrameNeeded());
268
269 // Commit to the pending tree.
270 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
271 EXPECT_ACTION_UPDATE_STATE(
272 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
273 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
274
275 state.NotifyBeginMainFrameStarted();
276 state.NotifyReadyToCommit();
277 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
278 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
279 EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
280
281 state.OnBeginImplFrameDeadline();
282 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
283
284 // Verify that the next commit starts while there is still a pending tree.
285 state.SetNeedsCommit();
286 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
287 EXPECT_ACTION_UPDATE_STATE(
288 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
289 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
290
291 // Verify the pending commit doesn't overwrite the pending
292 // tree until the pending tree has been activated.
293 state.NotifyBeginMainFrameStarted();
294 state.NotifyReadyToCommit();
295 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
296
297 // Verify NotifyReadyToActivate unblocks activation, draw, and
298 // commit in that order.
299 state.NotifyReadyToActivate();
300 EXPECT_ACTION_UPDATE_STATE(
301 SchedulerStateMachine::ACTION_ACTIVATE_PENDING_TREE);
302 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
303
304 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
305 state.OnBeginImplFrameDeadline();
306 EXPECT_ACTION_UPDATE_STATE(
307 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
308 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
309 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
310 EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
311 }
312
188 TEST(SchedulerStateMachineTest, 313 TEST(SchedulerStateMachineTest,
189 TestFailedDrawForAnimationCheckerboardSetsNeedsCommitAndDoesNotDrawAgain) { 314 TestFailedDrawForAnimationCheckerboardSetsNeedsCommitAndDoesNotDrawAgain) {
190 SchedulerSettings default_scheduler_settings; 315 SchedulerSettings default_scheduler_settings;
191 StateMachine state(default_scheduler_settings); 316 StateMachine state(default_scheduler_settings);
192 state.SetCanStart(); 317 state.SetCanStart();
193 state.UpdateState(state.NextAction()); 318 state.UpdateState(state.NextAction());
194 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 319 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
195 state.SetVisible(true); 320 state.SetVisible(true);
196 state.SetCanDraw(true); 321 state.SetCanDraw(true);
197 state.SetNeedsRedraw(true); 322 state.SetNeedsRedraw(true);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 406
282 // Failing the draw for animation checkerboards makes us require a commit. 407 // Failing the draw for animation checkerboards makes us require a commit.
283 state.DidDrawIfPossibleCompleted( 408 state.DidDrawIfPossibleCompleted(
284 DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); 409 DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
285 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 410 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
286 EXPECT_ACTION_UPDATE_STATE( 411 EXPECT_ACTION_UPDATE_STATE(
287 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 412 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
288 EXPECT_TRUE(state.RedrawPending()); 413 EXPECT_TRUE(state.RedrawPending());
289 } 414 }
290 415
291 TEST(SchedulerStateMachineTest, 416 void TestFailedDrawsEventuallyForceDrawAfterNextCommit(
292 TestFailedDrawsWillEventuallyForceADrawAfterTheNextCommit) { 417 bool main_frame_before_draw_enabled) {
293 SchedulerSettings scheduler_settings; 418 SchedulerSettings scheduler_settings;
419 scheduler_settings.main_frame_before_draw_enabled =
420 main_frame_before_draw_enabled;
294 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 1; 421 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 1;
295 StateMachine state(scheduler_settings); 422 StateMachine state(scheduler_settings);
296 state.SetCanStart(); 423 state.SetCanStart();
297 state.UpdateState(state.NextAction()); 424 state.UpdateState(state.NextAction());
298 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 425 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
299 state.SetVisible(true); 426 state.SetVisible(true);
300 state.SetCanDraw(true); 427 state.SetCanDraw(true);
301 428
302 // Start a commit. 429 // Start a commit.
303 state.SetNeedsCommit(); 430 state.SetNeedsCommit();
(...skipping 22 matching lines...) Expand all
326 // Finish the commit. Note, we should not yet be forcing a draw, but should 453 // Finish the commit. Note, we should not yet be forcing a draw, but should
327 // continue the commit as usual. 454 // continue the commit as usual.
328 state.NotifyBeginMainFrameStarted(); 455 state.NotifyBeginMainFrameStarted();
329 state.NotifyReadyToCommit(); 456 state.NotifyReadyToCommit();
330 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 457 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
331 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 458 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
332 EXPECT_TRUE(state.RedrawPending()); 459 EXPECT_TRUE(state.RedrawPending());
333 460
334 // The redraw should be forced at the end of the next BeginImplFrame. 461 // The redraw should be forced at the end of the next BeginImplFrame.
335 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 462 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
463 if (main_frame_before_draw_enabled) {
464 EXPECT_ACTION_UPDATE_STATE(
465 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
466 }
336 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 467 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
337 state.OnBeginImplFrameDeadline(); 468 state.OnBeginImplFrameDeadline();
338 EXPECT_ACTION_UPDATE_STATE( 469 EXPECT_ACTION_UPDATE_STATE(
339 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED); 470 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED);
340 } 471 }
341 472
473 TEST(SchedulerStateMachineTest,
474 TestFailedDrawsEventuallyForceDrawAfterNextCommit) {
475 bool main_frame_before_draw_enabled = false;
476 TestFailedDrawsEventuallyForceDrawAfterNextCommit(
477 main_frame_before_draw_enabled);
478 }
479
480 TEST(SchedulerStateMachineTest,
481 TestFailedDrawsEventuallyForceDrawAfterNextCommit_CommitBeforeDraw) {
482 bool main_frame_before_draw_enabled = true;
483 TestFailedDrawsEventuallyForceDrawAfterNextCommit(
484 main_frame_before_draw_enabled);
485 }
486
342 TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) { 487 TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) {
343 SchedulerSettings scheduler_settings; 488 SchedulerSettings scheduler_settings;
344 int draw_limit = 1; 489 int draw_limit = 1;
345 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 490 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ =
346 draw_limit; 491 draw_limit;
347 scheduler_settings.impl_side_painting = true; 492 scheduler_settings.impl_side_painting = true;
348 StateMachine state(scheduler_settings); 493 StateMachine state(scheduler_settings);
349 state.SetCanStart(); 494 state.SetCanStart();
350 state.UpdateState(state.NextAction()); 495 state.UpdateState(state.NextAction());
351 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 496 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 state.NextAction()); 658 state.NextAction());
514 659
515 // Case 2: needs_commit=true 660 // Case 2: needs_commit=true
516 state.SetNeedsCommit(); 661 state.SetNeedsCommit();
517 EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE, 662 EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE,
518 state.NextAction()) 663 state.NextAction())
519 << *state.AsValue(); 664 << *state.AsValue();
520 } 665 }
521 } 666 }
522 667
523 // When in BeginImplFrame deadline we should always draw for SetNeedsRedraw or 668 // When in BeginImplFrame deadline we should always draw for SetNeedsRedraw
524 // SetNeedsForcedRedrawForReadback have been called... except if we're 669 // except if we're ready to commit, in which case we expect a commit first.
525 // ready to commit, in which case we expect a commit first. 670 // SetNeedsForcedRedrawForReadback should take precedence over all and
671 // issue a readback.
526 for (size_t i = 0; i < num_commit_states; ++i) { 672 for (size_t i = 0; i < num_commit_states; ++i) {
527 for (size_t j = 0; j < 2; ++j) { 673 for (size_t j = 0; j < 2; ++j) {
528 bool request_readback = j; 674 bool request_readback = j;
529 675
530 // Skip invalid states
531 if (request_readback &&
532 (SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW !=
533 all_commit_states[i]))
534 continue;
535
536 StateMachine state(default_scheduler_settings); 676 StateMachine state(default_scheduler_settings);
537 state.SetCanStart(); 677 state.SetCanStart();
538 state.UpdateState(state.NextAction()); 678 state.UpdateState(state.NextAction());
539 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 679 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
540 state.SetCanDraw(true); 680 state.SetCanDraw(true);
541 state.SetCommitState(all_commit_states[i]); 681 state.SetCommitState(all_commit_states[i]);
542 state.SetBeginImplFrameState( 682 state.SetBeginImplFrameState(
543 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE); 683 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE);
544 if (request_readback) { 684 if (request_readback) {
545 state.SetNeedsForcedRedrawForReadback(); 685 state.SetNeedsForcedRedrawForReadback();
546 } else { 686 } else {
547 state.SetNeedsRedraw(true); 687 state.SetNeedsRedraw(true);
548 state.SetVisible(true); 688 state.SetVisible(true);
549 } 689 }
550 690
551 SchedulerStateMachine::Action expected_action; 691 SchedulerStateMachine::Action expected_action;
552 if (all_commit_states[i] == 692 if (request_readback) {
553 SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT) { 693 expected_action = SchedulerStateMachine::ACTION_DRAW_AND_READBACK;
694 } else if (all_commit_states[i] ==
695 SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT) {
554 expected_action = SchedulerStateMachine::ACTION_COMMIT; 696 expected_action = SchedulerStateMachine::ACTION_COMMIT;
555 } else if (request_readback) {
556 if (all_commit_states[i] ==
557 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW)
558 expected_action = SchedulerStateMachine::ACTION_DRAW_AND_READBACK;
559 else
560 expected_action = SchedulerStateMachine::ACTION_NONE;
561 } else { 697 } else {
562 expected_action = 698 expected_action =
563 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE; 699 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE;
564 } 700 }
565 701
566 // Case 1: needs_commit=false. 702 // Case 1: needs_commit=false.
567 EXPECT_NE(state.BeginImplFrameNeeded(), request_readback) 703 EXPECT_NE(state.BeginImplFrameNeeded(), request_readback)
568 << *state.AsValue(); 704 << *state.AsValue();
569 EXPECT_EQ(expected_action, state.NextAction()) << *state.AsValue(); 705 EXPECT_EQ(state.NextAction(), expected_action) << *state.AsValue();
570 706
571 // Case 2: needs_commit=true. 707 // Case 2: needs_commit=true.
572 state.SetNeedsCommit(); 708 state.SetNeedsCommit();
573 EXPECT_NE(state.BeginImplFrameNeeded(), request_readback) 709 EXPECT_NE(state.BeginImplFrameNeeded(), request_readback)
574 << *state.AsValue(); 710 << *state.AsValue();
575 EXPECT_EQ(expected_action, state.NextAction()) << *state.AsValue(); 711 EXPECT_EQ(state.NextAction(), expected_action) << *state.AsValue();
576 } 712 }
577 } 713 }
578 } 714 }
579 715
580 TEST(SchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible) { 716 TEST(SchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible) {
581 SchedulerSettings default_scheduler_settings; 717 SchedulerSettings default_scheduler_settings;
582 718
583 size_t num_commit_states = 719 size_t num_commit_states =
584 sizeof(all_commit_states) / sizeof(SchedulerStateMachine::CommitState); 720 sizeof(all_commit_states) / sizeof(SchedulerStateMachine::CommitState);
585 for (size_t i = 0; i < num_commit_states; ++i) { 721 for (size_t i = 0; i < num_commit_states; ++i) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } 772 }
637 773
638 TEST(SchedulerStateMachineTest, 774 TEST(SchedulerStateMachineTest,
639 TestCanRedrawWithWaitingForFirstDrawMakesProgress) { 775 TestCanRedrawWithWaitingForFirstDrawMakesProgress) {
640 SchedulerSettings default_scheduler_settings; 776 SchedulerSettings default_scheduler_settings;
641 StateMachine state(default_scheduler_settings); 777 StateMachine state(default_scheduler_settings);
642 state.SetCanStart(); 778 state.SetCanStart();
643 state.UpdateState(state.NextAction()); 779 state.UpdateState(state.NextAction());
644 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 780 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
645 781
646 state.SetCommitState(
647 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
648 state.SetActiveTreeNeedsFirstDraw(true); 782 state.SetActiveTreeNeedsFirstDraw(true);
649 state.SetNeedsCommit(); 783 state.SetNeedsCommit();
650 state.SetNeedsRedraw(true); 784 state.SetNeedsRedraw(true);
651 state.SetVisible(true); 785 state.SetVisible(true);
652 state.SetCanDraw(false); 786 state.SetCanDraw(false);
653 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 787 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
654 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 788 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
655 EXPECT_ACTION_UPDATE_STATE( 789 EXPECT_ACTION_UPDATE_STATE(
656 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 790 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
657 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 791 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
658 state.NotifyBeginMainFrameStarted(); 792 state.NotifyBeginMainFrameStarted();
659 state.NotifyReadyToCommit(); 793 state.NotifyReadyToCommit();
660 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 794 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
661 state.OnBeginImplFrameDeadline(); 795 state.OnBeginImplFrameDeadline();
662 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 796 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
663 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 797 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
664 } 798 }
665 799
666 TEST(SchedulerStateMachineTest, TestsetNeedsCommitIsNotLost) { 800 void TestSetNeedsCommitIsNotLost(bool main_frame_before_draw_enabled) {
667 SchedulerSettings default_scheduler_settings; 801 SchedulerSettings scheduler_settings;
668 StateMachine state(default_scheduler_settings); 802 scheduler_settings.main_frame_before_draw_enabled =
803 main_frame_before_draw_enabled;
804 StateMachine state(scheduler_settings);
669 state.SetCanStart(); 805 state.SetCanStart();
670 state.UpdateState(state.NextAction()); 806 state.UpdateState(state.NextAction());
671 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 807 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
672 state.SetNeedsCommit(); 808 state.SetNeedsCommit();
673 state.SetVisible(true); 809 state.SetVisible(true);
674 state.SetCanDraw(true); 810 state.SetCanDraw(true);
675 811
676 EXPECT_TRUE(state.BeginImplFrameNeeded()); 812 EXPECT_TRUE(state.BeginImplFrameNeeded());
677 813
678 // Begin the frame. 814 // Begin the frame.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 state.OnBeginImplFrameIdle(); 846 state.OnBeginImplFrameIdle();
711 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE, 847 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE,
712 state.begin_impl_frame_state()); 848 state.begin_impl_frame_state());
713 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction()); 849 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction());
714 850
715 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 851 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
716 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING, 852 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING,
717 state.begin_impl_frame_state()); 853 state.begin_impl_frame_state());
718 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction()); 854 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction());
719 855
720 // Commit and make sure we draw on next BeginImplFrame 856 // Finish the commit, then make sure we start the next commit immediately
857 // and draw on the next BeginImplFrame.
721 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 858 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
859 if (main_frame_before_draw_enabled) {
860 EXPECT_ACTION_UPDATE_STATE(
861 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
862 }
722 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 863 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
864
723 state.OnBeginImplFrameDeadline(); 865 state.OnBeginImplFrameDeadline();
724 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 866
725 state.CommitState()); 867 EXPECT_TRUE(state.active_tree_needs_first_draw());
726 EXPECT_ACTION_UPDATE_STATE( 868 EXPECT_ACTION_UPDATE_STATE(
727 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 869 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
728 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS); 870 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
871 if (!main_frame_before_draw_enabled) {
872 EXPECT_ACTION_UPDATE_STATE(
873 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
874 }
875 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
876 }
729 877
730 // Verify that another commit will start immediately after draw. 878 TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) {
731 EXPECT_ACTION_UPDATE_STATE( 879 bool main_frame_before_draw_enabled = false;
732 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 880 TestSetNeedsCommitIsNotLost(main_frame_before_draw_enabled);
733 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 881 }
882
883 TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost_CommitBeforeDraw) {
884 bool main_frame_before_draw_enabled = true;
885 TestSetNeedsCommitIsNotLost(main_frame_before_draw_enabled);
734 } 886 }
735 887
736 TEST(SchedulerStateMachineTest, TestFullCycle) { 888 TEST(SchedulerStateMachineTest, TestFullCycle) {
737 SchedulerSettings default_scheduler_settings; 889 SchedulerSettings default_scheduler_settings;
738 StateMachine state(default_scheduler_settings); 890 StateMachine state(default_scheduler_settings);
739 state.SetCanStart(); 891 state.SetCanStart();
740 state.UpdateState(state.NextAction()); 892 state.UpdateState(state.NextAction());
741 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 893 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
742 state.SetVisible(true); 894 state.SetVisible(true);
743 state.SetCanDraw(true); 895 state.SetCanDraw(true);
(...skipping 11 matching lines...) Expand all
755 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 907 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
756 908
757 // Tell the scheduler the frame finished. 909 // Tell the scheduler the frame finished.
758 state.NotifyBeginMainFrameStarted(); 910 state.NotifyBeginMainFrameStarted();
759 state.NotifyReadyToCommit(); 911 state.NotifyReadyToCommit();
760 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, 912 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
761 state.CommitState()); 913 state.CommitState());
762 914
763 // Commit. 915 // Commit.
764 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 916 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
765 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 917 EXPECT_TRUE(state.active_tree_needs_first_draw());
766 state.CommitState());
767 EXPECT_TRUE(state.needs_redraw()); 918 EXPECT_TRUE(state.needs_redraw());
768 919
769 // Expect to do nothing until BeginImplFrame deadline 920 // Expect to do nothing until BeginImplFrame deadline
770 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 921 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
771 922
772 // At BeginImplFrame deadline, draw. 923 // At BeginImplFrame deadline, draw.
773 state.OnBeginImplFrameDeadline(); 924 state.OnBeginImplFrameDeadline();
774 EXPECT_ACTION_UPDATE_STATE( 925 EXPECT_ACTION_UPDATE_STATE(
775 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 926 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
776 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS); 927 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
(...skipping 30 matching lines...) Expand all
807 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 958 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
808 959
809 // Tell the scheduler the frame finished. 960 // Tell the scheduler the frame finished.
810 state.NotifyBeginMainFrameStarted(); 961 state.NotifyBeginMainFrameStarted();
811 state.NotifyReadyToCommit(); 962 state.NotifyReadyToCommit();
812 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, 963 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
813 state.CommitState()); 964 state.CommitState());
814 965
815 // First commit. 966 // First commit.
816 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 967 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
817 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 968 EXPECT_TRUE(state.active_tree_needs_first_draw());
818 state.CommitState());
819 EXPECT_TRUE(state.needs_redraw()); 969 EXPECT_TRUE(state.needs_redraw());
820 970
821 // Expect to do nothing until BeginImplFrame deadline. 971 // Expect to do nothing until BeginImplFrame deadline.
822 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 972 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
823 973
824 // At BeginImplFrame deadline, draw. 974 // At BeginImplFrame deadline, draw.
825 state.OnBeginImplFrameDeadline(); 975 state.OnBeginImplFrameDeadline();
826 EXPECT_ACTION_UPDATE_STATE( 976 EXPECT_ACTION_UPDATE_STATE(
827 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 977 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
828 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS); 978 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 state.SetNeedsRedraw(true); 1248 state.SetNeedsRedraw(true);
1099 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction()); 1249 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
1100 1250
1101 // Finish the frame, and commit. 1251 // Finish the frame, and commit.
1102 state.NotifyBeginMainFrameStarted(); 1252 state.NotifyBeginMainFrameStarted();
1103 state.NotifyReadyToCommit(); 1253 state.NotifyReadyToCommit();
1104 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1254 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1105 1255
1106 // We will abort the draw when the output surface is lost if we are 1256 // We will abort the draw when the output surface is lost if we are
1107 // waiting for the first draw to unblock the main thread. 1257 // waiting for the first draw to unblock the main thread.
1108 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1258 EXPECT_TRUE(state.active_tree_needs_first_draw());
1109 state.CommitState());
1110 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 1259 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
1111 1260
1112 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE 1261 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE
1113 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE, 1262 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE,
1114 state.begin_impl_frame_state()); 1263 state.begin_impl_frame_state());
1115 EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION, 1264 EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
1116 state.NextAction()); 1265 state.NextAction());
1117 1266
1118 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 1267 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
1119 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING, 1268 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 1310
1162 // Ask for another draw and also set needs commit. Expect nothing happens. 1311 // Ask for another draw and also set needs commit. Expect nothing happens.
1163 state.SetNeedsRedraw(true); 1312 state.SetNeedsRedraw(true);
1164 state.SetNeedsCommit(); 1313 state.SetNeedsCommit();
1165 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1314 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1166 1315
1167 // Finish the frame, and commit. 1316 // Finish the frame, and commit.
1168 state.NotifyBeginMainFrameStarted(); 1317 state.NotifyBeginMainFrameStarted();
1169 state.NotifyReadyToCommit(); 1318 state.NotifyReadyToCommit();
1170 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1319 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1171 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1320 EXPECT_TRUE(state.active_tree_needs_first_draw());
1172 state.CommitState());
1173 1321
1174 // Because the output surface is missing, we expect the draw to abort. 1322 // Because the output surface is missing, we expect the draw to abort.
1175 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 1323 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
1176 1324
1177 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE 1325 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE
1178 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE, 1326 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE,
1179 state.begin_impl_frame_state()); 1327 state.begin_impl_frame_state());
1180 EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION, 1328 EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
1181 state.NextAction()); 1329 state.NextAction());
1182 1330
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 state.SetCanStart(); 1369 state.SetCanStart();
1222 state.UpdateState(state.NextAction()); 1370 state.UpdateState(state.NextAction());
1223 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1371 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1224 state.SetVisible(true); 1372 state.SetVisible(true);
1225 state.SetCanDraw(true); 1373 state.SetCanDraw(true);
1226 1374
1227 // Cause a lost context lost. 1375 // Cause a lost context lost.
1228 state.DidLoseOutputSurface(); 1376 state.DidLoseOutputSurface();
1229 1377
1230 // Ask a forced redraw for readback and verify it ocurrs. 1378 // Ask a forced redraw for readback and verify it ocurrs.
1231 state.SetCommitState(
1232 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
1233 state.SetNeedsForcedRedrawForReadback(); 1379 state.SetNeedsForcedRedrawForReadback();
1234 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 1380 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
1235 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK); 1381 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
1236 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1382 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1237 1383
1238 // Forced redraws for readbacks need to be followed by a new commit 1384 // Forced redraws for readbacks need to be followed by a new commit
1239 // to replace the readback commit. 1385 // to replace the readback commit.
1240 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, 1386 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT,
1241 state.CommitState()); 1387 state.CommitState());
1242 state.NotifyBeginMainFrameStarted(); 1388 state.NotifyBeginMainFrameStarted();
1243 state.NotifyReadyToCommit(); 1389 state.NotifyReadyToCommit();
1244 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1390 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1245 1391
1246 // We don't yet have an output surface, so we the draw and swap should abort. 1392 // We don't yet have an output surface, so we the draw and swap should abort.
1247 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 1393 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
1248 1394
1249 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE 1395 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE
1250 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction()); 1396 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
1251 1397
1252 state.OnBeginImplFrameDeadline(); 1398 state.OnBeginImplFrameDeadline();
1253 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction()); 1399 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
1254 1400
1255 state.OnBeginImplFrameIdle(); 1401 state.OnBeginImplFrameIdle();
1256 EXPECT_ACTION_UPDATE_STATE( 1402 EXPECT_ACTION_UPDATE_STATE(
1257 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1403 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1258 1404
1259 // Ask a readback and verify it occurs. 1405 // Ask a readback and verify it occurs.
1260 state.SetCommitState(
1261 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
1262 state.SetNeedsForcedRedrawForReadback(); 1406 state.SetNeedsForcedRedrawForReadback();
1263 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK); 1407 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
1264 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1408 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1265 } 1409 }
1266 1410
1267 TEST(SchedulerStateMachineTest, DontDrawBeforeCommitAfterLostOutputSurface) { 1411 TEST(SchedulerStateMachineTest, DontDrawBeforeCommitAfterLostOutputSurface) {
1268 SchedulerSettings default_scheduler_settings; 1412 SchedulerSettings default_scheduler_settings;
1269 StateMachine state(default_scheduler_settings); 1413 StateMachine state(default_scheduler_settings);
1270 state.SetCanStart(); 1414 state.SetCanStart();
1271 state.UpdateState(state.NextAction()); 1415 state.UpdateState(state.NextAction());
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 state.SetVisible(false); 1538 state.SetVisible(false);
1395 state.SetCommitState( 1539 state.SetCommitState(
1396 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1540 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1397 state.SetNeedsCommit(); 1541 state.SetNeedsCommit();
1398 1542
1399 state.NotifyBeginMainFrameStarted(); 1543 state.NotifyBeginMainFrameStarted();
1400 state.NotifyReadyToCommit(); 1544 state.NotifyReadyToCommit();
1401 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction()); 1545 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction());
1402 state.UpdateState(state.NextAction()); 1546 state.UpdateState(state.NextAction());
1403 1547
1404 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1548 EXPECT_TRUE(state.active_tree_needs_first_draw());
1405 state.CommitState());
1406 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 1549 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
1407 } 1550 }
1408 1551
1409 TEST(SchedulerStateMachineTest, TestFinishCommitWhenForcedCommitInProgress) { 1552 TEST(SchedulerStateMachineTest, TestFinishCommitWhenForcedCommitInProgress) {
1410 SchedulerSettings default_scheduler_settings; 1553 SchedulerSettings default_scheduler_settings;
1411 StateMachine state(default_scheduler_settings); 1554 StateMachine state(default_scheduler_settings);
1412 state.SetCanStart(); 1555 state.SetCanStart();
1413 state.UpdateState(state.NextAction()); 1556 state.UpdateState(state.NextAction());
1414 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1557 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1415 state.SetVisible(false); 1558 state.SetVisible(false);
1416 state.SetCommitState( 1559 state.SetCommitState(
1417 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1560 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1418 state.SetNeedsForcedCommitForReadback(); 1561 state.SetNeedsForcedCommitForReadback();
1419 1562
1420 // The commit for readback interupts the normal commit. 1563 // The commit for readback interupts the normal commit.
1421 state.NotifyBeginMainFrameStarted(); 1564 state.NotifyBeginMainFrameStarted();
1422 state.NotifyReadyToCommit(); 1565 state.NotifyReadyToCommit();
1423 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1566 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1424 1567
1425 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1568 EXPECT_TRUE(state.active_tree_needs_first_draw());
1426 state.CommitState());
1427 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK); 1569 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
1428 1570
1429 // When the readback interrupts the normal commit, we should not get 1571 // When the readback interrupts the normal commit, we should not get
1430 // another BeginMainFrame when the readback completes. 1572 // another BeginMainFrame when the readback completes.
1431 EXPECT_NE(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME, 1573 EXPECT_NE(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME,
1432 state.NextAction()); 1574 state.NextAction());
1433 1575
1434 // The normal commit can then proceed. 1576 // The normal commit can then proceed.
1435 state.NotifyBeginMainFrameStarted(); 1577 state.NotifyBeginMainFrameStarted();
1436 state.NotifyReadyToCommit(); 1578 state.NotifyReadyToCommit();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 EXPECT_ACTION_UPDATE_STATE( 1629 EXPECT_ACTION_UPDATE_STATE(
1488 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1630 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1489 1631
1490 state.NotifyBeginMainFrameStarted(); 1632 state.NotifyBeginMainFrameStarted();
1491 state.NotifyReadyToCommit(); 1633 state.NotifyReadyToCommit();
1492 1634
1493 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, 1635 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
1494 state.CommitState()); 1636 state.CommitState());
1495 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1637 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1496 1638
1497 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1639 EXPECT_TRUE(state.active_tree_needs_first_draw());
1498 state.CommitState());
1499 1640
1500 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK); 1641 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
1501 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS); 1642 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
1502 1643
1503 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1644 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1504 1645
1505 // Should be waiting for the normal BeginMainFrame. 1646 // Should be waiting for the normal BeginMainFrame.
1506 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, 1647 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT,
1507 state.CommitState()); 1648 state.CommitState());
1508 } 1649 }
(...skipping 15 matching lines...) Expand all
1524 state.SetNeedsForcedCommitForReadback(); 1665 state.SetNeedsForcedCommitForReadback();
1525 EXPECT_ACTION_UPDATE_STATE( 1666 EXPECT_ACTION_UPDATE_STATE(
1526 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1667 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1527 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1668 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1528 state.NotifyBeginMainFrameStarted(); 1669 state.NotifyBeginMainFrameStarted();
1529 state.NotifyReadyToCommit(); 1670 state.NotifyReadyToCommit();
1530 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, 1671 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
1531 state.CommitState()); 1672 state.CommitState());
1532 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1673 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1533 1674
1534 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1675 EXPECT_TRUE(state.active_tree_needs_first_draw());
1535 state.CommitState());
1536 1676
1537 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK); 1677 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
1538 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS); 1678 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
1539 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1679 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1540 1680
1541 // Should be waiting for the normal BeginMainFrame. 1681 // Should be waiting for the normal BeginMainFrame.
1542 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, 1682 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT,
1543 state.CommitState()) 1683 state.CommitState())
1544 << *state.AsValue(); 1684 << *state.AsValue();
1545 } 1685 }
(...skipping 13 matching lines...) Expand all
1559 state.SetNeedsForcedCommitForReadback(); 1699 state.SetNeedsForcedCommitForReadback();
1560 EXPECT_ACTION_UPDATE_STATE( 1700 EXPECT_ACTION_UPDATE_STATE(
1561 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1701 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1562 state.NotifyBeginMainFrameStarted(); 1702 state.NotifyBeginMainFrameStarted();
1563 state.NotifyReadyToCommit(); 1703 state.NotifyReadyToCommit();
1564 1704
1565 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, 1705 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
1566 state.CommitState()); 1706 state.CommitState());
1567 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1707 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1568 1708
1569 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1709 EXPECT_TRUE(state.active_tree_needs_first_draw());
1570 state.CommitState());
1571 1710
1572 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK); 1711 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
1573 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS); 1712 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
1574 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1713 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1575 1714
1576 // Should be waiting for BeginMainFrame. 1715 // Should be waiting for BeginMainFrame.
1577 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, 1716 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT,
1578 state.CommitState()) 1717 state.CommitState())
1579 << *state.AsValue(); 1718 << *state.AsValue();
1580 1719
(...skipping 20 matching lines...) Expand all
1601 1740
1602 state.SetNeedsForcedCommitForReadback(); 1741 state.SetNeedsForcedCommitForReadback();
1603 state.UpdateState(state.NextAction()); 1742 state.UpdateState(state.NextAction());
1604 state.NotifyBeginMainFrameStarted(); 1743 state.NotifyBeginMainFrameStarted();
1605 state.NotifyReadyToCommit(); 1744 state.NotifyReadyToCommit();
1606 1745
1607 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, 1746 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
1608 state.CommitState()); 1747 state.CommitState());
1609 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1748 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1610 1749
1611 EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 1750 EXPECT_TRUE(state.active_tree_needs_first_draw());
1612 state.CommitState());
1613 1751
1614 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK); 1752 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
1615 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS); 1753 state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
1616 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1754 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1617 } 1755 }
1618 1756
1619 TEST(SchedulerStateMachineTest, ReportIfNotDrawing) { 1757 TEST(SchedulerStateMachineTest, ReportIfNotDrawing) {
1620 SchedulerSettings default_scheduler_settings; 1758 SchedulerSettings default_scheduler_settings;
1621 StateMachine state(default_scheduler_settings); 1759 StateMachine state(default_scheduler_settings);
1622 state.SetCanStart(); 1760 state.SetCanStart();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1900 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1763 1901
1764 // The deadline is not triggered early until we enter prefer smoothness mode. 1902 // The deadline is not triggered early until we enter prefer smoothness mode.
1765 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 1903 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1766 state.SetSmoothnessTakesPriority(true); 1904 state.SetSmoothnessTakesPriority(true);
1767 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 1905 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1768 } 1906 }
1769 1907
1770 } // namespace 1908 } // namespace
1771 } // namespace cc 1909 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698