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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 1691153002: cc: Consider main thread making deadline upon abort. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 4da406f60ad4be2cf640a87f9912d08a2ac9828e..3e02e6a3b407c4cae5ffa243d35044fbc8512ff3 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -1481,6 +1481,43 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) {
CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame));
}
+// If the BeginMainFrame aborts, it doesn't actually insert a frame into the
+// queue, which means there is no latency to recover.
+TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateAbort) {
+ scheduler_settings_.use_external_begin_frame_source = true;
+ SetUpScheduler(true);
+
+ // Use fast estimates so we think we can recover latency if needed.
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
+
+ // Impl thread hits deadline before BeginMainFrame aborts.
+ scheduler_->SetNeedsBeginMainFrame();
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
+ EXPECT_SCOPED(AdvanceFrame());
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
+ task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
+ EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
+ 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.
+ EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3);
+ EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
+
+ // After aborting the frame, make sure we don't skip the
+ // next BeginMainFrame.
+ client_->Reset();
+ scheduler_->BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES);
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
+ scheduler_->SetNeedsBeginMainFrame();
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
+ EXPECT_SCOPED(AdvanceFrame());
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
+ task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
+ EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
+ EXPECT_TRUE(client_->HasAction("WillBeginImplFrame"));
+ EXPECT_TRUE(client_->HasAction("ScheduledActionSendBeginMainFrame"));
sunnyps 2016/02/16 22:02:20 nit: same here.
brianderson 2016/02/16 23:08:42 Done.
+}
+
void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
bool swap_ack_before_deadline) {
// To get into a high latency state, this test disables automatic swap acks.
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698