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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 341 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
342 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 342 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
343 client_->Reset(); | 343 client_->Reset(); |
344 | 344 |
345 { | 345 { |
346 SCOPED_TRACE("Do first frame to commit after initialize."); | 346 SCOPED_TRACE("Do first frame to commit after initialize."); |
347 AdvanceFrame(); | 347 AdvanceFrame(); |
348 | 348 |
349 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 349 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
350 scheduler_->NotifyReadyToCommit(); | 350 scheduler_->NotifyReadyToCommit(); |
351 scheduler_->NotifyReadyToActivate(); | 351 scheduler_->NotifyReadyToActivate(0); |
352 scheduler_->NotifyReadyToDraw(); | 352 scheduler_->NotifyReadyToDraw(); |
353 | 353 |
354 EXPECT_FALSE(scheduler_->CommitPending()); | 354 EXPECT_FALSE(scheduler_->CommitPending()); |
355 | 355 |
356 if (scheduler_settings_.using_synchronous_renderer_compositor) { | 356 if (scheduler_settings_.using_synchronous_renderer_compositor) { |
357 scheduler_->SetNeedsRedraw(); | 357 scheduler_->SetNeedsRedraw(); |
358 bool resourceless_software_draw = false; | 358 bool resourceless_software_draw = false; |
359 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); | 359 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
360 } else { | 360 } else { |
361 // Run the posted deadline task. | 361 // Run the posted deadline task. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 client_->Reset(); | 523 client_->Reset(); |
524 | 524 |
525 // NotifyReadyToCommit should trigger the commit. | 525 // NotifyReadyToCommit should trigger the commit. |
526 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 526 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
527 scheduler_->NotifyReadyToCommit(); | 527 scheduler_->NotifyReadyToCommit(); |
528 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 528 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
529 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 529 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
530 client_->Reset(); | 530 client_->Reset(); |
531 | 531 |
532 // NotifyReadyToActivate should trigger the activation. | 532 // NotifyReadyToActivate should trigger the activation. |
533 scheduler_->NotifyReadyToActivate(); | 533 scheduler_->NotifyReadyToActivate(0); |
534 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 534 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
535 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 535 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
536 client_->Reset(); | 536 client_->Reset(); |
537 | 537 |
538 // BeginImplFrame should prepare the draw. | 538 // BeginImplFrame should prepare the draw. |
539 EXPECT_SCOPED(AdvanceFrame()); | 539 EXPECT_SCOPED(AdvanceFrame()); |
540 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); | 540 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); |
541 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 541 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
542 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 542 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
543 client_->Reset(); | 543 client_->Reset(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 client_->Reset(); | 641 client_->Reset(); |
642 | 642 |
643 // Finish the first commit. | 643 // Finish the first commit. |
644 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 644 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
645 scheduler_->NotifyReadyToCommit(); | 645 scheduler_->NotifyReadyToCommit(); |
646 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 646 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
647 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 647 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
648 client_->Reset(); | 648 client_->Reset(); |
649 | 649 |
650 // Activate it. | 650 // Activate it. |
651 scheduler_->NotifyReadyToActivate(); | 651 scheduler_->NotifyReadyToActivate(0); |
652 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 652 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
653 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 653 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
654 client_->Reset(); | 654 client_->Reset(); |
655 | 655 |
656 task_runner().RunPendingTasks(); // Run posted deadline. | 656 task_runner().RunPendingTasks(); // Run posted deadline. |
657 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); | 657 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); |
658 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 658 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
659 | 659 |
660 // Because we just swapped, the Scheduler should also request the next | 660 // Because we just swapped, the Scheduler should also request the next |
661 // BeginImplFrame from the CompositorFrameSink. | 661 // BeginImplFrame from the CompositorFrameSink. |
662 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 662 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
663 client_->Reset(); | 663 client_->Reset(); |
664 // Since another commit is needed, the next BeginImplFrame should initiate | 664 // Since another commit is needed, the next BeginImplFrame should initiate |
665 // the second commit. | 665 // the second commit. |
666 EXPECT_SCOPED(AdvanceFrame()); | 666 EXPECT_SCOPED(AdvanceFrame()); |
667 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 667 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
668 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 668 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
669 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 669 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
670 client_->Reset(); | 670 client_->Reset(); |
671 | 671 |
672 // Finishing the commit before the deadline should post a new deadline task | 672 // Finishing the commit before the deadline should post a new deadline task |
673 // to trigger the deadline early. | 673 // to trigger the deadline early. |
674 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 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(client_->IsInsideBeginImplFrame()); | 677 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
678 client_->Reset(); | 678 client_->Reset(); |
679 scheduler_->NotifyReadyToActivate(); | 679 scheduler_->NotifyReadyToActivate(0); |
680 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 680 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
681 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 681 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
682 client_->Reset(); | 682 client_->Reset(); |
683 task_runner().RunPendingTasks(); // Run posted deadline. | 683 task_runner().RunPendingTasks(); // Run posted deadline. |
684 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); | 684 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); |
685 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 685 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
686 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 686 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
687 client_->Reset(); | 687 client_->Reset(); |
688 | 688 |
689 // On the next BeginImplFrame, verify we go back to a quiescent state and | 689 // On the next BeginImplFrame, verify we go back to a quiescent state and |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 844 |
845 client->SetNeedsBeginMainFrameOnNextDraw(); | 845 client->SetNeedsBeginMainFrameOnNextDraw(); |
846 EXPECT_SCOPED(AdvanceFrame()); | 846 EXPECT_SCOPED(AdvanceFrame()); |
847 client->SetNeedsBeginMainFrameOnNextDraw(); | 847 client->SetNeedsBeginMainFrameOnNextDraw(); |
848 task_runner().RunPendingTasks(); // Run posted deadline. | 848 task_runner().RunPendingTasks(); // Run posted deadline. |
849 EXPECT_EQ(1, client->num_draws()); | 849 EXPECT_EQ(1, client->num_draws()); |
850 EXPECT_TRUE(scheduler_->CommitPending()); | 850 EXPECT_TRUE(scheduler_->CommitPending()); |
851 EXPECT_TRUE(client->needs_begin_frames()); | 851 EXPECT_TRUE(client->needs_begin_frames()); |
852 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 852 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
853 scheduler_->NotifyReadyToCommit(); | 853 scheduler_->NotifyReadyToCommit(); |
854 scheduler_->NotifyReadyToActivate(); | 854 scheduler_->NotifyReadyToActivate(0); |
855 | 855 |
856 EXPECT_SCOPED(AdvanceFrame()); | 856 EXPECT_SCOPED(AdvanceFrame()); |
857 task_runner().RunPendingTasks(); // Run posted deadline. | 857 task_runner().RunPendingTasks(); // Run posted deadline. |
858 EXPECT_EQ(2, client->num_draws()); | 858 EXPECT_EQ(2, client->num_draws()); |
859 | 859 |
860 EXPECT_FALSE(scheduler_->RedrawPending()); | 860 EXPECT_FALSE(scheduler_->RedrawPending()); |
861 EXPECT_FALSE(scheduler_->CommitPending()); | 861 EXPECT_FALSE(scheduler_->CommitPending()); |
862 EXPECT_TRUE(client->needs_begin_frames()); | 862 EXPECT_TRUE(client->needs_begin_frames()); |
863 | 863 |
864 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't | 864 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 EXPECT_SCOPED(AdvanceFrame()); | 1222 EXPECT_SCOPED(AdvanceFrame()); |
1223 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1223 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1224 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1224 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1225 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1225 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1226 | 1226 |
1227 client_->Reset(); | 1227 client_->Reset(); |
1228 scheduler_->NotifyReadyToCommit(); | 1228 scheduler_->NotifyReadyToCommit(); |
1229 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 1229 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
1230 | 1230 |
1231 client_->Reset(); | 1231 client_->Reset(); |
1232 scheduler_->NotifyReadyToActivate(); | 1232 scheduler_->NotifyReadyToActivate(0); |
1233 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 1233 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
1234 | 1234 |
1235 // Scheduler won't post deadline in the mode. | 1235 // Scheduler won't post deadline in the mode. |
1236 client_->Reset(); | 1236 client_->Reset(); |
1237 task_runner().RunPendingTasks(); // Try to run posted deadline. | 1237 task_runner().RunPendingTasks(); // Try to run posted deadline. |
1238 // There is no posted deadline. | 1238 // There is no posted deadline. |
1239 EXPECT_NO_ACTION(client_); | 1239 EXPECT_NO_ACTION(client_); |
1240 | 1240 |
1241 // Scheduler received ready to draw signal, and posted deadline. | 1241 // Scheduler received ready to draw signal, and posted deadline. |
1242 scheduler_->NotifyReadyToDraw(); | 1242 scheduler_->NotifyReadyToDraw(); |
(...skipping 18 matching lines...) Expand all Loading... |
1261 EXPECT_SCOPED(AdvanceFrame()); | 1261 EXPECT_SCOPED(AdvanceFrame()); |
1262 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1262 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1263 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1263 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1264 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1264 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1265 | 1265 |
1266 client_->Reset(); | 1266 client_->Reset(); |
1267 scheduler_->NotifyReadyToCommit(); | 1267 scheduler_->NotifyReadyToCommit(); |
1268 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 1268 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
1269 | 1269 |
1270 client_->Reset(); | 1270 client_->Reset(); |
1271 scheduler_->NotifyReadyToActivate(); | 1271 scheduler_->NotifyReadyToActivate(0); |
1272 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 1272 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
1273 | 1273 |
1274 // Scheduler won't post deadline in the mode. | 1274 // Scheduler won't post deadline in the mode. |
1275 client_->Reset(); | 1275 client_->Reset(); |
1276 task_runner().RunPendingTasks(); // Try to run posted deadline. | 1276 task_runner().RunPendingTasks(); // Try to run posted deadline. |
1277 // There is no posted deadline. | 1277 // There is no posted deadline. |
1278 EXPECT_NO_ACTION(client_); | 1278 EXPECT_NO_ACTION(client_); |
1279 | 1279 |
1280 // Scheduler loses CompositorFrameSink, and stops waiting for ready to draw | 1280 // Scheduler loses CompositorFrameSink, and stops waiting for ready to draw |
1281 // signal. | 1281 // signal. |
(...skipping 10 matching lines...) Expand all Loading... |
1292 void SchedulerTest::AdvanceAndMissOneFrame() { | 1292 void SchedulerTest::AdvanceAndMissOneFrame() { |
1293 // Impl thread hits deadline before commit finishes. | 1293 // Impl thread hits deadline before commit finishes. |
1294 scheduler_->SetNeedsBeginMainFrame(); | 1294 scheduler_->SetNeedsBeginMainFrame(); |
1295 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1295 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1296 EXPECT_SCOPED(AdvanceFrame()); | 1296 EXPECT_SCOPED(AdvanceFrame()); |
1297 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1297 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1298 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1298 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1299 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1299 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1300 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1300 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1301 scheduler_->NotifyReadyToCommit(); | 1301 scheduler_->NotifyReadyToCommit(); |
1302 scheduler_->NotifyReadyToActivate(); | 1302 scheduler_->NotifyReadyToActivate(0); |
1303 EXPECT_ACTION("AddObserver(this)", client_, 0, 5); | 1303 EXPECT_ACTION("AddObserver(this)", client_, 0, 5); |
1304 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); | 1304 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); |
1305 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1305 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
1306 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1306 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
1307 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); | 1307 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
1308 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1308 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1309 client_->Reset(); | 1309 client_->Reset(); |
1310 } | 1310 } |
1311 | 1311 |
1312 void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( | 1312 void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | 1502 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
1503 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1503 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1504 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1504 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1505 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1505 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1506 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1506 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1507 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1507 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1508 | 1508 |
1509 // Make us abort the upcoming draw. | 1509 // Make us abort the upcoming draw. |
1510 client_->Reset(); | 1510 client_->Reset(); |
1511 scheduler_->NotifyReadyToCommit(); | 1511 scheduler_->NotifyReadyToCommit(); |
1512 scheduler_->NotifyReadyToActivate(); | 1512 scheduler_->NotifyReadyToActivate(0); |
1513 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2); | 1513 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2); |
1514 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2); | 1514 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2); |
1515 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1515 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1516 scheduler_->SetCanDraw(false); | 1516 scheduler_->SetCanDraw(false); |
1517 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1517 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1518 | 1518 |
1519 // Make CanDraw true after activation. | 1519 // Make CanDraw true after activation. |
1520 client_->Reset(); | 1520 client_->Reset(); |
1521 scheduler_->SetCanDraw(true); | 1521 scheduler_->SetCanDraw(true); |
1522 EXPECT_NO_ACTION(client_); | 1522 EXPECT_NO_ACTION(client_); |
(...skipping 22 matching lines...) Expand all Loading... |
1545 scheduler_->SetNeedsRedraw(); | 1545 scheduler_->SetNeedsRedraw(); |
1546 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1546 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1547 SendNextBeginFrame(); | 1547 SendNextBeginFrame(); |
1548 EXPECT_ACTION("AddObserver(this)", client_, 0, 3); | 1548 EXPECT_ACTION("AddObserver(this)", client_, 0, 3); |
1549 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); | 1549 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); |
1550 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | 1550 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
1551 | 1551 |
1552 client_->Reset(); | 1552 client_->Reset(); |
1553 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1553 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1554 scheduler_->NotifyReadyToCommit(); | 1554 scheduler_->NotifyReadyToCommit(); |
1555 scheduler_->NotifyReadyToActivate(); | 1555 scheduler_->NotifyReadyToActivate(0); |
1556 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1556 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1557 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1557 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1558 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); | 1558 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
1559 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); | 1559 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
1560 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); | 1560 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); |
1561 | 1561 |
1562 // Verify we skip every other frame if the swap ack consistently | 1562 // Verify we skip every other frame if the swap ack consistently |
1563 // comes back late. | 1563 // comes back late. |
1564 for (int i = 0; i < 10; i++) { | 1564 for (int i = 0; i < 10; i++) { |
1565 // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next | 1565 // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next |
(...skipping 26 matching lines...) Expand all Loading... |
1592 // after having just skipped a BeginImplFrame. | 1592 // after having just skipped a BeginImplFrame. |
1593 client_->Reset(); | 1593 client_->Reset(); |
1594 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1594 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1595 SendNextBeginFrame(); | 1595 SendNextBeginFrame(); |
1596 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1596 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1597 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 1597 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
1598 | 1598 |
1599 client_->Reset(); | 1599 client_->Reset(); |
1600 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1600 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1601 scheduler_->NotifyReadyToCommit(); | 1601 scheduler_->NotifyReadyToCommit(); |
1602 scheduler_->NotifyReadyToActivate(); | 1602 scheduler_->NotifyReadyToActivate(0); |
1603 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1603 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1604 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); | 1604 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
1605 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); | 1605 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
1606 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); | 1606 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); |
1607 } | 1607 } |
1608 } | 1608 } |
1609 | 1609 |
1610 TEST_F(SchedulerTest, | 1610 TEST_F(SchedulerTest, |
1611 ImplFrameSkippedAfterLateAck_FastEstimates_SubmitAckThenDeadline) { | 1611 ImplFrameSkippedAfterLateAck_FastEstimates_SubmitAckThenDeadline) { |
1612 SetUpScheduler(EXTERNAL_BFS); | 1612 SetUpScheduler(EXTERNAL_BFS); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 scheduler_->SetNeedsBeginMainFrame(); | 1724 scheduler_->SetNeedsBeginMainFrame(); |
1725 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1725 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1726 SendNextBeginFrame(); | 1726 SendNextBeginFrame(); |
1727 EXPECT_ACTION("AddObserver(this)", client_, 0, 3); | 1727 EXPECT_ACTION("AddObserver(this)", client_, 0, 3); |
1728 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); | 1728 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); |
1729 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | 1729 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
1730 | 1730 |
1731 client_->Reset(); | 1731 client_->Reset(); |
1732 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1732 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1733 scheduler_->NotifyReadyToCommit(); | 1733 scheduler_->NotifyReadyToCommit(); |
1734 scheduler_->NotifyReadyToActivate(); | 1734 scheduler_->NotifyReadyToActivate(0); |
1735 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1735 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1736 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1736 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1737 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); | 1737 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
1738 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); | 1738 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
1739 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); | 1739 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); |
1740 | 1740 |
1741 // Verify impl thread consistently operates in high latency mode | 1741 // Verify impl thread consistently operates in high latency mode |
1742 // without skipping any frames. | 1742 // without skipping any frames. |
1743 for (int i = 0; i < 10; i++) { | 1743 for (int i = 0; i < 10; i++) { |
1744 // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next | 1744 // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next |
1745 // frame | 1745 // frame |
1746 // puts the impl thread in high latency mode. | 1746 // puts the impl thread in high latency mode. |
1747 client_->Reset(); | 1747 client_->Reset(); |
1748 scheduler_->SetNeedsBeginMainFrame(); | 1748 scheduler_->SetNeedsBeginMainFrame(); |
1749 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1749 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1750 SendNextBeginFrame(); | 1750 SendNextBeginFrame(); |
1751 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 1751 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
1752 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 1752 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
1753 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1753 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1754 | 1754 |
1755 client_->Reset(); | 1755 client_->Reset(); |
1756 scheduler_->DidReceiveCompositorFrameAck(); | 1756 scheduler_->DidReceiveCompositorFrameAck(); |
1757 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1757 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1758 scheduler_->NotifyReadyToCommit(); | 1758 scheduler_->NotifyReadyToCommit(); |
1759 scheduler_->NotifyReadyToActivate(); | 1759 scheduler_->NotifyReadyToActivate(0); |
1760 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1760 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1761 | 1761 |
1762 // Verify that we don't skip the actions of the BeginImplFrame | 1762 // Verify that we don't skip the actions of the BeginImplFrame |
1763 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 4); | 1763 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 4); |
1764 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 4); | 1764 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 4); |
1765 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 4); | 1765 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 4); |
1766 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 3, 4); | 1766 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 3, 4); |
1767 } | 1767 } |
1768 } | 1768 } |
1769 | 1769 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 // MainThreadMissedLastDeadline true | 1824 // MainThreadMissedLastDeadline true |
1825 client_->Reset(); | 1825 client_->Reset(); |
1826 scheduler_->SetNeedsBeginMainFrame(); | 1826 scheduler_->SetNeedsBeginMainFrame(); |
1827 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1827 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1828 EXPECT_SCOPED(AdvanceFrame()); | 1828 EXPECT_SCOPED(AdvanceFrame()); |
1829 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1829 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1830 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1830 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1831 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1831 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1832 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1832 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1833 scheduler_->NotifyReadyToCommit(); | 1833 scheduler_->NotifyReadyToCommit(); |
1834 scheduler_->NotifyReadyToActivate(); | 1834 scheduler_->NotifyReadyToActivate(0); |
1835 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1835 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1836 | 1836 |
1837 EXPECT_ACTION("AddObserver(this)", client_, 0, 5); | 1837 EXPECT_ACTION("AddObserver(this)", client_, 0, 5); |
1838 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); | 1838 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); |
1839 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); | 1839 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
1840 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1840 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
1841 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); | 1841 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
1842 | 1842 |
1843 // Draw and swap for first commit, start second commit. | 1843 // Draw and swap for first commit, start second commit. |
1844 client_->Reset(); | 1844 client_->Reset(); |
1845 scheduler_->SetNeedsBeginMainFrame(); | 1845 scheduler_->SetNeedsBeginMainFrame(); |
1846 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1846 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1847 EXPECT_SCOPED(AdvanceFrame()); | 1847 EXPECT_SCOPED(AdvanceFrame()); |
1848 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1848 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1849 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1849 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1850 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1850 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1851 scheduler_->NotifyReadyToCommit(); | 1851 scheduler_->NotifyReadyToCommit(); |
1852 scheduler_->NotifyReadyToActivate(); | 1852 scheduler_->NotifyReadyToActivate(0); |
1853 | 1853 |
1854 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); | 1854 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); |
1855 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); | 1855 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); |
1856 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 5); | 1856 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 5); |
1857 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); | 1857 EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
1858 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); | 1858 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
1859 | 1859 |
1860 // Don't call scheduler_->DidReceiveCompositorFrameAck() until after next | 1860 // Don't call scheduler_->DidReceiveCompositorFrameAck() until after next |
1861 // frame | 1861 // frame |
1862 // to put the impl thread in a high latency mode. | 1862 // to put the impl thread in a high latency mode. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 | 1910 |
1911 // Then verify we operate in a low latency mode. | 1911 // Then verify we operate in a low latency mode. |
1912 client_->Reset(); | 1912 client_->Reset(); |
1913 // Previous commit request is still outstanding. | 1913 // Previous commit request is still outstanding. |
1914 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); | 1914 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); |
1915 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1915 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1916 SendNextBeginFrame(); | 1916 SendNextBeginFrame(); |
1917 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1917 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1918 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1918 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1919 scheduler_->NotifyReadyToCommit(); | 1919 scheduler_->NotifyReadyToCommit(); |
1920 scheduler_->NotifyReadyToActivate(); | 1920 scheduler_->NotifyReadyToActivate(0); |
1921 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1921 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1922 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1922 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1923 scheduler_->DidReceiveCompositorFrameAck(); | 1923 scheduler_->DidReceiveCompositorFrameAck(); |
1924 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1924 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1925 | 1925 |
1926 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); | 1926 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); |
1927 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); | 1927 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); |
1928 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5); | 1928 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5); |
1929 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5); | 1929 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5); |
1930 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 4, 5); | 1930 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 4, 5); |
(...skipping 18 matching lines...) Expand all Loading... |
1949 EXPECT_FALSE(scheduler_->CommitPending()); | 1949 EXPECT_FALSE(scheduler_->CommitPending()); |
1950 scheduler_->SetNeedsBeginMainFrame(); | 1950 scheduler_->SetNeedsBeginMainFrame(); |
1951 scheduler_->SetNeedsRedraw(); | 1951 scheduler_->SetNeedsRedraw(); |
1952 EXPECT_SCOPED(AdvanceFrame()); | 1952 EXPECT_SCOPED(AdvanceFrame()); |
1953 EXPECT_TRUE(scheduler_->CommitPending()); | 1953 EXPECT_TRUE(scheduler_->CommitPending()); |
1954 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 1954 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
1955 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1955 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1956 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 1956 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
1957 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1957 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1958 scheduler_->NotifyReadyToCommit(); | 1958 scheduler_->NotifyReadyToCommit(); |
1959 scheduler_->NotifyReadyToActivate(); | 1959 scheduler_->NotifyReadyToActivate(0); |
1960 EXPECT_FALSE(scheduler_->CommitPending()); | 1960 EXPECT_FALSE(scheduler_->CommitPending()); |
1961 EXPECT_ACTION("AddObserver(this)", client_, 0, 6); | 1961 EXPECT_ACTION("AddObserver(this)", client_, 0, 6); |
1962 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); | 1962 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); |
1963 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 6); | 1963 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 6); |
1964 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 3, 6); | 1964 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 3, 6); |
1965 EXPECT_ACTION("ScheduledActionCommit", client_, 4, 6); | 1965 EXPECT_ACTION("ScheduledActionCommit", client_, 4, 6); |
1966 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 5, 6); | 1966 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 5, 6); |
1967 | 1967 |
1968 // Make sure that we can finish the next commit even while swap throttled. | 1968 // Make sure that we can finish the next commit even while swap throttled. |
1969 client_->Reset(); | 1969 client_->Reset(); |
1970 EXPECT_FALSE(scheduler_->CommitPending()); | 1970 EXPECT_FALSE(scheduler_->CommitPending()); |
1971 scheduler_->SetNeedsBeginMainFrame(); | 1971 scheduler_->SetNeedsBeginMainFrame(); |
1972 EXPECT_SCOPED(AdvanceFrame()); | 1972 EXPECT_SCOPED(AdvanceFrame()); |
1973 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 1973 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
1974 scheduler_->NotifyReadyToCommit(); | 1974 scheduler_->NotifyReadyToCommit(); |
1975 scheduler_->NotifyReadyToActivate(); | 1975 scheduler_->NotifyReadyToActivate(0); |
1976 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 1976 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
1977 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 1977 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
1978 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 1978 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
1979 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); | 1979 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); |
1980 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3); | 1980 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3); |
1981 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 3); | 1981 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 3); |
1982 | 1982 |
1983 // Make sure we do not send a BeginMainFrame while swap throttled and | 1983 // Make sure we do not send a BeginMainFrame while swap throttled and |
1984 // we have both a pending tree and an active tree. | 1984 // we have both a pending tree and an active tree. |
1985 client_->Reset(); | 1985 client_->Reset(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); | 2045 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3); |
2046 | 2046 |
2047 // Can't commit yet because there's still a pending tree. | 2047 // Can't commit yet because there's still a pending tree. |
2048 client_->Reset(); | 2048 client_->Reset(); |
2049 scheduler_->NotifyReadyToCommit(); | 2049 scheduler_->NotifyReadyToCommit(); |
2050 EXPECT_NO_ACTION(client_); | 2050 EXPECT_NO_ACTION(client_); |
2051 | 2051 |
2052 // Activate the pending tree, which also unblocks the commit immediately | 2052 // Activate the pending tree, which also unblocks the commit immediately |
2053 // while we are in an idle state. | 2053 // while we are in an idle state. |
2054 client_->Reset(); | 2054 client_->Reset(); |
2055 scheduler_->NotifyReadyToActivate(); | 2055 scheduler_->NotifyReadyToActivate(0); |
2056 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 2); | 2056 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 2); |
2057 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 2); | 2057 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 2); |
2058 } | 2058 } |
2059 | 2059 |
2060 void SchedulerTest::BeginFramesNotFromClient(BeginFrameSourceType bfs_type) { | 2060 void SchedulerTest::BeginFramesNotFromClient(BeginFrameSourceType bfs_type) { |
2061 SetUpScheduler(bfs_type); | 2061 SetUpScheduler(bfs_type); |
2062 | 2062 |
2063 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame | 2063 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame |
2064 // without calling SetNeedsBeginFrame. | 2064 // without calling SetNeedsBeginFrame. |
2065 scheduler_->SetNeedsBeginMainFrame(); | 2065 scheduler_->SetNeedsBeginMainFrame(); |
(...skipping 13 matching lines...) Expand all Loading... |
2079 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 2079 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
2080 client_->Reset(); | 2080 client_->Reset(); |
2081 | 2081 |
2082 // NotifyReadyToCommit should trigger the commit. | 2082 // NotifyReadyToCommit should trigger the commit. |
2083 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 2083 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2084 scheduler_->NotifyReadyToCommit(); | 2084 scheduler_->NotifyReadyToCommit(); |
2085 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2085 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2086 client_->Reset(); | 2086 client_->Reset(); |
2087 | 2087 |
2088 // NotifyReadyToActivate should trigger the activation. | 2088 // NotifyReadyToActivate should trigger the activation. |
2089 scheduler_->NotifyReadyToActivate(); | 2089 scheduler_->NotifyReadyToActivate(0); |
2090 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2090 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2091 client_->Reset(); | 2091 client_->Reset(); |
2092 | 2092 |
2093 // BeginImplFrame deadline should draw. The following BeginImplFrame deadline | 2093 // BeginImplFrame deadline should draw. The following BeginImplFrame deadline |
2094 // should SetNeedsBeginFrame(false) to avoid excessive toggles. | 2094 // should SetNeedsBeginFrame(false) to avoid excessive toggles. |
2095 EXPECT_SCOPED(AdvanceFrame()); | 2095 EXPECT_SCOPED(AdvanceFrame()); |
2096 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); | 2096 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); |
2097 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2); | 2097 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2); |
2098 client_->Reset(); | 2098 client_->Reset(); |
2099 | 2099 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2135 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 2135 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
2136 client_->Reset(); | 2136 client_->Reset(); |
2137 | 2137 |
2138 // NotifyReadyToCommit should trigger the pending commit. | 2138 // NotifyReadyToCommit should trigger the pending commit. |
2139 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 2139 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2140 scheduler_->NotifyReadyToCommit(); | 2140 scheduler_->NotifyReadyToCommit(); |
2141 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2141 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2142 client_->Reset(); | 2142 client_->Reset(); |
2143 | 2143 |
2144 // NotifyReadyToActivate should trigger the activation and draw. | 2144 // NotifyReadyToActivate should trigger the activation and draw. |
2145 scheduler_->NotifyReadyToActivate(); | 2145 scheduler_->NotifyReadyToActivate(0); |
2146 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2146 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2147 client_->Reset(); | 2147 client_->Reset(); |
2148 | 2148 |
2149 // Swapping will put us into a swap throttled state. | 2149 // Swapping will put us into a swap throttled state. |
2150 // Run posted deadline. | 2150 // Run posted deadline. |
2151 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 2151 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
2152 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); | 2152 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); |
2153 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 2153 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
2154 client_->Reset(); | 2154 client_->Reset(); |
2155 | 2155 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 | 2380 |
2381 // NotifyReadyToCommit should trigger the commit. | 2381 // NotifyReadyToCommit should trigger the commit. |
2382 client_->Reset(); | 2382 client_->Reset(); |
2383 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 2383 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2384 scheduler_->NotifyReadyToCommit(); | 2384 scheduler_->NotifyReadyToCommit(); |
2385 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2385 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2386 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 2386 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
2387 | 2387 |
2388 // NotifyReadyToActivate should trigger the activation. | 2388 // NotifyReadyToActivate should trigger the activation. |
2389 client_->Reset(); | 2389 client_->Reset(); |
2390 scheduler_->NotifyReadyToActivate(); | 2390 scheduler_->NotifyReadyToActivate(0); |
2391 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2391 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2392 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 2392 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
2393 | 2393 |
2394 client_->Reset(); | 2394 client_->Reset(); |
2395 scheduler_->DidLoseCompositorFrameSink(); | 2395 scheduler_->DidLoseCompositorFrameSink(); |
2396 // RemoveObserver(this) is not called until the end of the frame. | 2396 // RemoveObserver(this) is not called until the end of the frame. |
2397 EXPECT_NO_ACTION(client_); | 2397 EXPECT_NO_ACTION(client_); |
2398 EXPECT_TRUE(scheduler_->begin_frames_expected()); | 2398 EXPECT_TRUE(scheduler_->begin_frames_expected()); |
2399 | 2399 |
2400 client_->Reset(); | 2400 client_->Reset(); |
(...skipping 16 matching lines...) Expand all Loading... |
2417 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2417 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2418 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2418 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2419 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 2419 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
2420 | 2420 |
2421 client_->Reset(); | 2421 client_->Reset(); |
2422 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 2422 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2423 scheduler_->NotifyReadyToCommit(); | 2423 scheduler_->NotifyReadyToCommit(); |
2424 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2424 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2425 | 2425 |
2426 client_->Reset(); | 2426 client_->Reset(); |
2427 scheduler_->NotifyReadyToActivate(); | 2427 scheduler_->NotifyReadyToActivate(0); |
2428 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2428 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2429 | 2429 |
2430 client_->Reset(); | 2430 client_->Reset(); |
2431 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 2431 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
2432 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); | 2432 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); |
2433 | 2433 |
2434 // Idle time between BeginFrames. | 2434 // Idle time between BeginFrames. |
2435 client_->Reset(); | 2435 client_->Reset(); |
2436 scheduler_->DidLoseCompositorFrameSink(); | 2436 scheduler_->DidLoseCompositorFrameSink(); |
2437 EXPECT_ACTION("ScheduledActionBeginCompositorFrameSinkCreation", client_, 0, | 2437 EXPECT_ACTION("ScheduledActionBeginCompositorFrameSinkCreation", client_, 0, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 EXPECT_SCOPED(AdvanceFrame()); | 2667 EXPECT_SCOPED(AdvanceFrame()); |
2668 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 2668 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2669 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2669 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2670 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 2670 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
2671 | 2671 |
2672 client_->Reset(); | 2672 client_->Reset(); |
2673 scheduler_->NotifyReadyToCommit(); | 2673 scheduler_->NotifyReadyToCommit(); |
2674 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2674 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2675 | 2675 |
2676 client_->Reset(); | 2676 client_->Reset(); |
2677 scheduler_->NotifyReadyToActivate(); | 2677 scheduler_->NotifyReadyToActivate(0); |
2678 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2678 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2679 | 2679 |
2680 // Scheduler loses CompositorFrameSink, and stops waiting for ready to draw | 2680 // Scheduler loses CompositorFrameSink, and stops waiting for ready to draw |
2681 // signal. | 2681 // signal. |
2682 client_->Reset(); | 2682 client_->Reset(); |
2683 scheduler_->DidLoseCompositorFrameSink(); | 2683 scheduler_->DidLoseCompositorFrameSink(); |
2684 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | 2684 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
2685 task_runner().RunPendingTasks(); | 2685 task_runner().RunPendingTasks(); |
2686 EXPECT_ACTION("ScheduledActionBeginCompositorFrameSinkCreation", client_, 0, | 2686 EXPECT_ACTION("ScheduledActionBeginCompositorFrameSinkCreation", client_, 0, |
2687 3); | 2687 3); |
(...skipping 26 matching lines...) Expand all Loading... |
2714 | 2714 |
2715 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. | 2715 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. |
2716 scheduler_->SetNeedsBeginMainFrame(); | 2716 scheduler_->SetNeedsBeginMainFrame(); |
2717 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); | 2717 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); |
2718 client_->Reset(); | 2718 client_->Reset(); |
2719 | 2719 |
2720 // Trigger a frame draw. | 2720 // Trigger a frame draw. |
2721 EXPECT_SCOPED(AdvanceFrame()); | 2721 EXPECT_SCOPED(AdvanceFrame()); |
2722 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 2722 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2723 scheduler_->NotifyReadyToCommit(); | 2723 scheduler_->NotifyReadyToCommit(); |
2724 scheduler_->NotifyReadyToActivate(); | 2724 scheduler_->NotifyReadyToActivate(0); |
2725 task_runner().RunPendingTasks(); | 2725 task_runner().RunPendingTasks(); |
2726 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); | 2726 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); |
2727 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); | 2727 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); |
2728 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5); | 2728 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5); |
2729 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5); | 2729 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5); |
2730 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 4, 5); | 2730 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 4, 5); |
2731 client_->Reset(); | 2731 client_->Reset(); |
2732 | 2732 |
2733 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) | 2733 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) |
2734 // and send a SendBeginMainFrameNotExpectedSoon. | 2734 // and send a SendBeginMainFrameNotExpectedSoon. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 has_damage = false; | 2900 has_damage = false; |
2901 EXPECT_EQ( | 2901 EXPECT_EQ( |
2902 BeginFrameAck(args.source_id, args.sequence_number, | 2902 BeginFrameAck(args.source_id, args.sequence_number, |
2903 latest_confirmed_sequence_number, has_damage), | 2903 latest_confirmed_sequence_number, has_damage), |
2904 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); | 2904 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); |
2905 | 2905 |
2906 scheduler_->NotifyReadyToCommit(); | 2906 scheduler_->NotifyReadyToCommit(); |
2907 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2907 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2908 client_->Reset(); | 2908 client_->Reset(); |
2909 | 2909 |
2910 scheduler_->NotifyReadyToActivate(); | 2910 scheduler_->NotifyReadyToActivate(0); |
2911 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2911 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2912 client_->Reset(); | 2912 client_->Reset(); |
2913 | 2913 |
2914 // Next vsync. | 2914 // Next vsync. |
2915 args = SendNextBeginFrame(); | 2915 args = SendNextBeginFrame(); |
2916 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 2916 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
2917 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); | 2917 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); |
2918 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 2918 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
2919 client_->Reset(); | 2919 client_->Reset(); |
2920 | 2920 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2967 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | 2967 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
2968 client_->Reset(); | 2968 client_->Reset(); |
2969 | 2969 |
2970 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 2970 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
2971 EXPECT_NO_ACTION(client_); | 2971 EXPECT_NO_ACTION(client_); |
2972 | 2972 |
2973 scheduler_->NotifyReadyToCommit(); | 2973 scheduler_->NotifyReadyToCommit(); |
2974 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2974 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2975 client_->Reset(); | 2975 client_->Reset(); |
2976 | 2976 |
2977 scheduler_->NotifyReadyToActivate(); | 2977 scheduler_->NotifyReadyToActivate(0); |
2978 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 2978 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
2979 client_->Reset(); | 2979 client_->Reset(); |
2980 | 2980 |
2981 // Ask for another commit. | 2981 // Ask for another commit. |
2982 scheduler_->SetNeedsBeginMainFrame(); | 2982 scheduler_->SetNeedsBeginMainFrame(); |
2983 | 2983 |
2984 AdvanceFrame(); | 2984 AdvanceFrame(); |
2985 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); | 2985 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); |
2986 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3); | 2986 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3); |
2987 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 2, 3); | 2987 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 2, 3); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3080 // Simulate SetNeedsBeginMainFrame due to input event. | 3080 // Simulate SetNeedsBeginMainFrame due to input event. |
3081 scheduler_->SetNeedsBeginMainFrame(); | 3081 scheduler_->SetNeedsBeginMainFrame(); |
3082 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); | 3082 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); |
3083 client_->Reset(); | 3083 client_->Reset(); |
3084 | 3084 |
3085 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 3085 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3086 scheduler_->NotifyReadyToCommit(); | 3086 scheduler_->NotifyReadyToCommit(); |
3087 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 3087 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
3088 client_->Reset(); | 3088 client_->Reset(); |
3089 | 3089 |
3090 scheduler_->NotifyReadyToActivate(); | 3090 scheduler_->NotifyReadyToActivate(0); |
3091 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 3091 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
3092 client_->Reset(); | 3092 client_->Reset(); |
3093 | 3093 |
3094 // Next vsync. | 3094 // Next vsync. |
3095 EXPECT_SCOPED(AdvanceFrame()); | 3095 EXPECT_SCOPED(AdvanceFrame()); |
3096 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 3096 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
3097 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); | 3097 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); |
3098 client_->Reset(); | 3098 client_->Reset(); |
3099 | 3099 |
3100 // Android onDraw. | 3100 // Android onDraw. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3132 base::TimeDelta authoritative_interval = | 3132 base::TimeDelta authoritative_interval = |
3133 base::TimeDelta::FromMilliseconds(33); | 3133 base::TimeDelta::FromMilliseconds(33); |
3134 | 3134 |
3135 scheduler_->SetNeedsBeginMainFrame(); | 3135 scheduler_->SetNeedsBeginMainFrame(); |
3136 EXPECT_SCOPED(AdvanceFrame()); | 3136 EXPECT_SCOPED(AdvanceFrame()); |
3137 | 3137 |
3138 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); | 3138 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); |
3139 | 3139 |
3140 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | 3140 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
3141 scheduler_->NotifyReadyToCommit(); | 3141 scheduler_->NotifyReadyToCommit(); |
3142 scheduler_->NotifyReadyToActivate(); | 3142 scheduler_->NotifyReadyToActivate(0); |
3143 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); | 3143 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
3144 | 3144 |
3145 // Test changing the interval on the frame source external to the scheduler. | 3145 // Test changing the interval on the frame source external to the scheduler. |
3146 synthetic_frame_source_->OnUpdateVSyncParameters(now_src_->NowTicks(), | 3146 synthetic_frame_source_->OnUpdateVSyncParameters(now_src_->NowTicks(), |
3147 authoritative_interval); | 3147 authoritative_interval); |
3148 | 3148 |
3149 EXPECT_SCOPED(AdvanceFrame()); | 3149 EXPECT_SCOPED(AdvanceFrame()); |
3150 | 3150 |
3151 // At the next BeginFrame, authoritative interval is used instead of previous | 3151 // At the next BeginFrame, authoritative interval is used instead of previous |
3152 // interval. | 3152 // interval. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3279 // should not be blocked on the main frame. | 3279 // should not be blocked on the main frame. |
3280 client_->Reset(); | 3280 client_->Reset(); |
3281 scheduler_->SetNeedsBeginMainFrame(); | 3281 scheduler_->SetNeedsBeginMainFrame(); |
3282 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks::Now()); | 3282 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks::Now()); |
3283 scheduler_->BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES); | 3283 scheduler_->BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES); |
3284 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); | 3284 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); |
3285 EXPECT_SINGLE_ACTION("ScheduledActionPerformImplSideInvalidation", client_); | 3285 EXPECT_SINGLE_ACTION("ScheduledActionPerformImplSideInvalidation", client_); |
3286 | 3286 |
3287 // Activate the sync tree. | 3287 // Activate the sync tree. |
3288 client_->Reset(); | 3288 client_->Reset(); |
3289 scheduler_->NotifyReadyToActivate(); | 3289 scheduler_->NotifyReadyToActivate(0); |
3290 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); | 3290 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
3291 | 3291 |
3292 // Second impl frame. | 3292 // Second impl frame. |
3293 client_->Reset(); | 3293 client_->Reset(); |
3294 EXPECT_SCOPED(AdvanceFrame()); | 3294 EXPECT_SCOPED(AdvanceFrame()); |
3295 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 3295 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
3296 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 3296 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
3297 | 3297 |
3298 // Deadline. | 3298 // Deadline. |
3299 client_->Reset(); | 3299 client_->Reset(); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3675 BeginFrameArgs::kInvalidFrameNumber; | 3675 BeginFrameArgs::kInvalidFrameNumber; |
3676 bool has_damage = false; | 3676 bool has_damage = false; |
3677 EXPECT_EQ( | 3677 EXPECT_EQ( |
3678 BeginFrameAck(args.source_id, args.sequence_number, | 3678 BeginFrameAck(args.source_id, args.sequence_number, |
3679 latest_confirmed_sequence_number, has_damage), | 3679 latest_confirmed_sequence_number, has_damage), |
3680 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); | 3680 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); |
3681 } | 3681 } |
3682 | 3682 |
3683 } // namespace | 3683 } // namespace |
3684 } // namespace cc | 3684 } // namespace cc |
OLD | NEW |