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

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

Issue 255033004: Revert of cc: SwapAck throttle Swap without throttling MainFrames (Closed) Base URL: http://git.chromium.org/chromium/src.git@cleanupOutputSurface
Patch Set: Created 6 years, 7 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 // and BeginMainFrames, but not draw. 1253 // but not a BeginMainFrame or 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, 2); 1256 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
1257 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1258 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1257 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1259 EXPECT_TRUE(client.needs_begin_frame()); 1258 EXPECT_TRUE(client.needs_begin_frame());
1260 client.Reset(); 1259 client.Reset();
1261 1260
1262 // Queue BeginFrame while we are still handling the previous BeginFrame. 1261 // Queue BeginFrame while we are still handling the previous BeginFrame.
1263 args.frame_time += base::TimeDelta::FromSeconds(1); 1262 args.frame_time += base::TimeDelta::FromSeconds(1);
1264 scheduler->BeginFrame(args); 1263 scheduler->BeginFrame(args);
1265 EXPECT_EQ(0, client.num_actions_()); 1264 EXPECT_EQ(0, client.num_actions_());
1266 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1265 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1267 EXPECT_TRUE(client.needs_begin_frame()); 1266 EXPECT_TRUE(client.needs_begin_frame());
1268 client.Reset(); 1267 client.Reset();
1269 1268
1270 // Take us out of a swap throttled state. 1269 // Take us out of a swap throttled state.
1271 scheduler->DidSwapBuffersComplete(); 1270 scheduler->DidSwapBuffersComplete();
1272 EXPECT_EQ(0, client.num_actions_()); 1271 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
1273 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1272 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1274 EXPECT_TRUE(client.needs_begin_frame()); 1273 EXPECT_TRUE(client.needs_begin_frame());
1275 client.Reset(); 1274 client.Reset();
1276 1275
1277 // BeginImplFrame deadline should draw. 1276 // BeginImplFrame deadline should draw.
1278 scheduler->SetNeedsRedraw(); 1277 scheduler->SetNeedsRedraw();
1279 client.task_runner().RunPendingTasks(); // Run posted deadline. 1278 client.task_runner().RunPendingTasks(); // Run posted deadline.
1280 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1279 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1281 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1280 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1282 EXPECT_TRUE(client.needs_begin_frame()); 1281 EXPECT_TRUE(client.needs_begin_frame());
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 EXPECT_FALSE(client.needs_begin_frame()); 1415 EXPECT_FALSE(client.needs_begin_frame());
1417 client.Reset(); 1416 client.Reset();
1418 1417
1419 // Swapping will put us into a swap throttled state. 1418 // Swapping will put us into a swap throttled state.
1420 client.task_runner().RunPendingTasks(); // Run posted deadline. 1419 client.task_runner().RunPendingTasks(); // Run posted deadline.
1421 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1420 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1422 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1421 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1423 EXPECT_FALSE(client.needs_begin_frame()); 1422 EXPECT_FALSE(client.needs_begin_frame());
1424 client.Reset(); 1423 client.Reset();
1425 1424
1426 // While swap throttled, BeginFrames should trigger BeginImplFrame and 1425 // While swap throttled, BeginFrames should trigger BeginImplFrames,
1427 // BeginMainFrame, but not draw. 1426 // but not a BeginMainFrame or draw.
1428 scheduler->SetNeedsCommit(); 1427 scheduler->SetNeedsCommit();
1429 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. 1428 client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
1430 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 1429 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
1431 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1432 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1430 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1433 EXPECT_FALSE(client.needs_begin_frame()); 1431 EXPECT_FALSE(client.needs_begin_frame());
1434 client.Reset(); 1432 client.Reset();
1435 1433
1436 // Take us out of a swap throttled state. 1434 // Take us out of a swap throttled state.
1437 scheduler->DidSwapBuffersComplete(); 1435 scheduler->DidSwapBuffersComplete();
1438 EXPECT_EQ(0, client.num_actions_()); 1436 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
1439 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1437 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1440 EXPECT_FALSE(client.needs_begin_frame()); 1438 EXPECT_FALSE(client.needs_begin_frame());
1441 client.Reset(); 1439 client.Reset();
1442 1440
1443 // BeginImplFrame deadline should draw. 1441 // BeginImplFrame deadline should draw.
1444 scheduler->SetNeedsRedraw(); 1442 scheduler->SetNeedsRedraw();
1445 client.task_runner().RunPendingTasks(); // Run posted deadline. 1443 client.task_runner().RunPendingTasks(); // Run posted deadline.
1446 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1444 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1447 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1445 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1448 EXPECT_FALSE(client.needs_begin_frame()); 1446 EXPECT_FALSE(client.needs_begin_frame());
(...skipping 17 matching lines...) Expand all
1466 TEST(SchedulerTest, 1464 TEST(SchedulerTest,
1467 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) { 1465 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) {
1468 bool begin_frame_scheduling_enabled = false; 1466 bool begin_frame_scheduling_enabled = false;
1469 bool throttle_frame_production = false; 1467 bool throttle_frame_production = false;
1470 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled, 1468 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled,
1471 throttle_frame_production); 1469 throttle_frame_production);
1472 } 1470 }
1473 1471
1474 } // namespace 1472 } // namespace
1475 } // namespace cc 1473 } // 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