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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 scheduler_->DidCreateAndInitializeOutputSurface(); | 319 scheduler_->DidCreateAndInitializeOutputSurface(); |
320 scheduler_->SetNeedsBeginMainFrame(); | 320 scheduler_->SetNeedsBeginMainFrame(); |
321 EXPECT_TRUE(client_->needs_begin_frames()); | 321 EXPECT_TRUE(client_->needs_begin_frames()); |
322 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 322 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
323 client_->Reset(); | 323 client_->Reset(); |
324 | 324 |
325 { | 325 { |
326 SCOPED_TRACE("Do first frame to commit after initialize."); | 326 SCOPED_TRACE("Do first frame to commit after initialize."); |
327 AdvanceFrame(); | 327 AdvanceFrame(); |
328 | 328 |
329 scheduler_->NotifyBeginMainFrameStarted(); | 329 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
330 scheduler_->NotifyReadyToCommit(); | 330 scheduler_->NotifyReadyToCommit(); |
331 scheduler_->NotifyReadyToActivate(); | 331 scheduler_->NotifyReadyToActivate(); |
332 scheduler_->NotifyReadyToDraw(); | 332 scheduler_->NotifyReadyToDraw(); |
333 | 333 |
334 EXPECT_FALSE(scheduler_->CommitPending()); | 334 EXPECT_FALSE(scheduler_->CommitPending()); |
335 | 335 |
336 if (scheduler_settings_.using_synchronous_renderer_compositor) { | 336 if (scheduler_settings_.using_synchronous_renderer_compositor) { |
337 scheduler_->SetNeedsRedraw(); | 337 scheduler_->SetNeedsRedraw(); |
338 scheduler_->OnDrawForOutputSurface(); | 338 scheduler_->OnDrawForOutputSurface(); |
339 } else { | 339 } else { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 client_->Reset(); | 548 client_->Reset(); |
549 | 549 |
550 // If we don't swap on the deadline, we wait for the next BeginFrame. | 550 // If we don't swap on the deadline, we wait for the next BeginFrame. |
551 task_runner().RunPendingTasks(); // Run posted deadline. | 551 task_runner().RunPendingTasks(); // Run posted deadline. |
552 EXPECT_NO_ACTION(client_); | 552 EXPECT_NO_ACTION(client_); |
553 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 553 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
554 EXPECT_TRUE(client_->needs_begin_frames()); | 554 EXPECT_TRUE(client_->needs_begin_frames()); |
555 client_->Reset(); | 555 client_->Reset(); |
556 | 556 |
557 // NotifyReadyToCommit should trigger the commit. | 557 // NotifyReadyToCommit should trigger the commit. |
558 scheduler_->NotifyBeginMainFrameStarted(); | 558 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
559 scheduler_->NotifyReadyToCommit(); | 559 scheduler_->NotifyReadyToCommit(); |
560 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 560 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
561 EXPECT_TRUE(client_->needs_begin_frames()); | 561 EXPECT_TRUE(client_->needs_begin_frames()); |
562 client_->Reset(); | 562 client_->Reset(); |
563 | 563 |
564 // NotifyReadyToActivate should trigger the activation. | 564 // NotifyReadyToActivate should trigger the activation. |
565 scheduler_->NotifyReadyToActivate(); | 565 scheduler_->NotifyReadyToActivate(); |
566 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 566 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
567 EXPECT_TRUE(client_->needs_begin_frames()); | 567 EXPECT_TRUE(client_->needs_begin_frames()); |
568 client_->Reset(); | 568 client_->Reset(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 EXPECT_TRUE(client_->needs_begin_frames()); | 671 EXPECT_TRUE(client_->needs_begin_frames()); |
672 client_->Reset(); | 672 client_->Reset(); |
673 | 673 |
674 // Now SetNeedsBeginMainFrame again. Calling here means we need a second | 674 // Now SetNeedsBeginMainFrame again. Calling here means we need a second |
675 // commit. | 675 // commit. |
676 scheduler_->SetNeedsBeginMainFrame(); | 676 scheduler_->SetNeedsBeginMainFrame(); |
677 EXPECT_EQ(client_->num_actions_(), 0); | 677 EXPECT_EQ(client_->num_actions_(), 0); |
678 client_->Reset(); | 678 client_->Reset(); |
679 | 679 |
680 // Finish the first commit. | 680 // Finish the first commit. |
681 scheduler_->NotifyBeginMainFrameStarted(); | 681 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
682 scheduler_->NotifyReadyToCommit(); | 682 scheduler_->NotifyReadyToCommit(); |
683 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 683 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
684 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 684 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
685 client_->Reset(); | 685 client_->Reset(); |
686 | 686 |
687 // Activate it. | 687 // Activate it. |
688 scheduler_->NotifyReadyToActivate(); | 688 scheduler_->NotifyReadyToActivate(); |
689 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 689 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
690 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 690 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
691 client_->Reset(); | 691 client_->Reset(); |
(...skipping 10 matching lines...) Expand all Loading... |
702 // Since another commit is needed, the next BeginImplFrame should initiate | 702 // Since another commit is needed, the next BeginImplFrame should initiate |
703 // the second commit. | 703 // the second commit. |
704 EXPECT_SCOPED(AdvanceFrame()); | 704 EXPECT_SCOPED(AdvanceFrame()); |
705 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 705 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
706 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 706 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
707 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 707 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
708 client_->Reset(); | 708 client_->Reset(); |
709 | 709 |
710 // Finishing the commit before the deadline should post a new deadline task | 710 // Finishing the commit before the deadline should post a new deadline task |
711 // to trigger the deadline early. | 711 // to trigger the deadline early. |
712 scheduler_->NotifyBeginMainFrameStarted(); | 712 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
713 scheduler_->NotifyReadyToCommit(); | 713 scheduler_->NotifyReadyToCommit(); |
714 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 714 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
715 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 715 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
716 client_->Reset(); | 716 client_->Reset(); |
717 scheduler_->NotifyReadyToActivate(); | 717 scheduler_->NotifyReadyToActivate(); |
718 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 718 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
719 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 719 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
720 client_->Reset(); | 720 client_->Reset(); |
721 task_runner().RunPendingTasks(); // Run posted deadline. | 721 task_runner().RunPendingTasks(); // Run posted deadline. |
722 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); | 722 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 EXPECT_EQ(0, client->num_draws()); | 885 EXPECT_EQ(0, client->num_draws()); |
886 EXPECT_TRUE(client->needs_begin_frames()); | 886 EXPECT_TRUE(client->needs_begin_frames()); |
887 | 887 |
888 client->SetNeedsBeginMainFrameOnNextDraw(); | 888 client->SetNeedsBeginMainFrameOnNextDraw(); |
889 EXPECT_SCOPED(AdvanceFrame()); | 889 EXPECT_SCOPED(AdvanceFrame()); |
890 client->SetNeedsBeginMainFrameOnNextDraw(); | 890 client->SetNeedsBeginMainFrameOnNextDraw(); |
891 task_runner().RunPendingTasks(); // Run posted deadline. | 891 task_runner().RunPendingTasks(); // Run posted deadline. |
892 EXPECT_EQ(1, client->num_draws()); | 892 EXPECT_EQ(1, client->num_draws()); |
893 EXPECT_TRUE(scheduler_->CommitPending()); | 893 EXPECT_TRUE(scheduler_->CommitPending()); |
894 EXPECT_TRUE(client->needs_begin_frames()); | 894 EXPECT_TRUE(client->needs_begin_frames()); |
895 scheduler_->NotifyBeginMainFrameStarted(); | 895 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
896 scheduler_->NotifyReadyToCommit(); | 896 scheduler_->NotifyReadyToCommit(); |
897 scheduler_->NotifyReadyToActivate(); | 897 scheduler_->NotifyReadyToActivate(); |
898 | 898 |
899 EXPECT_SCOPED(AdvanceFrame()); | 899 EXPECT_SCOPED(AdvanceFrame()); |
900 task_runner().RunPendingTasks(); // Run posted deadline. | 900 task_runner().RunPendingTasks(); // Run posted deadline. |
901 EXPECT_EQ(2, client->num_draws()); | 901 EXPECT_EQ(2, client->num_draws()); |
902 | 902 |
903 EXPECT_FALSE(scheduler_->RedrawPending()); | 903 EXPECT_FALSE(scheduler_->RedrawPending()); |
904 EXPECT_FALSE(scheduler_->CommitPending()); | 904 EXPECT_FALSE(scheduler_->CommitPending()); |
905 EXPECT_TRUE(client->needs_begin_frames()); | 905 EXPECT_TRUE(client->needs_begin_frames()); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 scheduler_settings_.commit_to_active_tree = true; | 1271 scheduler_settings_.commit_to_active_tree = true; |
1272 SetUpScheduler(make_scoped_ptr(client).Pass(), true); | 1272 SetUpScheduler(make_scoped_ptr(client).Pass(), true); |
1273 | 1273 |
1274 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. | 1274 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. |
1275 scheduler_->SetNeedsBeginMainFrame(); | 1275 scheduler_->SetNeedsBeginMainFrame(); |
1276 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1276 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
1277 client_->Reset(); | 1277 client_->Reset(); |
1278 | 1278 |
1279 // Begin new frame. | 1279 // Begin new frame. |
1280 EXPECT_SCOPED(AdvanceFrame()); | 1280 EXPECT_SCOPED(AdvanceFrame()); |
1281 scheduler_->NotifyBeginMainFrameStarted(); | 1281 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1282 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1282 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1283 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1283 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1284 | 1284 |
1285 client_->Reset(); | 1285 client_->Reset(); |
1286 scheduler_->NotifyReadyToCommit(); | 1286 scheduler_->NotifyReadyToCommit(); |
1287 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 1287 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
1288 | 1288 |
1289 client_->Reset(); | 1289 client_->Reset(); |
1290 scheduler_->NotifyReadyToActivate(); | 1290 scheduler_->NotifyReadyToActivate(); |
1291 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 1291 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
(...skipping 19 matching lines...) Expand all Loading... |
1311 scheduler_settings_.commit_to_active_tree = true; | 1311 scheduler_settings_.commit_to_active_tree = true; |
1312 SetUpScheduler(make_scoped_ptr(client).Pass(), true); | 1312 SetUpScheduler(make_scoped_ptr(client).Pass(), true); |
1313 | 1313 |
1314 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. | 1314 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. |
1315 scheduler_->SetNeedsBeginMainFrame(); | 1315 scheduler_->SetNeedsBeginMainFrame(); |
1316 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 1316 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
1317 client_->Reset(); | 1317 client_->Reset(); |
1318 | 1318 |
1319 // Begin new frame. | 1319 // Begin new frame. |
1320 EXPECT_SCOPED(AdvanceFrame()); | 1320 EXPECT_SCOPED(AdvanceFrame()); |
1321 scheduler_->NotifyBeginMainFrameStarted(); | 1321 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1322 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1322 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1323 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1323 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1324 | 1324 |
1325 client_->Reset(); | 1325 client_->Reset(); |
1326 scheduler_->NotifyReadyToCommit(); | 1326 scheduler_->NotifyReadyToCommit(); |
1327 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 1327 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
1328 | 1328 |
1329 client_->Reset(); | 1329 client_->Reset(); |
1330 scheduler_->NotifyReadyToActivate(); | 1330 scheduler_->NotifyReadyToActivate(); |
1331 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 1331 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
(...skipping 16 matching lines...) Expand all Loading... |
1348 | 1348 |
1349 void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( | 1349 void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( |
1350 bool expect_send_begin_main_frame) { | 1350 bool expect_send_begin_main_frame) { |
1351 // Impl thread hits deadline before commit finishes. | 1351 // Impl thread hits deadline before commit finishes. |
1352 scheduler_->SetNeedsBeginMainFrame(); | 1352 scheduler_->SetNeedsBeginMainFrame(); |
1353 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1353 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1354 EXPECT_SCOPED(AdvanceFrame()); | 1354 EXPECT_SCOPED(AdvanceFrame()); |
1355 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1355 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1356 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1356 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1357 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1357 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1358 scheduler_->NotifyBeginMainFrameStarted(); | 1358 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1359 scheduler_->NotifyReadyToCommit(); | 1359 scheduler_->NotifyReadyToCommit(); |
1360 scheduler_->NotifyReadyToActivate(); | 1360 scheduler_->NotifyReadyToActivate(); |
1361 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); | 1361 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); |
1362 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); | 1362 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); |
1363 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1363 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
1364 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1364 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
1365 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); | 1365 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
1366 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1366 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1367 | 1367 |
1368 client_->Reset(); | 1368 client_->Reset(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 scheduler_->SetNeedsBeginMainFrame(); | 1471 scheduler_->SetNeedsBeginMainFrame(); |
1472 scheduler_->SetNeedsRedraw(); | 1472 scheduler_->SetNeedsRedraw(); |
1473 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1473 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1474 SendNextBeginFrame(); | 1474 SendNextBeginFrame(); |
1475 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 4); | 1475 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 4); |
1476 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 4); | 1476 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 4); |
1477 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1477 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
1478 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 4); | 1478 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 4); |
1479 | 1479 |
1480 client_->Reset(); | 1480 client_->Reset(); |
1481 scheduler_->NotifyBeginMainFrameStarted(); | 1481 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1482 scheduler_->NotifyReadyToCommit(); | 1482 scheduler_->NotifyReadyToCommit(); |
1483 scheduler_->NotifyReadyToActivate(); | 1483 scheduler_->NotifyReadyToActivate(); |
1484 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1484 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1485 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1485 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1486 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); | 1486 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); |
1487 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); | 1487 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); |
1488 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1488 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
1489 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1489 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
1490 | 1490 |
1491 // Verify we skip every other frame if the swap ack consistently | 1491 // Verify we skip every other frame if the swap ack consistently |
(...skipping 28 matching lines...) Expand all Loading... |
1520 // Verify that we start the next BeginImplFrame and continue normally | 1520 // Verify that we start the next BeginImplFrame and continue normally |
1521 // after having just skipped a BeginImplFrame. | 1521 // after having just skipped a BeginImplFrame. |
1522 client_->Reset(); | 1522 client_->Reset(); |
1523 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1523 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1524 SendNextBeginFrame(); | 1524 SendNextBeginFrame(); |
1525 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); | 1525 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); |
1526 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 3); | 1526 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 3); |
1527 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | 1527 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
1528 | 1528 |
1529 client_->Reset(); | 1529 client_->Reset(); |
1530 scheduler_->NotifyBeginMainFrameStarted(); | 1530 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1531 scheduler_->NotifyReadyToCommit(); | 1531 scheduler_->NotifyReadyToCommit(); |
1532 scheduler_->NotifyReadyToActivate(); | 1532 scheduler_->NotifyReadyToActivate(); |
1533 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1533 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1534 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); | 1534 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); |
1535 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); | 1535 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); |
1536 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1536 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
1537 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1537 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
1538 } | 1538 } |
1539 } | 1539 } |
1540 | 1540 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 // Draw and swap for first BeginFrame | 1657 // Draw and swap for first BeginFrame |
1658 client_->Reset(); | 1658 client_->Reset(); |
1659 scheduler_->SetNeedsBeginMainFrame(); | 1659 scheduler_->SetNeedsBeginMainFrame(); |
1660 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1660 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1661 SendNextBeginFrame(); | 1661 SendNextBeginFrame(); |
1662 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 3); | 1662 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 3); |
1663 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); | 1663 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); |
1664 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | 1664 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
1665 | 1665 |
1666 client_->Reset(); | 1666 client_->Reset(); |
1667 scheduler_->NotifyBeginMainFrameStarted(); | 1667 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1668 scheduler_->NotifyReadyToCommit(); | 1668 scheduler_->NotifyReadyToCommit(); |
1669 scheduler_->NotifyReadyToActivate(); | 1669 scheduler_->NotifyReadyToActivate(); |
1670 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1670 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1671 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1671 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1672 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); | 1672 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 4); |
1673 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); | 1673 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); |
1674 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1674 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
1675 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1675 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
1676 | 1676 |
1677 // Verify impl thread consistently operates in high latency mode | 1677 // Verify impl thread consistently operates in high latency mode |
1678 // without skipping any frames. | 1678 // without skipping any frames. |
1679 for (int i = 0; i < 10; i++) { | 1679 for (int i = 0; i < 10; i++) { |
1680 // Not calling scheduler_->DidSwapBuffersComplete() until after next frame | 1680 // Not calling scheduler_->DidSwapBuffersComplete() until after next frame |
1681 // puts the impl thread in high latency mode. | 1681 // puts the impl thread in high latency mode. |
1682 client_->Reset(); | 1682 client_->Reset(); |
1683 scheduler_->SetNeedsBeginMainFrame(); | 1683 scheduler_->SetNeedsBeginMainFrame(); |
1684 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1684 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1685 SendNextBeginFrame(); | 1685 SendNextBeginFrame(); |
1686 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 1686 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
1687 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1687 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1688 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1688 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1689 | 1689 |
1690 client_->Reset(); | 1690 client_->Reset(); |
1691 scheduler_->DidSwapBuffersComplete(); | 1691 scheduler_->DidSwapBuffersComplete(); |
1692 scheduler_->NotifyBeginMainFrameStarted(); | 1692 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1693 scheduler_->NotifyReadyToCommit(); | 1693 scheduler_->NotifyReadyToCommit(); |
1694 scheduler_->NotifyReadyToActivate(); | 1694 scheduler_->NotifyReadyToActivate(); |
1695 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1695 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1696 | 1696 |
1697 // Verify that we don't skip the actions of the BeginImplFrame | 1697 // Verify that we don't skip the actions of the BeginImplFrame |
1698 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 5); | 1698 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 5); |
1699 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 5); | 1699 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 5); |
1700 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 5); | 1700 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 5); |
1701 EXPECT_ACTION("ScheduledActionAnimate", client_, 3, 5); | 1701 EXPECT_ACTION("ScheduledActionAnimate", client_, 3, 5); |
1702 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); | 1702 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 | 1767 |
1768 // Impl thread hits deadline before commit finishes to make | 1768 // Impl thread hits deadline before commit finishes to make |
1769 // MainThreadMissedLastDeadline true | 1769 // MainThreadMissedLastDeadline true |
1770 client_->Reset(); | 1770 client_->Reset(); |
1771 scheduler_->SetNeedsBeginMainFrame(); | 1771 scheduler_->SetNeedsBeginMainFrame(); |
1772 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1772 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1773 EXPECT_SCOPED(AdvanceFrame()); | 1773 EXPECT_SCOPED(AdvanceFrame()); |
1774 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1774 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1775 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1775 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1776 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1776 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1777 scheduler_->NotifyBeginMainFrameStarted(); | 1777 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1778 scheduler_->NotifyReadyToCommit(); | 1778 scheduler_->NotifyReadyToCommit(); |
1779 scheduler_->NotifyReadyToActivate(); | 1779 scheduler_->NotifyReadyToActivate(); |
1780 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1780 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1781 | 1781 |
1782 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); | 1782 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5); |
1783 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); | 1783 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); |
1784 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1784 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
1785 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1785 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
1786 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); | 1786 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
1787 | 1787 |
1788 // Draw and swap for first commit, start second commit. | 1788 // Draw and swap for first commit, start second commit. |
1789 client_->Reset(); | 1789 client_->Reset(); |
1790 scheduler_->SetNeedsBeginMainFrame(); | 1790 scheduler_->SetNeedsBeginMainFrame(); |
1791 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1791 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1792 EXPECT_SCOPED(AdvanceFrame()); | 1792 EXPECT_SCOPED(AdvanceFrame()); |
1793 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1793 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1794 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1794 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1795 scheduler_->NotifyBeginMainFrameStarted(); | 1795 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1796 scheduler_->NotifyReadyToCommit(); | 1796 scheduler_->NotifyReadyToCommit(); |
1797 scheduler_->NotifyReadyToActivate(); | 1797 scheduler_->NotifyReadyToActivate(); |
1798 | 1798 |
1799 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); | 1799 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); |
1800 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 6); | 1800 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 6); |
1801 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 6); | 1801 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 6); |
1802 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 6); | 1802 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 6); |
1803 EXPECT_ACTION("ScheduledActionCommit", client_, 4, 6); | 1803 EXPECT_ACTION("ScheduledActionCommit", client_, 4, 6); |
1804 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 5, 6); | 1804 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 5, 6); |
1805 | 1805 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 | 1856 |
1857 EXPECT_NO_ACTION(client_); | 1857 EXPECT_NO_ACTION(client_); |
1858 | 1858 |
1859 // Then verify we operate in a low latency mode. | 1859 // Then verify we operate in a low latency mode. |
1860 client_->Reset(); | 1860 client_->Reset(); |
1861 // Previous commit request is still outstanding. | 1861 // Previous commit request is still outstanding. |
1862 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); | 1862 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); |
1863 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1863 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1864 SendNextBeginFrame(); | 1864 SendNextBeginFrame(); |
1865 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1865 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1866 scheduler_->NotifyBeginMainFrameStarted(); | 1866 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1867 scheduler_->NotifyReadyToCommit(); | 1867 scheduler_->NotifyReadyToCommit(); |
1868 scheduler_->NotifyReadyToActivate(); | 1868 scheduler_->NotifyReadyToActivate(); |
1869 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1869 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1870 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1870 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1871 scheduler_->DidSwapBuffersComplete(); | 1871 scheduler_->DidSwapBuffersComplete(); |
1872 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1872 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1873 | 1873 |
1874 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); | 1874 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); |
1875 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); | 1875 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); |
1876 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); | 1876 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); |
(...skipping 21 matching lines...) Expand all Loading... |
1898 // in a swap throttled state. | 1898 // in a swap throttled state. |
1899 client_->Reset(); | 1899 client_->Reset(); |
1900 EXPECT_FALSE(scheduler_->CommitPending()); | 1900 EXPECT_FALSE(scheduler_->CommitPending()); |
1901 scheduler_->SetNeedsBeginMainFrame(); | 1901 scheduler_->SetNeedsBeginMainFrame(); |
1902 scheduler_->SetNeedsRedraw(); | 1902 scheduler_->SetNeedsRedraw(); |
1903 EXPECT_SCOPED(AdvanceFrame()); | 1903 EXPECT_SCOPED(AdvanceFrame()); |
1904 EXPECT_TRUE(scheduler_->CommitPending()); | 1904 EXPECT_TRUE(scheduler_->CommitPending()); |
1905 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1905 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1906 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1906 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1907 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1907 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
1908 scheduler_->NotifyBeginMainFrameStarted(); | 1908 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1909 scheduler_->NotifyReadyToCommit(); | 1909 scheduler_->NotifyReadyToCommit(); |
1910 scheduler_->NotifyReadyToActivate(); | 1910 scheduler_->NotifyReadyToActivate(); |
1911 EXPECT_FALSE(scheduler_->CommitPending()); | 1911 EXPECT_FALSE(scheduler_->CommitPending()); |
1912 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 7); | 1912 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 7); |
1913 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 7); | 1913 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 7); |
1914 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 7); | 1914 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 7); |
1915 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 7); | 1915 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 7); |
1916 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 7); | 1916 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 7); |
1917 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 7); | 1917 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 7); |
1918 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 6, 7); | 1918 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 6, 7); |
1919 | 1919 |
1920 // Make sure that we can finish the next commit even while swap throttled. | 1920 // Make sure that we can finish the next commit even while swap throttled. |
1921 client_->Reset(); | 1921 client_->Reset(); |
1922 EXPECT_FALSE(scheduler_->CommitPending()); | 1922 EXPECT_FALSE(scheduler_->CommitPending()); |
1923 scheduler_->SetNeedsBeginMainFrame(); | 1923 scheduler_->SetNeedsBeginMainFrame(); |
1924 EXPECT_SCOPED(AdvanceFrame()); | 1924 EXPECT_SCOPED(AdvanceFrame()); |
1925 scheduler_->NotifyBeginMainFrameStarted(); | 1925 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1926 scheduler_->NotifyReadyToCommit(); | 1926 scheduler_->NotifyReadyToCommit(); |
1927 scheduler_->NotifyReadyToActivate(); | 1927 scheduler_->NotifyReadyToActivate(); |
1928 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1928 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1929 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1929 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1930 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1930 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
1931 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); | 1931 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); |
1932 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 5); | 1932 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 5); |
1933 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1933 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
1934 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1934 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
1935 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 5); | 1935 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 5); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 client_->Reset(); | 1970 client_->Reset(); |
1971 EXPECT_FALSE(scheduler_->CommitPending()); | 1971 EXPECT_FALSE(scheduler_->CommitPending()); |
1972 scheduler_->SetNeedsBeginMainFrame(); | 1972 scheduler_->SetNeedsBeginMainFrame(); |
1973 scheduler_->SetNeedsRedraw(); | 1973 scheduler_->SetNeedsRedraw(); |
1974 EXPECT_SCOPED(AdvanceFrame()); | 1974 EXPECT_SCOPED(AdvanceFrame()); |
1975 EXPECT_TRUE(scheduler_->CommitPending()); | 1975 EXPECT_TRUE(scheduler_->CommitPending()); |
1976 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1976 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1977 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1977 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1978 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 1978 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
1979 scheduler_->DidSwapBuffersComplete(); | 1979 scheduler_->DidSwapBuffersComplete(); |
1980 scheduler_->NotifyBeginMainFrameStarted(); | 1980 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1981 scheduler_->NotifyReadyToCommit(); | 1981 scheduler_->NotifyReadyToCommit(); |
1982 EXPECT_FALSE(scheduler_->CommitPending()); | 1982 EXPECT_FALSE(scheduler_->CommitPending()); |
1983 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); | 1983 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); |
1984 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); | 1984 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); |
1985 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); | 1985 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); |
1986 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); | 1986 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); |
1987 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); | 1987 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); |
1988 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); | 1988 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); |
1989 | 1989 |
1990 // Start another commit while we still have aa pending tree. | 1990 // Start another commit while we still have aa pending tree. |
1991 // Enter a swap throttled state. | 1991 // Enter a swap throttled state. |
1992 client_->Reset(); | 1992 client_->Reset(); |
1993 EXPECT_FALSE(scheduler_->CommitPending()); | 1993 EXPECT_FALSE(scheduler_->CommitPending()); |
1994 scheduler_->SetNeedsBeginMainFrame(); | 1994 scheduler_->SetNeedsBeginMainFrame(); |
1995 scheduler_->SetNeedsRedraw(); | 1995 scheduler_->SetNeedsRedraw(); |
1996 EXPECT_SCOPED(AdvanceFrame()); | 1996 EXPECT_SCOPED(AdvanceFrame()); |
1997 EXPECT_TRUE(scheduler_->CommitPending()); | 1997 EXPECT_TRUE(scheduler_->CommitPending()); |
1998 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 1998 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
1999 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1999 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2000 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2000 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2001 scheduler_->NotifyBeginMainFrameStarted(); | 2001 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2002 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); | 2002 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); |
2003 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); | 2003 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); |
2004 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); | 2004 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); |
2005 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 2005 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
2006 | 2006 |
2007 // Can't commit yet because there's still a pending tree. | 2007 // Can't commit yet because there's still a pending tree. |
2008 client_->Reset(); | 2008 client_->Reset(); |
2009 scheduler_->NotifyReadyToCommit(); | 2009 scheduler_->NotifyReadyToCommit(); |
2010 EXPECT_NO_ACTION(client_); | 2010 EXPECT_NO_ACTION(client_); |
2011 | 2011 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 client_->Reset(); | 2051 client_->Reset(); |
2052 EXPECT_FALSE(scheduler_->CommitPending()); | 2052 EXPECT_FALSE(scheduler_->CommitPending()); |
2053 scheduler_->SetNeedsBeginMainFrame(); | 2053 scheduler_->SetNeedsBeginMainFrame(); |
2054 scheduler_->SetNeedsRedraw(); | 2054 scheduler_->SetNeedsRedraw(); |
2055 EXPECT_SCOPED(AdvanceFrame()); | 2055 EXPECT_SCOPED(AdvanceFrame()); |
2056 EXPECT_TRUE(scheduler_->CommitPending()); | 2056 EXPECT_TRUE(scheduler_->CommitPending()); |
2057 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2057 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2058 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2058 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2059 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2059 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2060 scheduler_->DidSwapBuffersComplete(); | 2060 scheduler_->DidSwapBuffersComplete(); |
2061 scheduler_->NotifyBeginMainFrameStarted(); | 2061 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2062 scheduler_->NotifyReadyToCommit(); | 2062 scheduler_->NotifyReadyToCommit(); |
2063 EXPECT_FALSE(scheduler_->CommitPending()); | 2063 EXPECT_FALSE(scheduler_->CommitPending()); |
2064 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); | 2064 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6); |
2065 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); | 2065 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); |
2066 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); | 2066 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 6); |
2067 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); | 2067 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 6); |
2068 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); | 2068 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 6); |
2069 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); | 2069 EXPECT_ACTION("ScheduledActionCommit", client_, 5, 6); |
2070 | 2070 |
2071 // Start another commit while we still have an active tree. | 2071 // Start another commit while we still have an active tree. |
2072 client_->Reset(); | 2072 client_->Reset(); |
2073 EXPECT_FALSE(scheduler_->CommitPending()); | 2073 EXPECT_FALSE(scheduler_->CommitPending()); |
2074 scheduler_->SetNeedsBeginMainFrame(); | 2074 scheduler_->SetNeedsBeginMainFrame(); |
2075 scheduler_->SetNeedsRedraw(); | 2075 scheduler_->SetNeedsRedraw(); |
2076 EXPECT_SCOPED(AdvanceFrame()); | 2076 EXPECT_SCOPED(AdvanceFrame()); |
2077 EXPECT_TRUE(scheduler_->CommitPending()); | 2077 EXPECT_TRUE(scheduler_->CommitPending()); |
2078 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2078 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2079 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2079 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2080 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2080 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2081 scheduler_->DidSwapBuffersComplete(); | 2081 scheduler_->DidSwapBuffersComplete(); |
2082 scheduler_->NotifyBeginMainFrameStarted(); | 2082 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2083 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); | 2083 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); |
2084 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); | 2084 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); |
2085 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); | 2085 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); |
2086 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 2086 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
2087 | 2087 |
2088 // Can't commit yet because there's still a pending tree. | 2088 // Can't commit yet because there's still a pending tree. |
2089 client_->Reset(); | 2089 client_->Reset(); |
2090 scheduler_->NotifyReadyToCommit(); | 2090 scheduler_->NotifyReadyToCommit(); |
2091 EXPECT_NO_ACTION(client_); | 2091 EXPECT_NO_ACTION(client_); |
2092 | 2092 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 fake_external_begin_frame_source()->TestOnBeginFrame(args); | 2126 fake_external_begin_frame_source()->TestOnBeginFrame(args); |
2127 | 2127 |
2128 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 2128 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
2129 task_runner().RunPendingTasks(); // Run posted deadline. | 2129 task_runner().RunPendingTasks(); // Run posted deadline. |
2130 EXPECT_NO_ACTION(client_); | 2130 EXPECT_NO_ACTION(client_); |
2131 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2131 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2132 EXPECT_TRUE(client_->needs_begin_frames()); | 2132 EXPECT_TRUE(client_->needs_begin_frames()); |
2133 client_->Reset(); | 2133 client_->Reset(); |
2134 | 2134 |
2135 // NotifyReadyToCommit should trigger the commit. | 2135 // NotifyReadyToCommit should trigger the commit. |
2136 scheduler_->NotifyBeginMainFrameStarted(); | 2136 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2137 scheduler_->NotifyReadyToCommit(); | 2137 scheduler_->NotifyReadyToCommit(); |
2138 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2138 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2139 EXPECT_TRUE(client_->needs_begin_frames()); | 2139 EXPECT_TRUE(client_->needs_begin_frames()); |
2140 client_->Reset(); | 2140 client_->Reset(); |
2141 | 2141 |
2142 // NotifyReadyToActivate should trigger the activation. | 2142 // NotifyReadyToActivate should trigger the activation. |
2143 scheduler_->NotifyReadyToActivate(); | 2143 scheduler_->NotifyReadyToActivate(); |
2144 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2144 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2145 EXPECT_TRUE(client_->needs_begin_frames()); | 2145 EXPECT_TRUE(client_->needs_begin_frames()); |
2146 client_->Reset(); | 2146 client_->Reset(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 EXPECT_TRUE(client_->needs_begin_frames()); | 2181 EXPECT_TRUE(client_->needs_begin_frames()); |
2182 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2182 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
2183 | 2183 |
2184 client_->Reset(); | 2184 client_->Reset(); |
2185 EXPECT_SCOPED(AdvanceFrame()); | 2185 EXPECT_SCOPED(AdvanceFrame()); |
2186 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2186 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2187 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2187 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2188 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2188 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2189 | 2189 |
2190 client_->Reset(); | 2190 client_->Reset(); |
2191 scheduler_->NotifyBeginMainFrameStarted(); | 2191 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2192 | 2192 |
2193 client_->Reset(); | 2193 client_->Reset(); |
2194 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); | 2194 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); |
2195 // This BeginFrame is queued up as a retro frame. | 2195 // This BeginFrame is queued up as a retro frame. |
2196 EXPECT_NO_ACTION(client_); | 2196 EXPECT_NO_ACTION(client_); |
2197 // The previous deadline is still pending. | 2197 // The previous deadline is still pending. |
2198 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2198 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2199 | 2199 |
2200 client_->Reset(); | 2200 client_->Reset(); |
2201 // This main frame activating should schedule the (previous) deadline to | 2201 // This main frame activating should schedule the (previous) deadline to |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2242 EXPECT_TRUE(client_->needs_begin_frames()); | 2242 EXPECT_TRUE(client_->needs_begin_frames()); |
2243 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2243 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
2244 | 2244 |
2245 client_->Reset(); | 2245 client_->Reset(); |
2246 EXPECT_SCOPED(AdvanceFrame()); | 2246 EXPECT_SCOPED(AdvanceFrame()); |
2247 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2247 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2248 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2248 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2249 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2249 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2250 | 2250 |
2251 client_->Reset(); | 2251 client_->Reset(); |
2252 scheduler_->NotifyBeginMainFrameStarted(); | 2252 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2253 | 2253 |
2254 client_->Reset(); | 2254 client_->Reset(); |
2255 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); | 2255 BeginFrameArgs retro_frame_args = SendNextBeginFrame(); |
2256 // This BeginFrame is queued up as a retro frame. | 2256 // This BeginFrame is queued up as a retro frame. |
2257 EXPECT_NO_ACTION(client_); | 2257 EXPECT_NO_ACTION(client_); |
2258 // The previous deadline is still pending. | 2258 // The previous deadline is still pending. |
2259 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2259 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2260 | 2260 |
2261 client_->Reset(); | 2261 client_->Reset(); |
2262 // This main frame activating should schedule the (previous) deadline to | 2262 // This main frame activating should schedule the (previous) deadline to |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2359 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2360 client_->Reset(); | 2360 client_->Reset(); |
2361 | 2361 |
2362 // If we don't swap on the deadline, we wait for the next BeginFrame. | 2362 // If we don't swap on the deadline, we wait for the next BeginFrame. |
2363 task_runner().RunPendingTasks(); // Run posted deadline. | 2363 task_runner().RunPendingTasks(); // Run posted deadline. |
2364 EXPECT_NO_ACTION(client_); | 2364 EXPECT_NO_ACTION(client_); |
2365 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2365 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2366 client_->Reset(); | 2366 client_->Reset(); |
2367 | 2367 |
2368 // NotifyReadyToCommit should trigger the commit. | 2368 // NotifyReadyToCommit should trigger the commit. |
2369 scheduler_->NotifyBeginMainFrameStarted(); | 2369 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2370 scheduler_->NotifyReadyToCommit(); | 2370 scheduler_->NotifyReadyToCommit(); |
2371 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2371 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2372 client_->Reset(); | 2372 client_->Reset(); |
2373 | 2373 |
2374 // NotifyReadyToActivate should trigger the activation. | 2374 // NotifyReadyToActivate should trigger the activation. |
2375 scheduler_->NotifyReadyToActivate(); | 2375 scheduler_->NotifyReadyToActivate(); |
2376 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2376 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2377 client_->Reset(); | 2377 client_->Reset(); |
2378 | 2378 |
2379 // BeginImplFrame should prepare the draw. | 2379 // BeginImplFrame should prepare the draw. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 client_->Reset(); | 2449 client_->Reset(); |
2450 | 2450 |
2451 // Trigger the first BeginImplFrame and BeginMainFrame | 2451 // Trigger the first BeginImplFrame and BeginMainFrame |
2452 EXPECT_SCOPED(AdvanceFrame()); | 2452 EXPECT_SCOPED(AdvanceFrame()); |
2453 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2453 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2454 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2454 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2455 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2455 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2456 client_->Reset(); | 2456 client_->Reset(); |
2457 | 2457 |
2458 // NotifyReadyToCommit should trigger the pending commit. | 2458 // NotifyReadyToCommit should trigger the pending commit. |
2459 scheduler_->NotifyBeginMainFrameStarted(); | 2459 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2460 scheduler_->NotifyReadyToCommit(); | 2460 scheduler_->NotifyReadyToCommit(); |
2461 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2461 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2462 client_->Reset(); | 2462 client_->Reset(); |
2463 | 2463 |
2464 // NotifyReadyToActivate should trigger the activation and draw. | 2464 // NotifyReadyToActivate should trigger the activation and draw. |
2465 scheduler_->NotifyReadyToActivate(); | 2465 scheduler_->NotifyReadyToActivate(); |
2466 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2466 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2467 client_->Reset(); | 2467 client_->Reset(); |
2468 | 2468 |
2469 // Swapping will put us into a swap throttled state. | 2469 // Swapping will put us into a swap throttled state. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2574 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2574 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2575 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2575 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2576 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2576 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2577 | 2577 |
2578 client_->Reset(); | 2578 client_->Reset(); |
2579 scheduler_->DidLoseOutputSurface(); | 2579 scheduler_->DidLoseOutputSurface(); |
2580 // SetNeedsBeginFrames(false) is not called until the end of the frame. | 2580 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
2581 EXPECT_NO_ACTION(client_); | 2581 EXPECT_NO_ACTION(client_); |
2582 | 2582 |
2583 client_->Reset(); | 2583 client_->Reset(); |
2584 scheduler_->NotifyBeginMainFrameStarted(); | 2584 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2585 scheduler_->NotifyReadyToCommit(); | 2585 scheduler_->NotifyReadyToCommit(); |
2586 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2); | 2586 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2); |
2587 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2); | 2587 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2); |
2588 | 2588 |
2589 client_->Reset(); | 2589 client_->Reset(); |
2590 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2590 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2591 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); | 2591 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3); |
2592 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); | 2592 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); |
2593 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); | 2593 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); |
2594 } | 2594 } |
(...skipping 29 matching lines...) Expand all Loading... |
2624 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2624 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2625 | 2625 |
2626 // BeginImplFrame is not started. | 2626 // BeginImplFrame is not started. |
2627 client_->Reset(); | 2627 client_->Reset(); |
2628 task_runner().RunUntilTime(now_src()->NowTicks() + | 2628 task_runner().RunUntilTime(now_src()->NowTicks() + |
2629 base::TimeDelta::FromMilliseconds(10)); | 2629 base::TimeDelta::FromMilliseconds(10)); |
2630 EXPECT_NO_ACTION(client_); | 2630 EXPECT_NO_ACTION(client_); |
2631 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2631 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2632 | 2632 |
2633 client_->Reset(); | 2633 client_->Reset(); |
2634 scheduler_->NotifyBeginMainFrameStarted(); | 2634 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2635 scheduler_->NotifyReadyToCommit(); | 2635 scheduler_->NotifyReadyToCommit(); |
2636 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); | 2636 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
2637 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); | 2637 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
2638 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 2, 3); | 2638 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 2, 3); |
2639 } | 2639 } |
2640 | 2640 |
2641 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { | 2641 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { |
2642 scheduler_settings_.use_external_begin_frame_source = true; | 2642 scheduler_settings_.use_external_begin_frame_source = true; |
2643 SetUpScheduler(true); | 2643 SetUpScheduler(true); |
2644 | 2644 |
2645 // SetNeedsBeginMainFrame should begin the frame. | 2645 // SetNeedsBeginMainFrame should begin the frame. |
2646 scheduler_->SetNeedsBeginMainFrame(); | 2646 scheduler_->SetNeedsBeginMainFrame(); |
2647 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2647 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
2648 | 2648 |
2649 client_->Reset(); | 2649 client_->Reset(); |
2650 EXPECT_SCOPED(AdvanceFrame()); | 2650 EXPECT_SCOPED(AdvanceFrame()); |
2651 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2651 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2652 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2652 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2653 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2653 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2654 | 2654 |
2655 client_->Reset(); | 2655 client_->Reset(); |
2656 scheduler_->NotifyBeginMainFrameStarted(); | 2656 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2657 scheduler_->NotifyReadyToCommit(); | 2657 scheduler_->NotifyReadyToCommit(); |
2658 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2658 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2659 | 2659 |
2660 client_->Reset(); | 2660 client_->Reset(); |
2661 scheduler_->DidLoseOutputSurface(); | 2661 scheduler_->DidLoseOutputSurface(); |
2662 // Sync tree should be forced to activate. | 2662 // Sync tree should be forced to activate. |
2663 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2663 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2664 | 2664 |
2665 // SetNeedsBeginFrames(false) is not called until the end of the frame. | 2665 // SetNeedsBeginFrames(false) is not called until the end of the frame. |
2666 client_->Reset(); | 2666 client_->Reset(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 | 2725 |
2726 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 2726 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
2727 client_->Reset(); | 2727 client_->Reset(); |
2728 task_runner().RunPendingTasks(); // Run posted deadline. | 2728 task_runner().RunPendingTasks(); // Run posted deadline. |
2729 EXPECT_NO_ACTION(client_); | 2729 EXPECT_NO_ACTION(client_); |
2730 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2730 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2731 EXPECT_TRUE(client_->needs_begin_frames()); | 2731 EXPECT_TRUE(client_->needs_begin_frames()); |
2732 | 2732 |
2733 // NotifyReadyToCommit should trigger the commit. | 2733 // NotifyReadyToCommit should trigger the commit. |
2734 client_->Reset(); | 2734 client_->Reset(); |
2735 scheduler_->NotifyBeginMainFrameStarted(); | 2735 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2736 scheduler_->NotifyReadyToCommit(); | 2736 scheduler_->NotifyReadyToCommit(); |
2737 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2737 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2738 EXPECT_TRUE(client_->needs_begin_frames()); | 2738 EXPECT_TRUE(client_->needs_begin_frames()); |
2739 | 2739 |
2740 // NotifyReadyToActivate should trigger the activation. | 2740 // NotifyReadyToActivate should trigger the activation. |
2741 client_->Reset(); | 2741 client_->Reset(); |
2742 scheduler_->NotifyReadyToActivate(); | 2742 scheduler_->NotifyReadyToActivate(); |
2743 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2743 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2744 EXPECT_TRUE(client_->needs_begin_frames()); | 2744 EXPECT_TRUE(client_->needs_begin_frames()); |
2745 | 2745 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2785 | 2785 |
2786 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 2786 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
2787 client_->Reset(); | 2787 client_->Reset(); |
2788 task_runner().RunPendingTasks(); // Run posted deadline. | 2788 task_runner().RunPendingTasks(); // Run posted deadline. |
2789 EXPECT_NO_ACTION(client_); | 2789 EXPECT_NO_ACTION(client_); |
2790 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 2790 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
2791 EXPECT_TRUE(client_->needs_begin_frames()); | 2791 EXPECT_TRUE(client_->needs_begin_frames()); |
2792 | 2792 |
2793 // NotifyReadyToCommit should trigger the commit. | 2793 // NotifyReadyToCommit should trigger the commit. |
2794 client_->Reset(); | 2794 client_->Reset(); |
2795 scheduler_->NotifyBeginMainFrameStarted(); | 2795 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2796 scheduler_->NotifyReadyToCommit(); | 2796 scheduler_->NotifyReadyToCommit(); |
2797 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2797 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2798 EXPECT_TRUE(client_->needs_begin_frames()); | 2798 EXPECT_TRUE(client_->needs_begin_frames()); |
2799 | 2799 |
2800 // NotifyReadyToActivate should trigger the activation. | 2800 // NotifyReadyToActivate should trigger the activation. |
2801 client_->Reset(); | 2801 client_->Reset(); |
2802 scheduler_->NotifyReadyToActivate(); | 2802 scheduler_->NotifyReadyToActivate(); |
2803 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2803 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2804 EXPECT_TRUE(client_->needs_begin_frames()); | 2804 EXPECT_TRUE(client_->needs_begin_frames()); |
2805 | 2805 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 | 2842 |
2843 client_->Reset(); | 2843 client_->Reset(); |
2844 AdvanceFrame(); | 2844 AdvanceFrame(); |
2845 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2845 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2846 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2846 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2847 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2847 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2848 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2848 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
2849 | 2849 |
2850 // NotifyReadyToCommit should trigger the commit. | 2850 // NotifyReadyToCommit should trigger the commit. |
2851 client_->Reset(); | 2851 client_->Reset(); |
2852 scheduler_->NotifyBeginMainFrameStarted(); | 2852 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2853 scheduler_->NotifyReadyToCommit(); | 2853 scheduler_->NotifyReadyToCommit(); |
2854 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2854 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2855 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2855 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
2856 | 2856 |
2857 // NotifyReadyToActivate should trigger the activation. | 2857 // NotifyReadyToActivate should trigger the activation. |
2858 client_->Reset(); | 2858 client_->Reset(); |
2859 scheduler_->NotifyReadyToActivate(); | 2859 scheduler_->NotifyReadyToActivate(); |
2860 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2860 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2861 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); | 2861 EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames()); |
2862 | 2862 |
(...skipping 18 matching lines...) Expand all Loading... |
2881 scheduler_->SetNeedsBeginMainFrame(); | 2881 scheduler_->SetNeedsBeginMainFrame(); |
2882 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2882 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
2883 | 2883 |
2884 client_->Reset(); | 2884 client_->Reset(); |
2885 EXPECT_SCOPED(AdvanceFrame()); | 2885 EXPECT_SCOPED(AdvanceFrame()); |
2886 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2886 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2887 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2887 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2888 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2888 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2889 | 2889 |
2890 client_->Reset(); | 2890 client_->Reset(); |
2891 scheduler_->NotifyBeginMainFrameStarted(); | 2891 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2892 scheduler_->NotifyReadyToCommit(); | 2892 scheduler_->NotifyReadyToCommit(); |
2893 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2893 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2894 | 2894 |
2895 client_->Reset(); | 2895 client_->Reset(); |
2896 scheduler_->NotifyReadyToActivate(); | 2896 scheduler_->NotifyReadyToActivate(); |
2897 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2897 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2898 | 2898 |
2899 client_->Reset(); | 2899 client_->Reset(); |
2900 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2900 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2901 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); | 2901 EXPECT_ACTION("ScheduledActionAnimate", client_, 0, 2); |
(...skipping 15 matching lines...) Expand all Loading... |
2917 scheduler_->SetNeedsBeginMainFrame(); | 2917 scheduler_->SetNeedsBeginMainFrame(); |
2918 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 2918 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
2919 | 2919 |
2920 client_->Reset(); | 2920 client_->Reset(); |
2921 EXPECT_SCOPED(AdvanceFrame()); | 2921 EXPECT_SCOPED(AdvanceFrame()); |
2922 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2922 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2923 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2923 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2924 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2924 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2925 | 2925 |
2926 client_->Reset(); | 2926 client_->Reset(); |
2927 scheduler_->NotifyBeginMainFrameStarted(); | 2927 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2928 scheduler_->NotifyReadyToCommit(); | 2928 scheduler_->NotifyReadyToCommit(); |
2929 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2929 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2930 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2930 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2931 | 2931 |
2932 client_->Reset(); | 2932 client_->Reset(); |
2933 scheduler_->SetVisible(false); | 2933 scheduler_->SetVisible(false); |
2934 task_runner().RunPendingTasks(); // Run posted deadline. | 2934 task_runner().RunPendingTasks(); // Run posted deadline. |
2935 | 2935 |
2936 // Sync tree should be forced to activate. | 2936 // Sync tree should be forced to activate. |
2937 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 3); | 2937 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 3); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 scheduler_settings_.use_external_begin_frame_source = true; | 3061 scheduler_settings_.use_external_begin_frame_source = true; |
3062 SetUpScheduler(true); | 3062 SetUpScheduler(true); |
3063 | 3063 |
3064 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. | 3064 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. |
3065 scheduler_->SetNeedsBeginMainFrame(); | 3065 scheduler_->SetNeedsBeginMainFrame(); |
3066 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 3066 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
3067 client_->Reset(); | 3067 client_->Reset(); |
3068 | 3068 |
3069 // Trigger a frame draw. | 3069 // Trigger a frame draw. |
3070 EXPECT_SCOPED(AdvanceFrame()); | 3070 EXPECT_SCOPED(AdvanceFrame()); |
3071 scheduler_->NotifyBeginMainFrameStarted(); | 3071 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3072 scheduler_->NotifyReadyToCommit(); | 3072 scheduler_->NotifyReadyToCommit(); |
3073 scheduler_->NotifyReadyToActivate(); | 3073 scheduler_->NotifyReadyToActivate(); |
3074 task_runner().RunPendingTasks(); | 3074 task_runner().RunPendingTasks(); |
3075 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); | 3075 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 6); |
3076 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); | 3076 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 6); |
3077 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); | 3077 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 6); |
3078 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 6); | 3078 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 6); |
3079 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 6); | 3079 EXPECT_ACTION("ScheduledActionAnimate", client_, 4, 6); |
3080 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 5, 6); | 3080 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 5, 6); |
3081 client_->Reset(); | 3081 client_->Reset(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3219 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 3219 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
3220 client_->Reset(); | 3220 client_->Reset(); |
3221 | 3221 |
3222 // Next vsync. | 3222 // Next vsync. |
3223 AdvanceFrame(); | 3223 AdvanceFrame(); |
3224 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 3224 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
3225 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 3225 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
3226 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3226 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
3227 client_->Reset(); | 3227 client_->Reset(); |
3228 | 3228 |
3229 scheduler_->NotifyBeginMainFrameStarted(); | 3229 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3230 EXPECT_NO_ACTION(client_); | 3230 EXPECT_NO_ACTION(client_); |
3231 | 3231 |
3232 // Next vsync. | 3232 // Next vsync. |
3233 AdvanceFrame(); | 3233 AdvanceFrame(); |
3234 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 3234 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
3235 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3235 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
3236 client_->Reset(); | 3236 client_->Reset(); |
3237 | 3237 |
3238 scheduler_->NotifyReadyToCommit(); | 3238 scheduler_->NotifyReadyToCommit(); |
3239 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3239 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3276 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 3276 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
3277 client_->Reset(); | 3277 client_->Reset(); |
3278 | 3278 |
3279 // Next vsync. | 3279 // Next vsync. |
3280 AdvanceFrame(); | 3280 AdvanceFrame(); |
3281 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 3281 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
3282 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 3282 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
3283 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3283 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
3284 client_->Reset(); | 3284 client_->Reset(); |
3285 | 3285 |
3286 scheduler_->NotifyBeginMainFrameStarted(); | 3286 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3287 EXPECT_NO_ACTION(client_); | 3287 EXPECT_NO_ACTION(client_); |
3288 | 3288 |
3289 scheduler_->NotifyReadyToCommit(); | 3289 scheduler_->NotifyReadyToCommit(); |
3290 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3290 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
3291 client_->Reset(); | 3291 client_->Reset(); |
3292 | 3292 |
3293 scheduler_->NotifyReadyToActivate(); | 3293 scheduler_->NotifyReadyToActivate(); |
3294 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 3294 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
3295 client_->Reset(); | 3295 client_->Reset(); |
3296 | 3296 |
3297 // Ask for another commit. | 3297 // Ask for another commit. |
3298 scheduler_->SetNeedsBeginMainFrame(); | 3298 scheduler_->SetNeedsBeginMainFrame(); |
3299 | 3299 |
3300 AdvanceFrame(); | 3300 AdvanceFrame(); |
3301 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); | 3301 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4); |
3302 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); | 3302 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4); |
3303 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); | 3303 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4); |
3304 EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 3, 4); | 3304 EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 3, 4); |
3305 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3305 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
3306 client_->Reset(); | 3306 client_->Reset(); |
3307 | 3307 |
3308 scheduler_->NotifyBeginMainFrameStarted(); | 3308 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3309 EXPECT_NO_ACTION(client_); | 3309 EXPECT_NO_ACTION(client_); |
3310 | 3310 |
3311 // Allow new commit even though previous commit hasn't been drawn. | 3311 // Allow new commit even though previous commit hasn't been drawn. |
3312 scheduler_->NotifyReadyToCommit(); | 3312 scheduler_->NotifyReadyToCommit(); |
3313 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3313 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
3314 client_->Reset(); | 3314 client_->Reset(); |
3315 } | 3315 } |
3316 | 3316 |
3317 class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient { | 3317 class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient { |
3318 public: | 3318 public: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3395 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); | 3395 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
3396 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 3396 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
3397 EXPECT_FALSE(scheduler_->PrepareTilesPending()); | 3397 EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
3398 client_->Reset(); | 3398 client_->Reset(); |
3399 | 3399 |
3400 // Simulate SetNeedsBeginMainFrame due to input event. | 3400 // Simulate SetNeedsBeginMainFrame due to input event. |
3401 scheduler_->SetNeedsBeginMainFrame(); | 3401 scheduler_->SetNeedsBeginMainFrame(); |
3402 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); | 3402 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); |
3403 client_->Reset(); | 3403 client_->Reset(); |
3404 | 3404 |
3405 scheduler_->NotifyBeginMainFrameStarted(); | 3405 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3406 scheduler_->NotifyReadyToCommit(); | 3406 scheduler_->NotifyReadyToCommit(); |
3407 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3407 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
3408 client_->Reset(); | 3408 client_->Reset(); |
3409 | 3409 |
3410 scheduler_->NotifyReadyToActivate(); | 3410 scheduler_->NotifyReadyToActivate(); |
3411 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 3411 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
3412 client_->Reset(); | 3412 client_->Reset(); |
3413 | 3413 |
3414 // Next vsync. | 3414 // Next vsync. |
3415 EXPECT_SCOPED(AdvanceFrame()); | 3415 EXPECT_SCOPED(AdvanceFrame()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3454 SetUpScheduler(true); | 3454 SetUpScheduler(true); |
3455 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval(); | 3455 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval(); |
3456 base::TimeDelta authoritative_interval = | 3456 base::TimeDelta authoritative_interval = |
3457 base::TimeDelta::FromMilliseconds(33); | 3457 base::TimeDelta::FromMilliseconds(33); |
3458 | 3458 |
3459 scheduler_->SetNeedsBeginMainFrame(); | 3459 scheduler_->SetNeedsBeginMainFrame(); |
3460 EXPECT_SCOPED(AdvanceFrame()); | 3460 EXPECT_SCOPED(AdvanceFrame()); |
3461 | 3461 |
3462 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); | 3462 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); |
3463 | 3463 |
3464 scheduler_->NotifyBeginMainFrameStarted(); | 3464 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3465 scheduler_->NotifyReadyToCommit(); | 3465 scheduler_->NotifyReadyToCommit(); |
3466 scheduler_->NotifyReadyToActivate(); | 3466 scheduler_->NotifyReadyToActivate(); |
3467 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 3467 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
3468 | 3468 |
3469 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); | 3469 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); |
3470 | 3470 |
3471 EXPECT_SCOPED(AdvanceFrame()); | 3471 EXPECT_SCOPED(AdvanceFrame()); |
3472 | 3472 |
3473 // At the next BeginFrame, authoritative interval is used instead of previous | 3473 // At the next BeginFrame, authoritative interval is used instead of previous |
3474 // interval. | 3474 // interval. |
(...skipping 29 matching lines...) Expand all Loading... |
3504 scheduler_->SetImplLatencyTakesPriority(true); | 3504 scheduler_->SetImplLatencyTakesPriority(true); |
3505 scheduler_->SetChildrenNeedBeginFrames(true); | 3505 scheduler_->SetChildrenNeedBeginFrames(true); |
3506 | 3506 |
3507 EXPECT_SCOPED(AdvanceFrame()); | 3507 EXPECT_SCOPED(AdvanceFrame()); |
3508 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 3508 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
3509 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); | 3509 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); |
3510 } | 3510 } |
3511 | 3511 |
3512 } // namespace | 3512 } // namespace |
3513 } // namespace cc | 3513 } // namespace cc |
OLD | NEW |