| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 scheduler_->DidCreateAndInitializeOutputSurface(); | 312 scheduler_->DidCreateAndInitializeOutputSurface(); |
| 313 scheduler_->SetNeedsBeginMainFrame(); | 313 scheduler_->SetNeedsBeginMainFrame(); |
| 314 EXPECT_TRUE(client_->needs_begin_frames()); | 314 EXPECT_TRUE(client_->needs_begin_frames()); |
| 315 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 315 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 316 client_->Reset(); | 316 client_->Reset(); |
| 317 | 317 |
| 318 { | 318 { |
| 319 SCOPED_TRACE("Do first frame to commit after initialize."); | 319 SCOPED_TRACE("Do first frame to commit after initialize."); |
| 320 AdvanceFrame(); | 320 AdvanceFrame(); |
| 321 | 321 |
| 322 scheduler_->NotifyBeginMainFrameStarted(); | 322 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 323 scheduler_->NotifyReadyToCommit(); | 323 scheduler_->NotifyReadyToCommit(); |
| 324 scheduler_->NotifyReadyToActivate(); | 324 scheduler_->NotifyReadyToActivate(); |
| 325 scheduler_->NotifyReadyToDraw(); | 325 scheduler_->NotifyReadyToDraw(); |
| 326 | 326 |
| 327 EXPECT_FALSE(scheduler_->CommitPending()); | 327 EXPECT_FALSE(scheduler_->CommitPending()); |
| 328 | 328 |
| 329 if (scheduler_settings_.using_synchronous_renderer_compositor) { | 329 if (scheduler_settings_.using_synchronous_renderer_compositor) { |
| 330 scheduler_->SetNeedsRedraw(); | 330 scheduler_->SetNeedsRedraw(); |
| 331 scheduler_->OnDrawForOutputSurface(); | 331 scheduler_->OnDrawForOutputSurface(); |
| 332 } else { | 332 } else { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 client_->Reset(); | 541 client_->Reset(); |
| 542 | 542 |
| 543 // If we don't swap on the deadline, we wait for the next BeginFrame. | 543 // If we don't swap on the deadline, we wait for the next BeginFrame. |
| 544 task_runner().RunPendingTasks(); // Run posted deadline. | 544 task_runner().RunPendingTasks(); // Run posted deadline. |
| 545 EXPECT_NO_ACTION(client_); | 545 EXPECT_NO_ACTION(client_); |
| 546 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 546 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 547 EXPECT_TRUE(client_->needs_begin_frames()); | 547 EXPECT_TRUE(client_->needs_begin_frames()); |
| 548 client_->Reset(); | 548 client_->Reset(); |
| 549 | 549 |
| 550 // NotifyReadyToCommit should trigger the commit. | 550 // NotifyReadyToCommit should trigger the commit. |
| 551 scheduler_->NotifyBeginMainFrameStarted(); | 551 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 552 scheduler_->NotifyReadyToCommit(); | 552 scheduler_->NotifyReadyToCommit(); |
| 553 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 553 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 554 EXPECT_TRUE(client_->needs_begin_frames()); | 554 EXPECT_TRUE(client_->needs_begin_frames()); |
| 555 client_->Reset(); | 555 client_->Reset(); |
| 556 | 556 |
| 557 // NotifyReadyToActivate should trigger the activation. | 557 // NotifyReadyToActivate should trigger the activation. |
| 558 scheduler_->NotifyReadyToActivate(); | 558 scheduler_->NotifyReadyToActivate(); |
| 559 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 559 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 560 EXPECT_TRUE(client_->needs_begin_frames()); | 560 EXPECT_TRUE(client_->needs_begin_frames()); |
| 561 client_->Reset(); | 561 client_->Reset(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 EXPECT_TRUE(client_->needs_begin_frames()); | 664 EXPECT_TRUE(client_->needs_begin_frames()); |
| 665 client_->Reset(); | 665 client_->Reset(); |
| 666 | 666 |
| 667 // Now SetNeedsBeginMainFrame again. Calling here means we need a second | 667 // Now SetNeedsBeginMainFrame again. Calling here means we need a second |
| 668 // commit. | 668 // commit. |
| 669 scheduler_->SetNeedsBeginMainFrame(); | 669 scheduler_->SetNeedsBeginMainFrame(); |
| 670 EXPECT_EQ(client_->num_actions_(), 0); | 670 EXPECT_EQ(client_->num_actions_(), 0); |
| 671 client_->Reset(); | 671 client_->Reset(); |
| 672 | 672 |
| 673 // Finish the first commit. | 673 // Finish the first commit. |
| 674 scheduler_->NotifyBeginMainFrameStarted(); | 674 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 675 scheduler_->NotifyReadyToCommit(); | 675 scheduler_->NotifyReadyToCommit(); |
| 676 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 676 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 677 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 677 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 678 client_->Reset(); | 678 client_->Reset(); |
| 679 | 679 |
| 680 // Activate it. | 680 // Activate it. |
| 681 scheduler_->NotifyReadyToActivate(); | 681 scheduler_->NotifyReadyToActivate(); |
| 682 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 682 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 683 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 683 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 684 client_->Reset(); | 684 client_->Reset(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 695 // Since another commit is needed, the next BeginImplFrame should initiate | 695 // Since another commit is needed, the next BeginImplFrame should initiate |
| 696 // the second commit. | 696 // the second commit. |
| 697 EXPECT_SCOPED(AdvanceFrame()); | 697 EXPECT_SCOPED(AdvanceFrame()); |
| 698 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 698 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 699 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 699 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 700 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 700 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 701 client_->Reset(); | 701 client_->Reset(); |
| 702 | 702 |
| 703 // Finishing the commit before the deadline should post a new deadline task | 703 // Finishing the commit before the deadline should post a new deadline task |
| 704 // to trigger the deadline early. | 704 // to trigger the deadline early. |
| 705 scheduler_->NotifyBeginMainFrameStarted(); | 705 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 706 scheduler_->NotifyReadyToCommit(); | 706 scheduler_->NotifyReadyToCommit(); |
| 707 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 707 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 708 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 708 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 709 client_->Reset(); | 709 client_->Reset(); |
| 710 scheduler_->NotifyReadyToActivate(); | 710 scheduler_->NotifyReadyToActivate(); |
| 711 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 711 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 712 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 712 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 713 client_->Reset(); | 713 client_->Reset(); |
| 714 task_runner().RunPendingTasks(); // Run posted deadline. | 714 task_runner().RunPendingTasks(); // Run posted deadline. |
| 715 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); | 715 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 EXPECT_EQ(0, client->num_draws()); | 878 EXPECT_EQ(0, client->num_draws()); |
| 879 EXPECT_TRUE(client->needs_begin_frames()); | 879 EXPECT_TRUE(client->needs_begin_frames()); |
| 880 | 880 |
| 881 client->SetNeedsBeginMainFrameOnNextDraw(); | 881 client->SetNeedsBeginMainFrameOnNextDraw(); |
| 882 EXPECT_SCOPED(AdvanceFrame()); | 882 EXPECT_SCOPED(AdvanceFrame()); |
| 883 client->SetNeedsBeginMainFrameOnNextDraw(); | 883 client->SetNeedsBeginMainFrameOnNextDraw(); |
| 884 task_runner().RunPendingTasks(); // Run posted deadline. | 884 task_runner().RunPendingTasks(); // Run posted deadline. |
| 885 EXPECT_EQ(1, client->num_draws()); | 885 EXPECT_EQ(1, client->num_draws()); |
| 886 EXPECT_TRUE(scheduler_->CommitPending()); | 886 EXPECT_TRUE(scheduler_->CommitPending()); |
| 887 EXPECT_TRUE(client->needs_begin_frames()); | 887 EXPECT_TRUE(client->needs_begin_frames()); |
| 888 scheduler_->NotifyBeginMainFrameStarted(); | 888 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 889 scheduler_->NotifyReadyToCommit(); | 889 scheduler_->NotifyReadyToCommit(); |
| 890 scheduler_->NotifyReadyToActivate(); | 890 scheduler_->NotifyReadyToActivate(); |
| 891 | 891 |
| 892 EXPECT_SCOPED(AdvanceFrame()); | 892 EXPECT_SCOPED(AdvanceFrame()); |
| 893 task_runner().RunPendingTasks(); // Run posted deadline. | 893 task_runner().RunPendingTasks(); // Run posted deadline. |
| 894 EXPECT_EQ(2, client->num_draws()); | 894 EXPECT_EQ(2, client->num_draws()); |
| 895 | 895 |
| 896 EXPECT_FALSE(scheduler_->RedrawPending()); | 896 EXPECT_FALSE(scheduler_->RedrawPending()); |
| 897 EXPECT_FALSE(scheduler_->CommitPending()); | 897 EXPECT_FALSE(scheduler_->CommitPending()); |
| 898 EXPECT_TRUE(client->needs_begin_frames()); | 898 EXPECT_TRUE(client->needs_begin_frames()); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 scheduler_settings_.commit_to_active_tree = true; | 1264 scheduler_settings_.commit_to_active_tree = true; |
| 1265 SetUpScheduler(make_scoped_ptr(client).Pass(), true); | 1265 SetUpScheduler(make_scoped_ptr(client).Pass(), true); |
| 1266 | 1266 |
| 1267 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. | 1267 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. |
| 1268 scheduler_->SetNeedsBeginMainFrame(); | 1268 scheduler_->SetNeedsBeginMainFrame(); |
| 1269 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1269 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 1270 client_->Reset(); | 1270 client_->Reset(); |
| 1271 | 1271 |
| 1272 // Begin new frame. | 1272 // Begin new frame. |
| 1273 EXPECT_SCOPED(AdvanceFrame()); | 1273 EXPECT_SCOPED(AdvanceFrame()); |
| 1274 scheduler_->NotifyBeginMainFrameStarted(); | 1274 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1275 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1275 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 1276 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1276 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 1277 | 1277 |
| 1278 client_->Reset(); | 1278 client_->Reset(); |
| 1279 scheduler_->NotifyReadyToCommit(); | 1279 scheduler_->NotifyReadyToCommit(); |
| 1280 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 1280 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 1281 | 1281 |
| 1282 client_->Reset(); | 1282 client_->Reset(); |
| 1283 scheduler_->NotifyReadyToActivate(); | 1283 scheduler_->NotifyReadyToActivate(); |
| 1284 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 1284 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1304 scheduler_settings_.commit_to_active_tree = true; | 1304 scheduler_settings_.commit_to_active_tree = true; |
| 1305 SetUpScheduler(make_scoped_ptr(client).Pass(), true); | 1305 SetUpScheduler(make_scoped_ptr(client).Pass(), true); |
| 1306 | 1306 |
| 1307 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. | 1307 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. |
| 1308 scheduler_->SetNeedsBeginMainFrame(); | 1308 scheduler_->SetNeedsBeginMainFrame(); |
| 1309 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1309 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 1310 client_->Reset(); | 1310 client_->Reset(); |
| 1311 | 1311 |
| 1312 // Begin new frame. | 1312 // Begin new frame. |
| 1313 EXPECT_SCOPED(AdvanceFrame()); | 1313 EXPECT_SCOPED(AdvanceFrame()); |
| 1314 scheduler_->NotifyBeginMainFrameStarted(); | 1314 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1315 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1315 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 1316 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1316 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 1317 | 1317 |
| 1318 client_->Reset(); | 1318 client_->Reset(); |
| 1319 scheduler_->NotifyReadyToCommit(); | 1319 scheduler_->NotifyReadyToCommit(); |
| 1320 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 1320 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 1321 | 1321 |
| 1322 client_->Reset(); | 1322 client_->Reset(); |
| 1323 scheduler_->NotifyReadyToActivate(); | 1323 scheduler_->NotifyReadyToActivate(); |
| 1324 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 1324 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1341 | 1341 |
| 1342 void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( | 1342 void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( |
| 1343 bool expect_send_begin_main_frame) { | 1343 bool expect_send_begin_main_frame) { |
| 1344 // Impl thread hits deadline before commit finishes. | 1344 // Impl thread hits deadline before commit finishes. |
| 1345 scheduler_->SetNeedsBeginMainFrame(); | 1345 scheduler_->SetNeedsBeginMainFrame(); |
| 1346 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1346 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1347 EXPECT_SCOPED(AdvanceFrame()); | 1347 EXPECT_SCOPED(AdvanceFrame()); |
| 1348 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1348 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1349 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1349 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1350 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1350 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
| 1351 scheduler_->NotifyBeginMainFrameStarted(); | 1351 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1352 scheduler_->NotifyReadyToCommit(); | 1352 scheduler_->NotifyReadyToCommit(); |
| 1353 scheduler_->NotifyReadyToActivate(); | 1353 scheduler_->NotifyReadyToActivate(); |
| 1354 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); | 1354 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); |
| 1355 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); | 1355 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); |
| 1356 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1356 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
| 1357 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1357 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
| 1358 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); | 1358 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
| 1359 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1359 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
| 1360 | 1360 |
| 1361 client_->Reset(); | 1361 client_->Reset(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 scheduler_->SetNeedsBeginMainFrame(); | 1464 scheduler_->SetNeedsBeginMainFrame(); |
| 1465 scheduler_->SetNeedsRedraw(); | 1465 scheduler_->SetNeedsRedraw(); |
| 1466 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1466 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1467 SendNextBeginFrame(); | 1467 SendNextBeginFrame(); |
| 1468 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 4); | 1468 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 4); |
| 1469 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 4); | 1469 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 4); |
| 1470 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1470 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
| 1471 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 4); | 1471 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 4); |
| 1472 | 1472 |
| 1473 client_->Reset(); | 1473 client_->Reset(); |
| 1474 scheduler_->NotifyBeginMainFrameStarted(); | 1474 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1475 scheduler_->NotifyReadyToCommit(); | 1475 scheduler_->NotifyReadyToCommit(); |
| 1476 scheduler_->NotifyReadyToActivate(); | 1476 scheduler_->NotifyReadyToActivate(); |
| 1477 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1477 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1478 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1478 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1479 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); | 1479 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); |
| 1480 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); | 1480 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); |
| 1481 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1481 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
| 1482 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1482 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
| 1483 | 1483 |
| 1484 // Verify we skip every other frame if the swap ack consistently | 1484 // Verify we skip every other frame if the swap ack consistently |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1513 // Verify that we start the next BeginImplFrame and continue normally | 1513 // Verify that we start the next BeginImplFrame and continue normally |
| 1514 // after having just skipped a BeginImplFrame. | 1514 // after having just skipped a BeginImplFrame. |
| 1515 client_->Reset(); | 1515 client_->Reset(); |
| 1516 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1516 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1517 SendNextBeginFrame(); | 1517 SendNextBeginFrame(); |
| 1518 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); | 1518 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); |
| 1519 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 3); | 1519 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 3); |
| 1520 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | 1520 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
| 1521 | 1521 |
| 1522 client_->Reset(); | 1522 client_->Reset(); |
| 1523 scheduler_->NotifyBeginMainFrameStarted(); | 1523 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1524 scheduler_->NotifyReadyToCommit(); | 1524 scheduler_->NotifyReadyToCommit(); |
| 1525 scheduler_->NotifyReadyToActivate(); | 1525 scheduler_->NotifyReadyToActivate(); |
| 1526 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1526 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1527 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); | 1527 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); |
| 1528 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); | 1528 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); |
| 1529 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1529 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
| 1530 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1530 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
| 1531 } | 1531 } |
| 1532 } | 1532 } |
| 1533 | 1533 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 // Draw and swap for first BeginFrame | 1650 // Draw and swap for first BeginFrame |
| 1651 client_->Reset(); | 1651 client_->Reset(); |
| 1652 scheduler_->SetNeedsBeginMainFrame(); | 1652 scheduler_->SetNeedsBeginMainFrame(); |
| 1653 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1653 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1654 SendNextBeginFrame(); | 1654 SendNextBeginFrame(); |
| 1655 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 3); | 1655 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 3); |
| 1656 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); | 1656 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); |
| 1657 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | 1657 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
| 1658 | 1658 |
| 1659 client_->Reset(); | 1659 client_->Reset(); |
| 1660 scheduler_->NotifyBeginMainFrameStarted(); | 1660 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1661 scheduler_->NotifyReadyToCommit(); | 1661 scheduler_->NotifyReadyToCommit(); |
| 1662 scheduler_->NotifyReadyToActivate(); | 1662 scheduler_->NotifyReadyToActivate(); |
| 1663 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1663 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1664 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1664 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1665 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); | 1665 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); |
| 1666 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); | 1666 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); |
| 1667 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1667 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
| 1668 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1668 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
| 1669 | 1669 |
| 1670 // Verify impl thread consistently operates in high latency mode | 1670 // Verify impl thread consistently operates in high latency mode |
| 1671 // without skipping any frames. | 1671 // without skipping any frames. |
| 1672 for (int i = 0; i < 10; i++) { | 1672 for (int i = 0; i < 10; i++) { |
| 1673 // Not calling scheduler_->DidSwapBuffersComplete() until after next frame | 1673 // Not calling scheduler_->DidSwapBuffersComplete() until after next frame |
| 1674 // puts the impl thread in high latency mode. | 1674 // puts the impl thread in high latency mode. |
| 1675 client_->Reset(); | 1675 client_->Reset(); |
| 1676 scheduler_->SetNeedsBeginMainFrame(); | 1676 scheduler_->SetNeedsBeginMainFrame(); |
| 1677 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1677 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1678 SendNextBeginFrame(); | 1678 SendNextBeginFrame(); |
| 1679 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 1679 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
| 1680 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1680 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1681 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1681 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1682 | 1682 |
| 1683 client_->Reset(); | 1683 client_->Reset(); |
| 1684 scheduler_->DidSwapBuffersComplete(); | 1684 scheduler_->DidSwapBuffersComplete(); |
| 1685 scheduler_->NotifyBeginMainFrameStarted(); | 1685 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1686 scheduler_->NotifyReadyToCommit(); | 1686 scheduler_->NotifyReadyToCommit(); |
| 1687 scheduler_->NotifyReadyToActivate(); | 1687 scheduler_->NotifyReadyToActivate(); |
| 1688 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1688 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1689 | 1689 |
| 1690 // Verify that we don't skip the actions of the BeginImplFrame | 1690 // Verify that we don't skip the actions of the BeginImplFrame |
| 1691 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 5); | 1691 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 5); |
| 1692 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 5); | 1692 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 5); |
| 1693 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 5); | 1693 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 5); |
| 1694 EXPECT_ACTION("ScheduledActionAnimate", client_, 3, 5); | 1694 EXPECT_ACTION("ScheduledActionAnimate", client_, 3, 5); |
| 1695 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); | 1695 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 | 1760 |
| 1761 // Impl thread hits deadline before commit finishes to make | 1761 // Impl thread hits deadline before commit finishes to make |
| 1762 // MainThreadMissedLastDeadline true | 1762 // MainThreadMissedLastDeadline true |
| 1763 client_->Reset(); | 1763 client_->Reset(); |
| 1764 scheduler_->SetNeedsBeginMainFrame(); | 1764 scheduler_->SetNeedsBeginMainFrame(); |
| 1765 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1765 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1766 EXPECT_SCOPED(AdvanceFrame()); | 1766 EXPECT_SCOPED(AdvanceFrame()); |
| 1767 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1767 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1768 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1768 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1769 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1769 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
| 1770 scheduler_->NotifyBeginMainFrameStarted(); | 1770 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1771 scheduler_->NotifyReadyToCommit(); | 1771 scheduler_->NotifyReadyToCommit(); |
| 1772 scheduler_->NotifyReadyToActivate(); | 1772 scheduler_->NotifyReadyToActivate(); |
| 1773 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1773 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
| 1774 | 1774 |
| 1775 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); | 1775 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); |
| 1776 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); | 1776 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); |
| 1777 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1777 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
| 1778 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1778 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
| 1779 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); | 1779 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
| 1780 | 1780 |
| 1781 // Draw and swap for first commit, start second commit. | 1781 // Draw and swap for first commit, start second commit. |
| 1782 client_->Reset(); | 1782 client_->Reset(); |
| 1783 scheduler_->SetNeedsBeginMainFrame(); | 1783 scheduler_->SetNeedsBeginMainFrame(); |
| 1784 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1784 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
| 1785 EXPECT_SCOPED(AdvanceFrame()); | 1785 EXPECT_SCOPED(AdvanceFrame()); |
| 1786 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1786 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
| 1787 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1787 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1788 scheduler_->NotifyBeginMainFrameStarted(); | 1788 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1789 scheduler_->NotifyReadyToCommit(); | 1789 scheduler_->NotifyReadyToCommit(); |
| 1790 scheduler_->NotifyReadyToActivate(); | 1790 scheduler_->NotifyReadyToActivate(); |
| 1791 | 1791 |
| 1792 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); | 1792 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); |
| 1793 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 6); | 1793 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 6); |
| 1794 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 6); | 1794 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 6); |
| 1795 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 6); | 1795 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 6); |
| 1796 EXPECT_ACTION("ScheduledActionCommit", client_, 4, 6); | 1796 EXPECT_ACTION("ScheduledActionCommit", client_, 4, 6); |
| 1797 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 5, 6); | 1797 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 5, 6); |
| 1798 | 1798 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 | 1849 |
| 1850 EXPECT_NO_ACTION(client_); | 1850 EXPECT_NO_ACTION(client_); |
| 1851 | 1851 |
| 1852 // Then verify we operate in a low latency mode. | 1852 // Then verify we operate in a low latency mode. |
| 1853 client_->Reset(); | 1853 client_->Reset(); |
| 1854 // Previous commit request is still outstanding. | 1854 // Previous commit request is still outstanding. |
| 1855 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); | 1855 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); |
| 1856 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1856 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1857 SendNextBeginFrame(); | 1857 SendNextBeginFrame(); |
| 1858 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1858 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1859 scheduler_->NotifyBeginMainFrameStarted(); | 1859 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1860 scheduler_->NotifyReadyToCommit(); | 1860 scheduler_->NotifyReadyToCommit(); |
| 1861 scheduler_->NotifyReadyToActivate(); | 1861 scheduler_->NotifyReadyToActivate(); |
| 1862 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1862 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1863 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1863 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1864 scheduler_->DidSwapBuffersComplete(); | 1864 scheduler_->DidSwapBuffersComplete(); |
| 1865 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1865 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
| 1866 | 1866 |
| 1867 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); | 1867 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); |
| 1868 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); | 1868 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); |
| 1869 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); | 1869 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1891 // in a swap throttled state. | 1891 // in a swap throttled state. |
| 1892 client_->Reset(); | 1892 client_->Reset(); |
| 1893 EXPECT_FALSE(scheduler_->CommitPending()); | 1893 EXPECT_FALSE(scheduler_->CommitPending()); |
| 1894 scheduler_->SetNeedsBeginMainFrame(); | 1894 scheduler_->SetNeedsBeginMainFrame(); |
| 1895 scheduler_->SetNeedsRedraw(); | 1895 scheduler_->SetNeedsRedraw(); |
| 1896 EXPECT_SCOPED(AdvanceFrame()); | 1896 EXPECT_SCOPED(AdvanceFrame()); |
| 1897 EXPECT_TRUE(scheduler_->CommitPending()); | 1897 EXPECT_TRUE(scheduler_->CommitPending()); |
| 1898 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1898 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1899 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1899 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1900 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1900 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1901 scheduler_->NotifyBeginMainFrameStarted(); | 1901 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1902 scheduler_->NotifyReadyToCommit(); | 1902 scheduler_->NotifyReadyToCommit(); |
| 1903 scheduler_->NotifyReadyToActivate(); | 1903 scheduler_->NotifyReadyToActivate(); |
| 1904 EXPECT_FALSE(scheduler_->CommitPending()); | 1904 EXPECT_FALSE(scheduler_->CommitPending()); |
| 1905 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 7); | 1905 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 7); |
| 1906 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 7); | 1906 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 7); |
| 1907 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 7); | 1907 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 7); |
| 1908 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 7); | 1908 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 7); |
| 1909 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 7); | 1909 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 7); |
| 1910 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 7); | 1910 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 7); |
| 1911 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 6, 7); | 1911 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 6, 7); |
| 1912 | 1912 |
| 1913 // Make sure that we can finish the next commit even while swap throttled. | 1913 // Make sure that we can finish the next commit even while swap throttled. |
| 1914 client_->Reset(); | 1914 client_->Reset(); |
| 1915 EXPECT_FALSE(scheduler_->CommitPending()); | 1915 EXPECT_FALSE(scheduler_->CommitPending()); |
| 1916 scheduler_->SetNeedsBeginMainFrame(); | 1916 scheduler_->SetNeedsBeginMainFrame(); |
| 1917 EXPECT_SCOPED(AdvanceFrame()); | 1917 EXPECT_SCOPED(AdvanceFrame()); |
| 1918 scheduler_->NotifyBeginMainFrameStarted(); | 1918 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1919 scheduler_->NotifyReadyToCommit(); | 1919 scheduler_->NotifyReadyToCommit(); |
| 1920 scheduler_->NotifyReadyToActivate(); | 1920 scheduler_->NotifyReadyToActivate(); |
| 1921 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1921 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1922 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1922 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1923 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1923 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1924 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); | 1924 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); |
| 1925 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 5); | 1925 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 5); |
| 1926 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1926 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
| 1927 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1927 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
| 1928 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 5); | 1928 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 5); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 client_->Reset(); | 1963 client_->Reset(); |
| 1964 EXPECT_FALSE(scheduler_->CommitPending()); | 1964 EXPECT_FALSE(scheduler_->CommitPending()); |
| 1965 scheduler_->SetNeedsBeginMainFrame(); | 1965 scheduler_->SetNeedsBeginMainFrame(); |
| 1966 scheduler_->SetNeedsRedraw(); | 1966 scheduler_->SetNeedsRedraw(); |
| 1967 EXPECT_SCOPED(AdvanceFrame()); | 1967 EXPECT_SCOPED(AdvanceFrame()); |
| 1968 EXPECT_TRUE(scheduler_->CommitPending()); | 1968 EXPECT_TRUE(scheduler_->CommitPending()); |
| 1969 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1969 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1970 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1970 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1971 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1971 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1972 scheduler_->DidSwapBuffersComplete(); | 1972 scheduler_->DidSwapBuffersComplete(); |
| 1973 scheduler_->NotifyBeginMainFrameStarted(); | 1973 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1974 scheduler_->NotifyReadyToCommit(); | 1974 scheduler_->NotifyReadyToCommit(); |
| 1975 EXPECT_FALSE(scheduler_->CommitPending()); | 1975 EXPECT_FALSE(scheduler_->CommitPending()); |
| 1976 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); | 1976 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); |
| 1977 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); | 1977 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); |
| 1978 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); | 1978 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); |
| 1979 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); | 1979 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); |
| 1980 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); | 1980 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); |
| 1981 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); | 1981 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); |
| 1982 | 1982 |
| 1983 // Start another commit while we still have aa pending tree. | 1983 // Start another commit while we still have aa pending tree. |
| 1984 // Enter a swap throttled state. | 1984 // Enter a swap throttled state. |
| 1985 client_->Reset(); | 1985 client_->Reset(); |
| 1986 EXPECT_FALSE(scheduler_->CommitPending()); | 1986 EXPECT_FALSE(scheduler_->CommitPending()); |
| 1987 scheduler_->SetNeedsBeginMainFrame(); | 1987 scheduler_->SetNeedsBeginMainFrame(); |
| 1988 scheduler_->SetNeedsRedraw(); | 1988 scheduler_->SetNeedsRedraw(); |
| 1989 EXPECT_SCOPED(AdvanceFrame()); | 1989 EXPECT_SCOPED(AdvanceFrame()); |
| 1990 EXPECT_TRUE(scheduler_->CommitPending()); | 1990 EXPECT_TRUE(scheduler_->CommitPending()); |
| 1991 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1991 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1992 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1992 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 1993 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1993 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 1994 scheduler_->NotifyBeginMainFrameStarted(); | 1994 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 1995 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); | 1995 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); |
| 1996 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); | 1996 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); |
| 1997 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); | 1997 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); |
| 1998 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1998 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
| 1999 | 1999 |
| 2000 // Can't commit yet because there's still a pending tree. | 2000 // Can't commit yet because there's still a pending tree. |
| 2001 client_->Reset(); | 2001 client_->Reset(); |
| 2002 scheduler_->NotifyReadyToCommit(); | 2002 scheduler_->NotifyReadyToCommit(); |
| 2003 EXPECT_NO_ACTION(client_); | 2003 EXPECT_NO_ACTION(client_); |
| 2004 | 2004 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 client_->Reset(); | 2044 client_->Reset(); |
| 2045 EXPECT_FALSE(scheduler_->CommitPending()); | 2045 EXPECT_FALSE(scheduler_->CommitPending()); |
| 2046 scheduler_->SetNeedsBeginMainFrame(); | 2046 scheduler_->SetNeedsBeginMainFrame(); |
| 2047 scheduler_->SetNeedsRedraw(); | 2047 scheduler_->SetNeedsRedraw(); |
| 2048 EXPECT_SCOPED(AdvanceFrame()); | 2048 EXPECT_SCOPED(AdvanceFrame()); |
| 2049 EXPECT_TRUE(scheduler_->CommitPending()); | 2049 EXPECT_TRUE(scheduler_->CommitPending()); |
| 2050 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2050 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2051 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2051 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 2052 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2052 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2053 scheduler_->DidSwapBuffersComplete(); | 2053 scheduler_->DidSwapBuffersComplete(); |
| 2054 scheduler_->NotifyBeginMainFrameStarted(); | 2054 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2055 scheduler_->NotifyReadyToCommit(); | 2055 scheduler_->NotifyReadyToCommit(); |
| 2056 EXPECT_FALSE(scheduler_->CommitPending()); | 2056 EXPECT_FALSE(scheduler_->CommitPending()); |
| 2057 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); | 2057 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); |
| 2058 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); | 2058 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); |
| 2059 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); | 2059 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); |
| 2060 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); | 2060 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); |
| 2061 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); | 2061 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); |
| 2062 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); | 2062 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); |
| 2063 | 2063 |
| 2064 // Start another commit while we still have an active tree. | 2064 // Start another commit while we still have an active tree. |
| 2065 client_->Reset(); | 2065 client_->Reset(); |
| 2066 EXPECT_FALSE(scheduler_->CommitPending()); | 2066 EXPECT_FALSE(scheduler_->CommitPending()); |
| 2067 scheduler_->SetNeedsBeginMainFrame(); | 2067 scheduler_->SetNeedsBeginMainFrame(); |
| 2068 scheduler_->SetNeedsRedraw(); | 2068 scheduler_->SetNeedsRedraw(); |
| 2069 EXPECT_SCOPED(AdvanceFrame()); | 2069 EXPECT_SCOPED(AdvanceFrame()); |
| 2070 EXPECT_TRUE(scheduler_->CommitPending()); | 2070 EXPECT_TRUE(scheduler_->CommitPending()); |
| 2071 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2071 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2072 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2072 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 2073 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2073 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2074 scheduler_->DidSwapBuffersComplete(); | 2074 scheduler_->DidSwapBuffersComplete(); |
| 2075 scheduler_->NotifyBeginMainFrameStarted(); | 2075 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2076 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); | 2076 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); |
| 2077 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); | 2077 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); |
| 2078 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); | 2078 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); |
| 2079 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 2079 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
| 2080 | 2080 |
| 2081 // Can't commit yet because there's still a pending tree. | 2081 // Can't commit yet because there's still a pending tree. |
| 2082 client_->Reset(); | 2082 client_->Reset(); |
| 2083 scheduler_->NotifyReadyToCommit(); | 2083 scheduler_->NotifyReadyToCommit(); |
| 2084 EXPECT_NO_ACTION(client_); | 2084 EXPECT_NO_ACTION(client_); |
| 2085 | 2085 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 fake_external_begin_frame_source()->TestOnBeginFrame(args); | 2119 fake_external_begin_frame_source()->TestOnBeginFrame(args); |
| 2120 | 2120 |
| 2121 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 2121 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
| 2122 task_runner().RunPendingTasks(); // Run posted deadline. | 2122 task_runner().RunPendingTasks(); // Run posted deadline. |
| 2123 EXPECT_NO_ACTION(client_); | 2123 EXPECT_NO_ACTION(client_); |
| 2124 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2124 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2125 EXPECT_TRUE(client_->needs_begin_frames()); | 2125 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2126 client_->Reset(); | 2126 client_->Reset(); |
| 2127 | 2127 |
| 2128 // NotifyReadyToCommit should trigger the commit. | 2128 // NotifyReadyToCommit should trigger the commit. |
| 2129 scheduler_->NotifyBeginMainFrameStarted(); | 2129 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2130 scheduler_->NotifyReadyToCommit(); | 2130 scheduler_->NotifyReadyToCommit(); |
| 2131 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2131 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2132 EXPECT_TRUE(client_->needs_begin_frames()); | 2132 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2133 client_->Reset(); | 2133 client_->Reset(); |
| 2134 | 2134 |
| 2135 // NotifyReadyToActivate should trigger the activation. | 2135 // NotifyReadyToActivate should trigger the activation. |
| 2136 scheduler_->NotifyReadyToActivate(); | 2136 scheduler_->NotifyReadyToActivate(); |
| 2137 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2137 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2138 EXPECT_TRUE(client_->needs_begin_frames()); | 2138 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2139 client_->Reset(); | 2139 client_->Reset(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 EXPECT_TRUE(client_->needs_begin_frames()); | 2174 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2175 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2175 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 2176 | 2176 |
| 2177 client_->Reset(); | 2177 client_->Reset(); |
| 2178 EXPECT_SCOPED(AdvanceFrame()); | 2178 EXPECT_SCOPED(AdvanceFrame()); |
| 2179 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2179 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2180 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2180 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2181 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2181 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2182 | 2182 |
| 2183 client_->Reset(); | 2183 client_->Reset(); |
| 2184 scheduler_->NotifyBeginMainFrameStarted(); | 2184 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2185 | 2185 |
| 2186 client_->Reset(); | 2186 client_->Reset(); |
| 2187 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); | 2187 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); |
| 2188 // This BeginFrame is queued up as a retro frame. | 2188 // This BeginFrame is queued up as a retro frame. |
| 2189 EXPECT_NO_ACTION(client_); | 2189 EXPECT_NO_ACTION(client_); |
| 2190 // The previous deadline is still pending. | 2190 // The previous deadline is still pending. |
| 2191 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2191 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2192 | 2192 |
| 2193 client_->Reset(); | 2193 client_->Reset(); |
| 2194 // This main frame activating should schedule the (previous) deadline to | 2194 // This main frame activating should schedule the (previous) deadline to |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 EXPECT_TRUE(client_->needs_begin_frames()); | 2235 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2236 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2236 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 2237 | 2237 |
| 2238 client_->Reset(); | 2238 client_->Reset(); |
| 2239 EXPECT_SCOPED(AdvanceFrame()); | 2239 EXPECT_SCOPED(AdvanceFrame()); |
| 2240 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2240 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2241 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2241 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2242 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2242 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2243 | 2243 |
| 2244 client_->Reset(); | 2244 client_->Reset(); |
| 2245 scheduler_->NotifyBeginMainFrameStarted(); | 2245 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2246 | 2246 |
| 2247 client_->Reset(); | 2247 client_->Reset(); |
| 2248 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); | 2248 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); |
| 2249 // This BeginFrame is queued up as a retro frame. | 2249 // This BeginFrame is queued up as a retro frame. |
| 2250 EXPECT_NO_ACTION(client_); | 2250 EXPECT_NO_ACTION(client_); |
| 2251 // The previous deadline is still pending. | 2251 // The previous deadline is still pending. |
| 2252 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2252 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2253 | 2253 |
| 2254 client_->Reset(); | 2254 client_->Reset(); |
| 2255 // This main frame activating should schedule the (previous) deadline to | 2255 // This main frame activating should schedule the (previous) deadline to |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2352 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2353 client_->Reset(); | 2353 client_->Reset(); |
| 2354 | 2354 |
| 2355 // If we don't swap on the deadline, we wait for the next BeginFrame. | 2355 // If we don't swap on the deadline, we wait for the next BeginFrame. |
| 2356 task_runner().RunPendingTasks(); // Run posted deadline. | 2356 task_runner().RunPendingTasks(); // Run posted deadline. |
| 2357 EXPECT_NO_ACTION(client_); | 2357 EXPECT_NO_ACTION(client_); |
| 2358 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2358 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2359 client_->Reset(); | 2359 client_->Reset(); |
| 2360 | 2360 |
| 2361 // NotifyReadyToCommit should trigger the commit. | 2361 // NotifyReadyToCommit should trigger the commit. |
| 2362 scheduler_->NotifyBeginMainFrameStarted(); | 2362 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2363 scheduler_->NotifyReadyToCommit(); | 2363 scheduler_->NotifyReadyToCommit(); |
| 2364 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2364 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2365 client_->Reset(); | 2365 client_->Reset(); |
| 2366 | 2366 |
| 2367 // NotifyReadyToActivate should trigger the activation. | 2367 // NotifyReadyToActivate should trigger the activation. |
| 2368 scheduler_->NotifyReadyToActivate(); | 2368 scheduler_->NotifyReadyToActivate(); |
| 2369 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2369 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2370 client_->Reset(); | 2370 client_->Reset(); |
| 2371 | 2371 |
| 2372 // BeginImplFrame should prepare the draw. | 2372 // BeginImplFrame should prepare the draw. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2442 client_->Reset(); | 2442 client_->Reset(); |
| 2443 | 2443 |
| 2444 // Trigger the first BeginImplFrame and BeginMainFrame | 2444 // Trigger the first BeginImplFrame and BeginMainFrame |
| 2445 EXPECT_SCOPED(AdvanceFrame()); | 2445 EXPECT_SCOPED(AdvanceFrame()); |
| 2446 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2446 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2447 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2447 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2448 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2448 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2449 client_->Reset(); | 2449 client_->Reset(); |
| 2450 | 2450 |
| 2451 // NotifyReadyToCommit should trigger the pending commit. | 2451 // NotifyReadyToCommit should trigger the pending commit. |
| 2452 scheduler_->NotifyBeginMainFrameStarted(); | 2452 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2453 scheduler_->NotifyReadyToCommit(); | 2453 scheduler_->NotifyReadyToCommit(); |
| 2454 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2454 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2455 client_->Reset(); | 2455 client_->Reset(); |
| 2456 | 2456 |
| 2457 // NotifyReadyToActivate should trigger the activation and draw. | 2457 // NotifyReadyToActivate should trigger the activation and draw. |
| 2458 scheduler_->NotifyReadyToActivate(); | 2458 scheduler_->NotifyReadyToActivate(); |
| 2459 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2459 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2460 client_->Reset(); | 2460 client_->Reset(); |
| 2461 | 2461 |
| 2462 // Swapping will put us into a swap throttled state. | 2462 // Swapping will put us into a swap throttled state. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2567 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2567 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2568 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2568 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2569 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2569 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2570 | 2570 |
| 2571 client_->Reset(); | 2571 client_->Reset(); |
| 2572 scheduler_->DidLoseOutputSurface(); | 2572 scheduler_->DidLoseOutputSurface(); |
| 2573 // SetNeedsBeginFrames(false) is not called until the end of the frame. | 2573 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
| 2574 EXPECT_NO_ACTION(client_); | 2574 EXPECT_NO_ACTION(client_); |
| 2575 | 2575 |
| 2576 client_->Reset(); | 2576 client_->Reset(); |
| 2577 scheduler_->NotifyBeginMainFrameStarted(); | 2577 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2578 scheduler_->NotifyReadyToCommit(); | 2578 scheduler_->NotifyReadyToCommit(); |
| 2579 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2); | 2579 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2); |
| 2580 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2); | 2580 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2); |
| 2581 | 2581 |
| 2582 client_->Reset(); | 2582 client_->Reset(); |
| 2583 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2583 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 2584 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); | 2584 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); |
| 2585 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); | 2585 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); |
| 2586 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); | 2586 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); |
| 2587 } | 2587 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2617 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2617 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2618 | 2618 |
| 2619 // BeginImplFrame is not started. | 2619 // BeginImplFrame is not started. |
| 2620 client_->Reset(); | 2620 client_->Reset(); |
| 2621 task_runner().RunUntilTime(now_src()->NowTicks() + | 2621 task_runner().RunUntilTime(now_src()->NowTicks() + |
| 2622 base::TimeDelta::FromMilliseconds(10)); | 2622 base::TimeDelta::FromMilliseconds(10)); |
| 2623 EXPECT_NO_ACTION(client_); | 2623 EXPECT_NO_ACTION(client_); |
| 2624 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2624 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2625 | 2625 |
| 2626 client_->Reset(); | 2626 client_->Reset(); |
| 2627 scheduler_->NotifyBeginMainFrameStarted(); | 2627 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2628 scheduler_->NotifyReadyToCommit(); | 2628 scheduler_->NotifyReadyToCommit(); |
| 2629 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); | 2629 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
| 2630 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); | 2630 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
| 2631 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 2, 3); | 2631 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 2, 3); |
| 2632 } | 2632 } |
| 2633 | 2633 |
| 2634 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { | 2634 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { |
| 2635 scheduler_settings_.use_external_begin_frame_source = true; | 2635 scheduler_settings_.use_external_begin_frame_source = true; |
| 2636 SetUpScheduler(true); | 2636 SetUpScheduler(true); |
| 2637 | 2637 |
| 2638 // SetNeedsBeginMainFrame should begin the frame. | 2638 // SetNeedsBeginMainFrame should begin the frame. |
| 2639 scheduler_->SetNeedsBeginMainFrame(); | 2639 scheduler_->SetNeedsBeginMainFrame(); |
| 2640 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2640 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 2641 | 2641 |
| 2642 client_->Reset(); | 2642 client_->Reset(); |
| 2643 EXPECT_SCOPED(AdvanceFrame()); | 2643 EXPECT_SCOPED(AdvanceFrame()); |
| 2644 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2644 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2645 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2645 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2646 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2646 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2647 | 2647 |
| 2648 client_->Reset(); | 2648 client_->Reset(); |
| 2649 scheduler_->NotifyBeginMainFrameStarted(); | 2649 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2650 scheduler_->NotifyReadyToCommit(); | 2650 scheduler_->NotifyReadyToCommit(); |
| 2651 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2651 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2652 | 2652 |
| 2653 client_->Reset(); | 2653 client_->Reset(); |
| 2654 scheduler_->DidLoseOutputSurface(); | 2654 scheduler_->DidLoseOutputSurface(); |
| 2655 // Sync tree should be forced to activate. | 2655 // Sync tree should be forced to activate. |
| 2656 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2656 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2657 | 2657 |
| 2658 // SetNeedsBeginFrames(false) is not called until the end of the frame. | 2658 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
| 2659 client_->Reset(); | 2659 client_->Reset(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2718 | 2718 |
| 2719 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 2719 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
| 2720 client_->Reset(); | 2720 client_->Reset(); |
| 2721 task_runner().RunPendingTasks(); // Run posted deadline. | 2721 task_runner().RunPendingTasks(); // Run posted deadline. |
| 2722 EXPECT_NO_ACTION(client_); | 2722 EXPECT_NO_ACTION(client_); |
| 2723 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2723 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2724 EXPECT_TRUE(client_->needs_begin_frames()); | 2724 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2725 | 2725 |
| 2726 // NotifyReadyToCommit should trigger the commit. | 2726 // NotifyReadyToCommit should trigger the commit. |
| 2727 client_->Reset(); | 2727 client_->Reset(); |
| 2728 scheduler_->NotifyBeginMainFrameStarted(); | 2728 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2729 scheduler_->NotifyReadyToCommit(); | 2729 scheduler_->NotifyReadyToCommit(); |
| 2730 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2730 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2731 EXPECT_TRUE(client_->needs_begin_frames()); | 2731 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2732 | 2732 |
| 2733 // NotifyReadyToActivate should trigger the activation. | 2733 // NotifyReadyToActivate should trigger the activation. |
| 2734 client_->Reset(); | 2734 client_->Reset(); |
| 2735 scheduler_->NotifyReadyToActivate(); | 2735 scheduler_->NotifyReadyToActivate(); |
| 2736 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2736 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2737 EXPECT_TRUE(client_->needs_begin_frames()); | 2737 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2738 | 2738 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 | 2778 |
| 2779 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 2779 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
| 2780 client_->Reset(); | 2780 client_->Reset(); |
| 2781 task_runner().RunPendingTasks(); // Run posted deadline. | 2781 task_runner().RunPendingTasks(); // Run posted deadline. |
| 2782 EXPECT_NO_ACTION(client_); | 2782 EXPECT_NO_ACTION(client_); |
| 2783 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2783 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2784 EXPECT_TRUE(client_->needs_begin_frames()); | 2784 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2785 | 2785 |
| 2786 // NotifyReadyToCommit should trigger the commit. | 2786 // NotifyReadyToCommit should trigger the commit. |
| 2787 client_->Reset(); | 2787 client_->Reset(); |
| 2788 scheduler_->NotifyBeginMainFrameStarted(); | 2788 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2789 scheduler_->NotifyReadyToCommit(); | 2789 scheduler_->NotifyReadyToCommit(); |
| 2790 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2790 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2791 EXPECT_TRUE(client_->needs_begin_frames()); | 2791 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2792 | 2792 |
| 2793 // NotifyReadyToActivate should trigger the activation. | 2793 // NotifyReadyToActivate should trigger the activation. |
| 2794 client_->Reset(); | 2794 client_->Reset(); |
| 2795 scheduler_->NotifyReadyToActivate(); | 2795 scheduler_->NotifyReadyToActivate(); |
| 2796 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2796 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2797 EXPECT_TRUE(client_->needs_begin_frames()); | 2797 EXPECT_TRUE(client_->needs_begin_frames()); |
| 2798 | 2798 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2835 | 2835 |
| 2836 client_->Reset(); | 2836 client_->Reset(); |
| 2837 AdvanceFrame(); | 2837 AdvanceFrame(); |
| 2838 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2838 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2839 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2839 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2840 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2840 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2841 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2841 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
| 2842 | 2842 |
| 2843 // NotifyReadyToCommit should trigger the commit. | 2843 // NotifyReadyToCommit should trigger the commit. |
| 2844 client_->Reset(); | 2844 client_->Reset(); |
| 2845 scheduler_->NotifyBeginMainFrameStarted(); | 2845 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2846 scheduler_->NotifyReadyToCommit(); | 2846 scheduler_->NotifyReadyToCommit(); |
| 2847 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2847 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2848 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2848 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
| 2849 | 2849 |
| 2850 // NotifyReadyToActivate should trigger the activation. | 2850 // NotifyReadyToActivate should trigger the activation. |
| 2851 client_->Reset(); | 2851 client_->Reset(); |
| 2852 scheduler_->NotifyReadyToActivate(); | 2852 scheduler_->NotifyReadyToActivate(); |
| 2853 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2853 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2854 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2854 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
| 2855 | 2855 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2874 scheduler_->SetNeedsBeginMainFrame(); | 2874 scheduler_->SetNeedsBeginMainFrame(); |
| 2875 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2875 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 2876 | 2876 |
| 2877 client_->Reset(); | 2877 client_->Reset(); |
| 2878 EXPECT_SCOPED(AdvanceFrame()); | 2878 EXPECT_SCOPED(AdvanceFrame()); |
| 2879 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2879 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2880 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2880 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2881 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2881 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2882 | 2882 |
| 2883 client_->Reset(); | 2883 client_->Reset(); |
| 2884 scheduler_->NotifyBeginMainFrameStarted(); | 2884 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2885 scheduler_->NotifyReadyToCommit(); | 2885 scheduler_->NotifyReadyToCommit(); |
| 2886 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2886 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2887 | 2887 |
| 2888 client_->Reset(); | 2888 client_->Reset(); |
| 2889 scheduler_->NotifyReadyToActivate(); | 2889 scheduler_->NotifyReadyToActivate(); |
| 2890 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2890 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 2891 | 2891 |
| 2892 client_->Reset(); | 2892 client_->Reset(); |
| 2893 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2893 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 2894 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); | 2894 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2910 scheduler_->SetNeedsBeginMainFrame(); | 2910 scheduler_->SetNeedsBeginMainFrame(); |
| 2911 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2911 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 2912 | 2912 |
| 2913 client_->Reset(); | 2913 client_->Reset(); |
| 2914 EXPECT_SCOPED(AdvanceFrame()); | 2914 EXPECT_SCOPED(AdvanceFrame()); |
| 2915 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2915 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 2916 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2916 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 2917 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2917 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2918 | 2918 |
| 2919 client_->Reset(); | 2919 client_->Reset(); |
| 2920 scheduler_->NotifyBeginMainFrameStarted(); | 2920 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 2921 scheduler_->NotifyReadyToCommit(); | 2921 scheduler_->NotifyReadyToCommit(); |
| 2922 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2922 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2923 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2923 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 2924 | 2924 |
| 2925 client_->Reset(); | 2925 client_->Reset(); |
| 2926 scheduler_->SetVisible(false); | 2926 scheduler_->SetVisible(false); |
| 2927 task_runner().RunPendingTasks(); // Run posted deadline. | 2927 task_runner().RunPendingTasks(); // Run posted deadline. |
| 2928 | 2928 |
| 2929 // Sync tree should be forced to activate. | 2929 // Sync tree should be forced to activate. |
| 2930 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 3); | 2930 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 3); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3054 scheduler_settings_.use_external_begin_frame_source = true; | 3054 scheduler_settings_.use_external_begin_frame_source = true; |
| 3055 SetUpScheduler(true); | 3055 SetUpScheduler(true); |
| 3056 | 3056 |
| 3057 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. | 3057 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. |
| 3058 scheduler_->SetNeedsBeginMainFrame(); | 3058 scheduler_->SetNeedsBeginMainFrame(); |
| 3059 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 3059 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 3060 client_->Reset(); | 3060 client_->Reset(); |
| 3061 | 3061 |
| 3062 // Trigger a frame draw. | 3062 // Trigger a frame draw. |
| 3063 EXPECT_SCOPED(AdvanceFrame()); | 3063 EXPECT_SCOPED(AdvanceFrame()); |
| 3064 scheduler_->NotifyBeginMainFrameStarted(); | 3064 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 3065 scheduler_->NotifyReadyToCommit(); | 3065 scheduler_->NotifyReadyToCommit(); |
| 3066 scheduler_->NotifyReadyToActivate(); | 3066 scheduler_->NotifyReadyToActivate(); |
| 3067 task_runner().RunPendingTasks(); | 3067 task_runner().RunPendingTasks(); |
| 3068 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); | 3068 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); |
| 3069 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); | 3069 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); |
| 3070 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); | 3070 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); |
| 3071 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 6); | 3071 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 6); |
| 3072 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 6); | 3072 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 6); |
| 3073 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 5, 6); | 3073 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 5, 6); |
| 3074 client_->Reset(); | 3074 client_->Reset(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3174 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 3174 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 3175 client_->Reset(); | 3175 client_->Reset(); |
| 3176 | 3176 |
| 3177 // Next vsync. | 3177 // Next vsync. |
| 3178 AdvanceFrame(); | 3178 AdvanceFrame(); |
| 3179 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 3179 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 3180 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 3180 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 3181 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3181 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 3182 client_->Reset(); | 3182 client_->Reset(); |
| 3183 | 3183 |
| 3184 scheduler_->NotifyBeginMainFrameStarted(); | 3184 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 3185 EXPECT_NO_ACTION(client_); | 3185 EXPECT_NO_ACTION(client_); |
| 3186 | 3186 |
| 3187 // Next vsync. | 3187 // Next vsync. |
| 3188 AdvanceFrame(); | 3188 AdvanceFrame(); |
| 3189 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 3189 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
| 3190 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3190 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 3191 client_->Reset(); | 3191 client_->Reset(); |
| 3192 | 3192 |
| 3193 scheduler_->NotifyReadyToCommit(); | 3193 scheduler_->NotifyReadyToCommit(); |
| 3194 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3194 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3231 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 3231 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 3232 client_->Reset(); | 3232 client_->Reset(); |
| 3233 | 3233 |
| 3234 // Next vsync. | 3234 // Next vsync. |
| 3235 AdvanceFrame(); | 3235 AdvanceFrame(); |
| 3236 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 3236 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
| 3237 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 3237 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
| 3238 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3238 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 3239 client_->Reset(); | 3239 client_->Reset(); |
| 3240 | 3240 |
| 3241 scheduler_->NotifyBeginMainFrameStarted(); | 3241 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 3242 EXPECT_NO_ACTION(client_); | 3242 EXPECT_NO_ACTION(client_); |
| 3243 | 3243 |
| 3244 scheduler_->NotifyReadyToCommit(); | 3244 scheduler_->NotifyReadyToCommit(); |
| 3245 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3245 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 3246 client_->Reset(); | 3246 client_->Reset(); |
| 3247 | 3247 |
| 3248 scheduler_->NotifyReadyToActivate(); | 3248 scheduler_->NotifyReadyToActivate(); |
| 3249 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 3249 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 3250 client_->Reset(); | 3250 client_->Reset(); |
| 3251 | 3251 |
| 3252 // Ask for another commit. | 3252 // Ask for another commit. |
| 3253 scheduler_->SetNeedsBeginMainFrame(); | 3253 scheduler_->SetNeedsBeginMainFrame(); |
| 3254 | 3254 |
| 3255 AdvanceFrame(); | 3255 AdvanceFrame(); |
| 3256 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); | 3256 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); |
| 3257 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); | 3257 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); |
| 3258 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); | 3258 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); |
| 3259 EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 3, 4); | 3259 EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 3, 4); |
| 3260 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3260 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 3261 client_->Reset(); | 3261 client_->Reset(); |
| 3262 | 3262 |
| 3263 scheduler_->NotifyBeginMainFrameStarted(); | 3263 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 3264 EXPECT_NO_ACTION(client_); | 3264 EXPECT_NO_ACTION(client_); |
| 3265 | 3265 |
| 3266 // Allow new commit even though previous commit hasn't been drawn. | 3266 // Allow new commit even though previous commit hasn't been drawn. |
| 3267 scheduler_->NotifyReadyToCommit(); | 3267 scheduler_->NotifyReadyToCommit(); |
| 3268 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3268 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 3269 client_->Reset(); | 3269 client_->Reset(); |
| 3270 } | 3270 } |
| 3271 | 3271 |
| 3272 class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient { | 3272 class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient { |
| 3273 public: | 3273 public: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3350 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); | 3350 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
| 3351 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3351 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 3352 EXPECT_FALSE(scheduler_->PrepareTilesPending()); | 3352 EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
| 3353 client_->Reset(); | 3353 client_->Reset(); |
| 3354 | 3354 |
| 3355 // Simulate SetNeedsBeginMainFrame due to input event. | 3355 // Simulate SetNeedsBeginMainFrame due to input event. |
| 3356 scheduler_->SetNeedsBeginMainFrame(); | 3356 scheduler_->SetNeedsBeginMainFrame(); |
| 3357 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); | 3357 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); |
| 3358 client_->Reset(); | 3358 client_->Reset(); |
| 3359 | 3359 |
| 3360 scheduler_->NotifyBeginMainFrameStarted(); | 3360 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 3361 scheduler_->NotifyReadyToCommit(); | 3361 scheduler_->NotifyReadyToCommit(); |
| 3362 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3362 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 3363 client_->Reset(); | 3363 client_->Reset(); |
| 3364 | 3364 |
| 3365 scheduler_->NotifyReadyToActivate(); | 3365 scheduler_->NotifyReadyToActivate(); |
| 3366 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 3366 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
| 3367 client_->Reset(); | 3367 client_->Reset(); |
| 3368 | 3368 |
| 3369 // Next vsync. | 3369 // Next vsync. |
| 3370 EXPECT_SCOPED(AdvanceFrame()); | 3370 EXPECT_SCOPED(AdvanceFrame()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3409 SetUpScheduler(true); | 3409 SetUpScheduler(true); |
| 3410 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval(); | 3410 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval(); |
| 3411 base::TimeDelta authoritative_interval = | 3411 base::TimeDelta authoritative_interval = |
| 3412 base::TimeDelta::FromMilliseconds(33); | 3412 base::TimeDelta::FromMilliseconds(33); |
| 3413 | 3413 |
| 3414 scheduler_->SetNeedsBeginMainFrame(); | 3414 scheduler_->SetNeedsBeginMainFrame(); |
| 3415 EXPECT_SCOPED(AdvanceFrame()); | 3415 EXPECT_SCOPED(AdvanceFrame()); |
| 3416 | 3416 |
| 3417 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); | 3417 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); |
| 3418 | 3418 |
| 3419 scheduler_->NotifyBeginMainFrameStarted(); | 3419 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
| 3420 scheduler_->NotifyReadyToCommit(); | 3420 scheduler_->NotifyReadyToCommit(); |
| 3421 scheduler_->NotifyReadyToActivate(); | 3421 scheduler_->NotifyReadyToActivate(); |
| 3422 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 3422 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 3423 | 3423 |
| 3424 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); | 3424 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); |
| 3425 | 3425 |
| 3426 EXPECT_SCOPED(AdvanceFrame()); | 3426 EXPECT_SCOPED(AdvanceFrame()); |
| 3427 | 3427 |
| 3428 // At the next BeginFrame, authoritative interval is used instead of previous | 3428 // At the next BeginFrame, authoritative interval is used instead of previous |
| 3429 // interval. | 3429 // interval. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3459 scheduler_->SetImplLatencyTakesPriority(true); | 3459 scheduler_->SetImplLatencyTakesPriority(true); |
| 3460 scheduler_->SetChildrenNeedBeginFrames(true); | 3460 scheduler_->SetChildrenNeedBeginFrames(true); |
| 3461 | 3461 |
| 3462 EXPECT_SCOPED(AdvanceFrame()); | 3462 EXPECT_SCOPED(AdvanceFrame()); |
| 3463 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 3463 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
| 3464 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); | 3464 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); |
| 3465 } | 3465 } |
| 3466 | 3466 |
| 3467 } // namespace | 3467 } // namespace |
| 3468 } // namespace cc | 3468 } // namespace cc |
| OLD | NEW |