Index: cc/scheduler/scheduler_unittest.cc |
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc |
index 24b7173248ee70d8ffe51bede6f112246389f3ab..96bc96ae367fc9d9833204a610147318b64e4dae 100644 |
--- a/cc/scheduler/scheduler_unittest.cc |
+++ b/cc/scheduler/scheduler_unittest.cc |
@@ -132,23 +132,23 @@ class FakeSchedulerClient : public SchedulerClient, |
return last_begin_main_frame_args_; |
} |
- DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
- PushAction("ScheduledActionDrawAndSwapIfPossible"); |
+ DrawResult ScheduledActionSubmitCompositorFrameIfPossible() override { |
+ PushAction("ScheduledActionSubmitCompositorFrameIfPossible"); |
num_draws_++; |
DrawResult result = |
draw_will_happen_ ? DRAW_SUCCESS : DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; |
bool swap_will_happen = |
draw_will_happen_ && swap_will_happen_if_draw_happens_; |
if (swap_will_happen) { |
- scheduler_->DidSwapBuffers(); |
+ scheduler_->DidSubmitCompositorFrame(); |
if (automatic_swap_ack_) |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
} |
return result; |
} |
- DrawResult ScheduledActionDrawAndSwapForced() override { |
- PushAction("ScheduledActionDrawAndSwapForced"); |
+ DrawResult ScheduledActionSubmitCompositorFrameForced() override { |
+ PushAction("ScheduledActionSubmitCompositorFrameForced"); |
return DRAW_SUCCESS; |
} |
void ScheduledActionCommit() override { |
@@ -419,7 +419,7 @@ class SchedulerTest : public testing::Test { |
void ImplFrameSkippedAfterLateSwapAck(bool swap_ack_before_deadline); |
void ImplFrameNotSkippedAfterLateSwapAck(); |
void BeginFramesNotFromClient(BeginFrameSourceType bfs_type); |
- void BeginFramesNotFromClient_SwapThrottled(BeginFrameSourceType bfs_type); |
+ void BeginFramesNotFromClient_SubmitThrottled(BeginFrameSourceType bfs_type); |
bool BeginMainFrameOnCriticalPath(TreePriority tree_priority, |
ScrollHandlerState scroll_handler_state, |
base::TimeDelta durations); |
@@ -537,7 +537,8 @@ TEST_F(SchedulerTest, RequestCommit) { |
// BeginImplFrame deadline should draw. |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
EXPECT_TRUE(scheduler_->begin_frames_expected()); |
client_->Reset(); |
@@ -602,7 +603,8 @@ TEST_F(SchedulerTest, DeferCommitWithRedraw) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
EXPECT_TRUE(scheduler_->begin_frames_expected()); |
@@ -647,7 +649,8 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
// Because we just swapped, the Scheduler should also request the next |
@@ -674,7 +677,8 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { |
EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
EXPECT_TRUE(scheduler_->begin_frames_expected()); |
client_->Reset(); |
@@ -694,15 +698,16 @@ class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { |
void SetRequestRedrawsInsideDraw(bool enable) { request_redraws_ = enable; } |
- DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
+ DrawResult ScheduledActionSubmitCompositorFrameIfPossible() override { |
// Only SetNeedsRedraw the first time this is called |
if (request_redraws_) { |
scheduler_->SetNeedsRedraw(); |
} |
- return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); |
+ return FakeSchedulerClient:: |
+ ScheduledActionSubmitCompositorFrameIfPossible(); |
} |
- DrawResult ScheduledActionDrawAndSwapForced() override { |
+ DrawResult ScheduledActionSubmitCompositorFrameForced() override { |
NOTREACHED(); |
return DRAW_SUCCESS; |
} |
@@ -713,7 +718,7 @@ class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { |
// Tests for two different situations: |
// 1. the scheduler dropping SetNeedsRedraw requests that happen inside |
-// a ScheduledActionDrawAndSwap |
+// a ScheduledActionSubmitCompositorFrame |
// 2. the scheduler drawing twice inside a single tick |
TEST_F(SchedulerTest, RequestRedrawInsideDraw) { |
SchedulerClientThatsetNeedsDrawInsideDraw* client = |
@@ -800,16 +805,17 @@ class SchedulerClientThatSetNeedsBeginMainFrameInsideDraw |
SchedulerClientThatSetNeedsBeginMainFrameInsideDraw() |
: set_needs_commit_on_next_draw_(false) {} |
- DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
+ DrawResult ScheduledActionSubmitCompositorFrameIfPossible() override { |
// Only SetNeedsBeginMainFrame the first time this is called |
if (set_needs_commit_on_next_draw_) { |
scheduler_->SetNeedsBeginMainFrame(); |
set_needs_commit_on_next_draw_ = false; |
} |
- return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); |
+ return FakeSchedulerClient:: |
+ ScheduledActionSubmitCompositorFrameIfPossible(); |
} |
- DrawResult ScheduledActionDrawAndSwapForced() override { |
+ DrawResult ScheduledActionSubmitCompositorFrameForced() override { |
NOTREACHED(); |
return DRAW_SUCCESS; |
} |
@@ -823,7 +829,7 @@ class SchedulerClientThatSetNeedsBeginMainFrameInsideDraw |
}; |
// Tests for the scheduler infinite-looping on SetNeedsBeginMainFrame requests |
-// that happen inside a ScheduledActionDrawAndSwap |
+// that happen inside a ScheduledActionSubmitCompositorFrame |
TEST_F(SchedulerTest, RequestCommitInsideDraw) { |
SchedulerClientThatSetNeedsBeginMainFrameInsideDraw* client = |
new SchedulerClientThatSetNeedsBeginMainFrameInsideDraw; |
@@ -937,9 +943,10 @@ TEST_F(SchedulerTest, NoSwapWhenDrawFails) { |
class SchedulerClientNeedsPrepareTilesInDraw : public FakeSchedulerClient { |
public: |
- DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
+ DrawResult ScheduledActionSubmitCompositorFrameIfPossible() override { |
scheduler_->SetNeedsPrepareTiles(); |
- return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); |
+ return FakeSchedulerClient:: |
+ ScheduledActionSubmitCompositorFrameIfPossible(); |
} |
}; |
@@ -959,7 +966,8 @@ TEST_F(SchedulerTest, PrepareTiles) { |
EXPECT_TRUE(client->needs_begin_frames()); |
EXPECT_EQ(0, client->num_draws()); |
EXPECT_FALSE(client->HasAction("ScheduledActionPrepareTiles")); |
- EXPECT_FALSE(client->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_FALSE( |
+ client->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
// We have no immediate actions to perform, so the BeginImplFrame should post |
// the deadline task. |
@@ -972,10 +980,12 @@ TEST_F(SchedulerTest, PrepareTiles) { |
client->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client->num_draws()); |
- EXPECT_TRUE(client->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles")); |
- EXPECT_LT(client->ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
- client->ActionIndex("ScheduledActionPrepareTiles")); |
+ EXPECT_LT( |
+ client->ActionIndex("ScheduledActionSubmitCompositorFrameIfPossible"), |
+ client->ActionIndex("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(scheduler_->RedrawPending()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
@@ -1001,10 +1011,12 @@ TEST_F(SchedulerTest, PrepareTiles) { |
client->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client->num_draws()); |
- EXPECT_TRUE(client->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles")); |
- EXPECT_LT(client->ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
- client->ActionIndex("ScheduledActionPrepareTiles")); |
+ EXPECT_LT( |
+ client->ActionIndex("ScheduledActionSubmitCompositorFrameIfPossible"), |
+ client->ActionIndex("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(scheduler_->RedrawPending()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
@@ -1038,7 +1050,8 @@ TEST_F(SchedulerTest, PrepareTiles) { |
client->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(0, client->num_draws()); |
- EXPECT_FALSE(client->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_FALSE( |
+ client->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
} |
@@ -1065,7 +1078,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client_->num_draws()); |
- EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client_->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(scheduler_->RedrawPending()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
@@ -1082,10 +1096,12 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client_->num_draws()); |
- EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client_->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_TRUE(client_->HasAction("ScheduledActionPrepareTiles")); |
- EXPECT_LT(client_->ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
- client_->ActionIndex("ScheduledActionPrepareTiles")); |
+ EXPECT_LT( |
+ client_->ActionIndex("ScheduledActionSubmitCompositorFrameIfPossible"), |
+ client_->ActionIndex("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(scheduler_->RedrawPending()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
@@ -1106,7 +1122,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client_->num_draws()); |
- EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client_->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(scheduler_->RedrawPending()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
@@ -1130,7 +1147,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client_->num_draws()); |
- EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client_->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(scheduler_->RedrawPending()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
@@ -1146,10 +1164,12 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client_->num_draws()); |
- EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client_->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_TRUE(client_->HasAction("ScheduledActionPrepareTiles")); |
- EXPECT_LT(client_->ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
- client_->ActionIndex("ScheduledActionPrepareTiles")); |
+ EXPECT_LT( |
+ client_->ActionIndex("ScheduledActionSubmitCompositorFrameIfPossible"), |
+ client_->ActionIndex("ScheduledActionPrepareTiles")); |
EXPECT_FALSE(scheduler_->RedrawPending()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
@@ -1183,7 +1203,8 @@ TEST_F(SchedulerTest, PrepareTilesFunnelResetOnVisibilityChange) { |
client_->Reset(); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 2); |
EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2); |
} |
@@ -1236,7 +1257,8 @@ TEST_F(SchedulerTest, WaitForReadyToDrawDoNotPostDeadline) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client_->num_draws()); |
- EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_TRUE( |
+ client_->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
} |
TEST_F(SchedulerTest, WaitForReadyToDrawCancelledWhenLostCompositorFrameSink) { |
@@ -1519,12 +1541,13 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 3); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 2, |
+ 3); |
// Verify we skip every other frame if the swap ack consistently |
// comes back late. |
for (int i = 0; i < 10; i++) { |
- // Not calling scheduler_->DidSwapBuffersComplete() until after next |
+ // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next |
// BeginImplFrame puts the impl thread in high latency mode. |
client_->Reset(); |
scheduler_->SetNeedsBeginMainFrame(); |
@@ -1541,12 +1564,12 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( |
client_->Reset(); |
if (swap_ack_before_deadline) { |
// It shouldn't matter if the swap ack comes back before the deadline... |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
} else { |
// ... or after the deadline. |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
} |
EXPECT_NO_ACTION(client_); |
@@ -1565,7 +1588,8 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 3); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 2, |
+ 3); |
} |
} |
@@ -1640,12 +1664,13 @@ TEST_F(SchedulerTest, |
client_->Reset(); |
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
// Verify we skip every other frame if the swap ack consistently |
// comes back late. |
for (int i = 0; i < 10; i++) { |
- // Not calling scheduler_->DidSwapBuffersComplete() until after next |
+ // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next |
// BeginImplFrame puts the impl thread in high latency mode. |
client_->Reset(); |
scheduler_->SetNeedsRedraw(); |
@@ -1659,7 +1684,7 @@ TEST_F(SchedulerTest, |
// Verify that we do not perform any actions after we are no longer |
// swap throttled. |
client_->Reset(); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
EXPECT_NO_ACTION(client_); |
// Verify that we start the next BeginImplFrame and continue normally |
@@ -1674,7 +1699,8 @@ TEST_F(SchedulerTest, |
EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
task_runner().RunUntilTime(now_src_->NowTicks()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
} |
} |
@@ -1699,12 +1725,14 @@ void SchedulerTest::ImplFrameNotSkippedAfterLateSwapAck() { |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 3); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 2, |
+ 3); |
// Verify impl thread consistently operates in high latency mode |
// without skipping any frames. |
for (int i = 0; i < 10; i++) { |
- // Not calling scheduler_->DidSwapBuffersComplete() until after next frame |
+ // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next |
+ // frame |
// puts the impl thread in high latency mode. |
client_->Reset(); |
scheduler_->SetNeedsBeginMainFrame(); |
@@ -1715,7 +1743,7 @@ void SchedulerTest::ImplFrameNotSkippedAfterLateSwapAck() { |
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
client_->Reset(); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
scheduler_->NotifyReadyToCommit(); |
scheduler_->NotifyReadyToActivate(); |
@@ -1725,7 +1753,8 @@ void SchedulerTest::ImplFrameNotSkippedAfterLateSwapAck() { |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 4); |
EXPECT_ACTION("ScheduledActionCommit", client_, 1, 4); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 4); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 3, |
+ 4); |
} |
} |
@@ -1819,11 +1848,13 @@ TEST_F(SchedulerTest, |
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 5); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 2, |
+ 5); |
EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5); |
- // Don't call scheduler_->DidSwapBuffersComplete() until after next frame |
+ // Don't call scheduler_->DidReceiveCompositorFrameAck() until after next |
+ // frame |
// to put the impl thread in a high latency mode. |
client_->Reset(); |
scheduler_->SetNeedsBeginMainFrame(); |
@@ -1836,7 +1867,8 @@ TEST_F(SchedulerTest, |
// Note: BeginMainFrame and swap are skipped here because of |
// swap ack backpressure, not because of latency recovery. |
EXPECT_FALSE(client_->HasAction("ScheduledActionSendBeginMainFrame")); |
- EXPECT_FALSE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
+ EXPECT_FALSE( |
+ client_->HasAction("ScheduledActionSubmitCompositorFrameIfPossible")); |
EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
// Lower estimates so that the scheduler will attempt latency recovery. |
@@ -1850,15 +1882,16 @@ TEST_F(SchedulerTest, |
client_->Reset(); |
// Previous commit request is still outstanding. |
EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); |
- EXPECT_TRUE(scheduler_->SwapThrottled()); |
+ EXPECT_TRUE(scheduler_->SubmitThrottled()); |
SendNextBeginFrame(); |
EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 1, 2); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 1, |
+ 2); |
// Verify we skip the BeginImplFrame second. |
client_->Reset(); |
@@ -1868,7 +1901,7 @@ TEST_F(SchedulerTest, |
SendNextBeginFrame(); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
EXPECT_NO_ACTION(client_); |
@@ -1885,14 +1918,15 @@ TEST_F(SchedulerTest, |
scheduler_->NotifyReadyToActivate(); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); |
EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 4, |
+ 5); |
} |
TEST_F( |
@@ -1901,7 +1935,7 @@ TEST_F( |
// NPAPI plugins on Windows block the Browser UI thread on the Renderer main |
// thread. This prevents the scheduler from receiving any pending swap acks. |
- scheduler_settings_.main_frame_while_swap_throttled_enabled = true; |
+ scheduler_settings_.main_frame_while_submit_frame_throttled_enabled = true; |
SetUpScheduler(EXTERNAL_BFS); |
// Disables automatic swap acks so this test can force swap ack throttling |
@@ -1926,7 +1960,8 @@ TEST_F( |
EXPECT_ACTION("AddObserver(this)", client_, 0, 6); |
EXPECT_ACTION("WillBeginImplFrame", client_, 1, 6); |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 6); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 6); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 3, |
+ 6); |
EXPECT_ACTION("ScheduledActionCommit", client_, 4, 6); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 5, 6); |
@@ -1964,7 +1999,7 @@ TEST_F( |
// Since we are simulating a long commit, set up a client with draw duration |
// estimates that prevent skipping main frames to get to low latency mode. |
- scheduler_settings_.main_frame_while_swap_throttled_enabled = true; |
+ scheduler_settings_.main_frame_while_submit_frame_throttled_enabled = true; |
scheduler_settings_.main_frame_before_activation_enabled = true; |
SetUpScheduler(EXTERNAL_BFS); |
@@ -1983,14 +2018,15 @@ TEST_F( |
EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
scheduler_->NotifyReadyToCommit(); |
EXPECT_FALSE(scheduler_->CommitPending()); |
EXPECT_ACTION("AddObserver(this)", client_, 0, 5); |
EXPECT_ACTION("WillBeginImplFrame", client_, 1, 5); |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 5); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 5); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 3, |
+ 5); |
EXPECT_ACTION("ScheduledActionCommit", client_, 4, 5); |
// Start another commit while we still have an active tree. |
@@ -2003,11 +2039,12 @@ TEST_F( |
EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 3); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 2, |
+ 3); |
// Can't commit yet because there's still a pending tree. |
client_->Reset(); |
@@ -2058,7 +2095,8 @@ void SchedulerTest::BeginFramesNotFromClient(BeginFrameSourceType bfs_type) { |
// BeginImplFrame deadline should draw. The following BeginImplFrame deadline |
// should SetNeedsBeginFrame(false) to avoid excessive toggles. |
EXPECT_SCOPED(AdvanceFrame()); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 2); |
EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2); |
client_->Reset(); |
@@ -2077,7 +2115,7 @@ TEST_F(SchedulerTest, UnthrottledBeginFrames) { |
BeginFramesNotFromClient(UNTHROTTLED_BFS); |
} |
-void SchedulerTest::BeginFramesNotFromClient_SwapThrottled( |
+void SchedulerTest::BeginFramesNotFromClient_SubmitThrottled( |
BeginFrameSourceType bfs_type) { |
SetUpScheduler(bfs_type); |
@@ -2114,7 +2152,8 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled( |
// Swapping will put us into a swap throttled state. |
// Run posted deadline. |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2147,7 +2186,7 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled( |
client_->Reset(); |
// Take us out of a swap throttled state. |
- scheduler_->DidSwapBuffersComplete(); |
+ scheduler_->DidReceiveCompositorFrameAck(); |
EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); |
EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2165,12 +2204,12 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled( |
client_->Reset(); |
} |
-TEST_F(SchedulerTest, SyntheticBeginFrames_SwapThrottled) { |
- BeginFramesNotFromClient_SwapThrottled(THROTTLED_BFS); |
+TEST_F(SchedulerTest, SyntheticBeginFrames_SubmitThrottled) { |
+ BeginFramesNotFromClient_SubmitThrottled(THROTTLED_BFS); |
} |
-TEST_F(SchedulerTest, UnthrottledBeginFrames_SwapThrottled) { |
- BeginFramesNotFromClient_SwapThrottled(UNTHROTTLED_BFS); |
+TEST_F(SchedulerTest, UnthrottledBeginFrames_SubmitThrottled) { |
+ BeginFramesNotFromClient_SubmitThrottled(UNTHROTTLED_BFS); |
} |
TEST_F(SchedulerTest, |
@@ -2394,7 +2433,8 @@ TEST_F(SchedulerTest, DidLoseCompositorFrameSinkWhenIdle) { |
client_->Reset(); |
task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
// Idle time between BeginFrames. |
client_->Reset(); |
@@ -2476,7 +2516,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) { |
EXPECT_TRUE(scheduler_->begin_frames_expected()); |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
scheduler_->SetNeedsRedraw(); |
// Switch to an unthrottled frame source. |
@@ -2491,7 +2532,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) { |
// If we don't swap on the deadline, we wait for the next BeginFrame. |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
} |
@@ -2518,14 +2560,16 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 2); |
// Unthrottled frame source will immediately begin a new frame. |
EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2); |
scheduler_->SetNeedsRedraw(); |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
} |
@@ -2545,7 +2589,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) { |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2565,7 +2610,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) { |
EXPECT_TRUE(scheduler_->begin_frames_expected()); |
client_->Reset(); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
} |
TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) { |
@@ -2586,7 +2632,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) { |
EXPECT_TRUE(client_->IsInsideBeginImplFrame()); |
task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
EXPECT_FALSE(scheduler_->begin_frames_expected()); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2615,7 +2662,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) { |
client_->Reset(); |
task_runner().RunPendingTasks(); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
} |
// This test maskes sure that switching a frame source when not observing |
@@ -2692,7 +2740,8 @@ TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) { |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); |
EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5); |
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 4, |
+ 5); |
client_->Reset(); |
// The following BeginImplFrame deadline should SetNeedsBeginFrame(false) |
@@ -2732,7 +2781,8 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) { |
scheduler_->SetNeedsRedraw(); |
bool resourceless_software_draw = false; |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2750,7 +2800,8 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) { |
// Android onDraw. |
scheduler_->SetNeedsRedraw(); |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2771,7 +2822,8 @@ TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) { |
bool resourceless_software_draw = false; |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
EXPECT_ACTION("AddObserver(this)", client_, 0, 2); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 1, 2); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 1, |
+ 2); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2864,7 +2916,8 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) { |
scheduler_->SetNeedsRedraw(); |
bool resourceless_software_draw = false; |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
@@ -2927,9 +2980,10 @@ class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient { |
SchedulerClientSetNeedsPrepareTilesOnDraw() : FakeSchedulerClient() {} |
protected: |
- DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
+ DrawResult ScheduledActionSubmitCompositorFrameIfPossible() override { |
scheduler_->SetNeedsPrepareTiles(); |
- return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); |
+ return FakeSchedulerClient:: |
+ ScheduledActionSubmitCompositorFrameIfPossible(); |
} |
}; |
@@ -2954,7 +3008,8 @@ TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) { |
scheduler_->SetNeedsRedraw(); |
bool resourceless_software_draw = false; |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 2); |
EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
@@ -2963,7 +3018,8 @@ TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) { |
// Android onDraw. |
scheduler_->SetNeedsRedraw(); |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 2); |
EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
@@ -2997,7 +3053,8 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) { |
scheduler_->SetNeedsRedraw(); |
bool resourceless_software_draw = false; |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
client_->Reset(); |
@@ -3025,7 +3082,8 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) { |
// Android onDraw. |
scheduler_->SetNeedsRedraw(); |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_); |
+ EXPECT_SINGLE_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", |
+ client_); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
EXPECT_FALSE(scheduler_->PrepareTilesPending()); |
client_->Reset(); |
@@ -3046,7 +3104,8 @@ TEST_F(SchedulerTest, SynchronousCompositorResourcelessOnDrawWhenInvisible) { |
bool resourceless_software_draw = true; |
scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); |
// SynchronousCompositor has to draw regardless of visibility. |
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1); |
+ EXPECT_ACTION("ScheduledActionSubmitCompositorFrameIfPossible", client_, 0, |
+ 1); |
EXPECT_FALSE(client_->IsInsideBeginImplFrame()); |
client_->Reset(); |
} |