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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1474 scheduler_settings_.use_external_begin_frame_source = true; | 1474 scheduler_settings_.use_external_begin_frame_source = true; |
1475 SetUpScheduler(true); | 1475 SetUpScheduler(true); |
1476 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); | 1476 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1477 fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration); | 1477 fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration); |
1478 | 1478 |
1479 bool expect_send_begin_main_frame = true; | 1479 bool expect_send_begin_main_frame = true; |
1480 EXPECT_SCOPED( | 1480 EXPECT_SCOPED( |
1481 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); | 1481 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
1482 } | 1482 } |
1483 | 1483 |
1484 // If the BeginMainFrame aborts, it doesn't actually insert a frame into the | |
1485 // queue, which means there is no latency to recover. | |
1486 TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateAbort) { | |
1487 scheduler_settings_.use_external_begin_frame_source = true; | |
1488 SetUpScheduler(true); | |
1489 | |
1490 // Use fast estimates so we think we can recover latency if needed. | |
1491 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); | |
1492 | |
1493 // Impl thread hits deadline before BeginMainFrame aborts. | |
1494 scheduler_->SetNeedsBeginMainFrame(); | |
1495 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | |
1496 EXPECT_SCOPED(AdvanceFrame()); | |
1497 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | |
1498 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | |
1499 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | |
1500 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); | |
1501 EXPECT_ACTION("AddObserver(this)", client_, 0, 3); | |
sunnyps
2016/02/16 22:02:20
nit: Move these EXPECT_ACTION calls to below Advan
brianderson
2016/02/16 23:08:42
Done.
| |
1502 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); | |
1503 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); | |
1504 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | |
1505 | |
1506 // After aborting the frame, make sure we don't skip the | |
1507 // next BeginMainFrame. | |
1508 client_->Reset(); | |
1509 scheduler_->BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES); | |
1510 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | |
1511 scheduler_->SetNeedsBeginMainFrame(); | |
1512 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | |
1513 EXPECT_SCOPED(AdvanceFrame()); | |
1514 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | |
1515 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | |
1516 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | |
1517 EXPECT_TRUE(client_->HasAction("WillBeginImplFrame")); | |
1518 EXPECT_TRUE(client_->HasAction("ScheduledActionSendBeginMainFrame")); | |
sunnyps
2016/02/16 22:02:20
nit: same here.
brianderson
2016/02/16 23:08:42
Done.
| |
1519 } | |
1520 | |
1484 void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( | 1521 void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( |
1485 bool swap_ack_before_deadline) { | 1522 bool swap_ack_before_deadline) { |
1486 // To get into a high latency state, this test disables automatic swap acks. | 1523 // To get into a high latency state, this test disables automatic swap acks. |
1487 client_->SetAutomaticSwapAck(false); | 1524 client_->SetAutomaticSwapAck(false); |
1488 | 1525 |
1489 // Draw and swap for first BeginFrame | 1526 // Draw and swap for first BeginFrame |
1490 client_->Reset(); | 1527 client_->Reset(); |
1491 scheduler_->SetNeedsBeginMainFrame(); | 1528 scheduler_->SetNeedsBeginMainFrame(); |
1492 scheduler_->SetNeedsRedraw(); | 1529 scheduler_->SetNeedsRedraw(); |
1493 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1530 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3588 } | 3625 } |
3589 | 3626 |
3590 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { | 3627 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { |
3591 EXPECT_FALSE(BeginMainFrameOnCriticalPath( | 3628 EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
3592 SMOOTHNESS_TAKES_PRIORITY, | 3629 SMOOTHNESS_TAKES_PRIORITY, |
3593 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); | 3630 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); |
3594 } | 3631 } |
3595 | 3632 |
3596 } // namespace | 3633 } // namespace |
3597 } // namespace cc | 3634 } // namespace cc |
OLD | NEW |