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

Side by Side Diff: cc/scheduler/scheduler_unittest.cc

Issue 222023010: cc: SwapAck throttle Swap without throttling MainFrames (Closed) Base URL: http://git.chromium.org/chromium/src.git@cleanupOutputSurface
Patch Set: try again: rebase; fix tests Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "cc/scheduler/scheduler.h" 4 #include "cc/scheduler/scheduler.h"
5 5
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 client.Reset(); 1243 client.Reset();
1244 1244
1245 // Swapping will put us into a swap throttled state. 1245 // Swapping will put us into a swap throttled state.
1246 client.task_runner().RunPendingTasks(); // Run posted deadline. 1246 client.task_runner().RunPendingTasks(); // Run posted deadline.
1247 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1247 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1248 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1248 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1249 EXPECT_TRUE(client.needs_begin_frame()); 1249 EXPECT_TRUE(client.needs_begin_frame());
1250 client.Reset(); 1250 client.Reset();
1251 1251
1252 // While swap throttled, BeginRetroFrames should trigger BeginImplFrames 1252 // While swap throttled, BeginRetroFrames should trigger BeginImplFrames
1253 // but not a BeginMainFrame or draw. 1253 // and BeginMainFrames, but not draw.
1254 scheduler->SetNeedsCommit(); 1254 scheduler->SetNeedsCommit();
1255 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. 1255 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
1256 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); 1256 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1257 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1257 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1258 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1258 EXPECT_TRUE(client.needs_begin_frame()); 1259 EXPECT_TRUE(client.needs_begin_frame());
1259 client.Reset(); 1260 client.Reset();
1260 1261
1261 // Queue BeginFrame while we are still handling the previous BeginFrame. 1262 // Queue BeginFrame while we are still handling the previous BeginFrame.
1262 args.frame_time += base::TimeDelta::FromSeconds(1); 1263 args.frame_time += base::TimeDelta::FromSeconds(1);
1263 scheduler->BeginFrame(args); 1264 scheduler->BeginFrame(args);
1264 EXPECT_EQ(0, client.num_actions_()); 1265 EXPECT_EQ(0, client.num_actions_());
1265 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1266 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1266 EXPECT_TRUE(client.needs_begin_frame()); 1267 EXPECT_TRUE(client.needs_begin_frame());
1267 client.Reset(); 1268 client.Reset();
1268 1269
1269 // Take us out of a swap throttled state. 1270 // Take us out of a swap throttled state.
1270 scheduler->DidSwapBuffersComplete(); 1271 scheduler->DidSwapBuffersComplete();
1271 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); 1272 EXPECT_EQ(0, client.num_actions_());
1272 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1273 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1273 EXPECT_TRUE(client.needs_begin_frame()); 1274 EXPECT_TRUE(client.needs_begin_frame());
1274 client.Reset(); 1275 client.Reset();
1275 1276
1276 // BeginImplFrame deadline should draw. 1277 // BeginImplFrame deadline should draw.
1277 scheduler->SetNeedsRedraw(); 1278 scheduler->SetNeedsRedraw();
1278 client.task_runner().RunPendingTasks(); // Run posted deadline. 1279 client.task_runner().RunPendingTasks(); // Run posted deadline.
1279 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1280 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1280 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1281 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1281 EXPECT_TRUE(client.needs_begin_frame()); 1282 EXPECT_TRUE(client.needs_begin_frame());
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 EXPECT_FALSE(client.needs_begin_frame()); 1416 EXPECT_FALSE(client.needs_begin_frame());
1416 client.Reset(); 1417 client.Reset();
1417 1418
1418 // Swapping will put us into a swap throttled state. 1419 // Swapping will put us into a swap throttled state.
1419 client.task_runner().RunPendingTasks(); // Run posted deadline. 1420 client.task_runner().RunPendingTasks(); // Run posted deadline.
1420 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1421 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1421 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1422 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1422 EXPECT_FALSE(client.needs_begin_frame()); 1423 EXPECT_FALSE(client.needs_begin_frame());
1423 client.Reset(); 1424 client.Reset();
1424 1425
1425 // While swap throttled, BeginFrames should trigger BeginImplFrames, 1426 // While swap throttled, BeginFrames should trigger BeginImplFrame and
1426 // but not a BeginMainFrame or draw. 1427 // BeginMainFrame, but not draw.
1427 scheduler->SetNeedsCommit(); 1428 scheduler->SetNeedsCommit();
1428 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. 1429 client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
1429 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); 1430 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1431 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1430 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1432 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1431 EXPECT_FALSE(client.needs_begin_frame()); 1433 EXPECT_FALSE(client.needs_begin_frame());
1432 client.Reset(); 1434 client.Reset();
1433 1435
1434 // Take us out of a swap throttled state. 1436 // Take us out of a swap throttled state.
1435 scheduler->DidSwapBuffersComplete(); 1437 scheduler->DidSwapBuffersComplete();
1436 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); 1438 EXPECT_EQ(0, client.num_actions_());
1437 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1439 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1438 EXPECT_FALSE(client.needs_begin_frame()); 1440 EXPECT_FALSE(client.needs_begin_frame());
1439 client.Reset(); 1441 client.Reset();
1440 1442
1441 // BeginImplFrame deadline should draw. 1443 // BeginImplFrame deadline should draw.
1442 scheduler->SetNeedsRedraw(); 1444 scheduler->SetNeedsRedraw();
1443 client.task_runner().RunPendingTasks(); // Run posted deadline. 1445 client.task_runner().RunPendingTasks(); // Run posted deadline.
1444 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1446 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1445 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1447 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1446 EXPECT_FALSE(client.needs_begin_frame()); 1448 EXPECT_FALSE(client.needs_begin_frame());
(...skipping 17 matching lines...) Expand all
1464 TEST(SchedulerTest, 1466 TEST(SchedulerTest,
1465 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) { 1467 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) {
1466 bool begin_frame_scheduling_enabled = false; 1468 bool begin_frame_scheduling_enabled = false;
1467 bool throttle_frame_production = false; 1469 bool throttle_frame_production = false;
1468 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled, 1470 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled,
1469 throttle_frame_production); 1471 throttle_frame_production);
1470 } 1472 }
1471 1473
1472 } // namespace 1474 } // namespace
1473 } // namespace cc 1475 } // namespace cc
OLDNEW
« 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