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

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

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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') | cc/scheduler/scheduler_unittest.cc » ('j') | 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 4
5 #include "cc/scheduler/scheduler_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/scheduler/scheduler.h" 8 #include "cc/scheduler/scheduler.h"
9 #include "cc/test/begin_frame_args_test.h" 9 #include "cc/test/begin_frame_args_test.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 TEST(SchedulerStateMachineTest, TestRequestCommitInvisible) { 1072 TEST(SchedulerStateMachineTest, TestRequestCommitInvisible) {
1073 SchedulerSettings default_scheduler_settings; 1073 SchedulerSettings default_scheduler_settings;
1074 StateMachine state(default_scheduler_settings); 1074 StateMachine state(default_scheduler_settings);
1075 state.SetCanStart(); 1075 state.SetCanStart();
1076 state.UpdateState(state.NextAction()); 1076 state.UpdateState(state.NextAction());
1077 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1077 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1078 state.SetNeedsCommit(); 1078 state.SetNeedsCommit();
1079 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1079 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1080 } 1080 }
1081 1081
1082 TEST(SchedulerStateMachineTest, TestGoesInvisibleBeforeFinishCommit) { 1082 // See ThreadProxy::BeginMainFrame "EarlyOut_NotVisible" /
1083 // "EarlyOut_OutputSurfaceLost" cases.
1084 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) {
1083 SchedulerSettings default_scheduler_settings; 1085 SchedulerSettings default_scheduler_settings;
1084 StateMachine state(default_scheduler_settings); 1086 StateMachine state(default_scheduler_settings);
1085 state.SetCanStart(); 1087 state.SetCanStart();
1086 state.UpdateState(state.NextAction()); 1088 state.UpdateState(state.NextAction());
1087 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1089 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1088 state.SetVisible(true); 1090 state.SetVisible(true);
1089 state.SetCanDraw(true); 1091 state.SetCanDraw(true);
1090 1092
1091 // Start clean and set commit. 1093 // Start clean and set commit.
1092 state.SetNeedsCommit(); 1094 state.SetNeedsCommit();
1093 1095
1094 // Begin the frame while visible. 1096 // Begin the frame while visible.
1095 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1097 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
1096 EXPECT_ACTION_UPDATE_STATE( 1098 EXPECT_ACTION_UPDATE_STATE(
1097 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1099 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1098 EXPECT_COMMIT_STATE( 1100 EXPECT_COMMIT_STATE(
1099 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1101 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1100 EXPECT_FALSE(state.NeedsCommit()); 1102 EXPECT_FALSE(state.NeedsCommit());
1101 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1103 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1102 1104
1103 // Become invisible and abort BeginMainFrame. 1105 // Become invisible and abort BeginMainFrame.
1104 state.SetVisible(false); 1106 state.SetVisible(false);
1105 state.BeginMainFrameAborted(false); 1107 state.BeginMainFrameAborted(CommitEarlyOutReason::ABORTED_NOT_VISIBLE);
1108
1109 // NeedsCommit should now be true again because we never actually did a
1110 // commit.
1111 EXPECT_TRUE(state.NeedsCommit());
1106 1112
1107 // We should now be back in the idle state as if we never started the frame. 1113 // We should now be back in the idle state as if we never started the frame.
1108 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1114 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1109 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1115 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1110 1116
1111 // We shouldn't do anything on the BeginImplFrame deadline. 1117 // We shouldn't do anything on the BeginImplFrame deadline.
1112 state.OnBeginImplFrameDeadline(); 1118 state.OnBeginImplFrameDeadline();
1113 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1119 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1114 1120
1115 // Become visible again. 1121 // Become visible again.
1116 state.SetVisible(true); 1122 state.SetVisible(true);
1117 1123
1118 // Although we have aborted on this frame and haven't cancelled the commit 1124 // Although we have aborted on this frame and haven't cancelled the commit
1119 // (i.e. need another), don't send another BeginMainFrame yet. 1125 // (i.e. need another), don't send another BeginMainFrame yet.
1120 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1126 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1121 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1127 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1122 EXPECT_TRUE(state.NeedsCommit()); 1128 EXPECT_TRUE(state.NeedsCommit());
1123 1129
1124 // Start a new frame. 1130 // Start a new frame.
1125 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1131 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
1126 EXPECT_ACTION_UPDATE_STATE( 1132 EXPECT_ACTION_UPDATE_STATE(
1127 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1133 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1128 1134
1129 // We should be starting the commit now. 1135 // We should be starting the commit now.
1130 EXPECT_COMMIT_STATE( 1136 EXPECT_COMMIT_STATE(
1131 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1137 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1132 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1138 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1133 } 1139 }
1134 1140
1135 TEST(SchedulerStateMachineTest, AbortBeginMainFrameAndCancelCommit) { 1141 // See ThreadProxy::BeginMainFrame "EarlyOut_NoUpdates" case.
1142 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) {
1136 SchedulerSettings default_scheduler_settings; 1143 SchedulerSettings default_scheduler_settings;
1137 StateMachine state(default_scheduler_settings); 1144 StateMachine state(default_scheduler_settings);
1138 state.SetCanStart(); 1145 state.SetCanStart();
1139 state.UpdateState(state.NextAction()); 1146 state.UpdateState(state.NextAction());
1140 state.DidCreateAndInitializeOutputSurface(); 1147 state.DidCreateAndInitializeOutputSurface();
1141 state.SetVisible(true); 1148 state.SetVisible(true);
1142 state.SetCanDraw(true); 1149 state.SetCanDraw(true);
1143 1150
1144 // Get into a begin frame / commit state. 1151 // Get into a begin frame / commit state.
1145 state.SetNeedsCommit(); 1152 state.SetNeedsCommit();
1146 1153
1147 EXPECT_ACTION_UPDATE_STATE( 1154 EXPECT_ACTION_UPDATE_STATE(
1148 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1155 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1149 EXPECT_COMMIT_STATE( 1156 EXPECT_COMMIT_STATE(
1150 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1157 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1151 EXPECT_FALSE(state.NeedsCommit()); 1158 EXPECT_FALSE(state.NeedsCommit());
1152 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1159 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1153 1160
1154 // Abort the commit, cancelling future commits. 1161 // Abort the commit, true means that the BeginMainFrame was sent but there
1155 state.BeginMainFrameAborted(true); 1162 // was no work to do on the main thread.
1163 state.BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES);
1156 1164
1165 // NeedsCommit should now be false because the commit was actually handled.
1166 EXPECT_FALSE(state.NeedsCommit());
1157 // Verify that another commit doesn't start on the same frame. 1167 // Verify that another commit doesn't start on the same frame.
1158 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1168 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1159 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1169 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1160 EXPECT_FALSE(state.NeedsCommit());
1161 1170
1162 // Start a new frame; draw because this is the first frame since output 1171 // Even though the commit was aborted, we still expect to draw the new frame.
1163 // surface init'd.
1164 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1172 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
1165 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1173 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1166 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1174 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1167 state.OnBeginImplFrameDeadline(); 1175 state.OnBeginImplFrameDeadline();
1168 EXPECT_ACTION_UPDATE_STATE( 1176 EXPECT_ACTION_UPDATE_STATE(
1169 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1177 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1170 state.DidSwapBuffers();
1171 state.DidSwapBuffersComplete();
1172
1173 // Verify another commit doesn't start on another frame either.
1174 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1175 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1176 EXPECT_FALSE(state.NeedsCommit());
1177
1178 // Verify another commit can start if requested, though.
1179 state.SetNeedsCommit();
1180 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1181 EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1182 }
1183
1184 TEST(SchedulerStateMachineTest,
1185 AbortBeginMainFrameAndCancelCommitWhenInvisible) {
1186 SchedulerSettings default_scheduler_settings;
1187 StateMachine state(default_scheduler_settings);
1188 state.SetCanStart();
1189 state.UpdateState(state.NextAction());
1190 state.DidCreateAndInitializeOutputSurface();
1191 state.SetVisible(true);
1192 state.SetCanDraw(true);
1193
1194 // Get into a begin frame / commit state.
1195 state.SetNeedsCommit();
1196
1197 EXPECT_ACTION_UPDATE_STATE(
1198 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1199 EXPECT_COMMIT_STATE(
1200 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1201 EXPECT_FALSE(state.NeedsCommit());
1202 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1203
1204 // Become invisible and abort BeginMainFrame.
1205 state.SetVisible(false);
1206 state.BeginMainFrameAborted(true);
1207
1208 // Verify that another commit doesn't start on the same frame.
1209 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1210 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1211 EXPECT_FALSE(state.NeedsCommit());
1212
1213 // Become visible and start a new frame.
1214 state.SetVisible(true);
1215 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
1216 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1217 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1218
1219 // Draw because this is the first frame since output surface init'd.
1220 state.OnBeginImplFrameDeadline();
1221 EXPECT_ACTION_UPDATE_STATE(
1222 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1223 state.DidSwapBuffers(); 1178 state.DidSwapBuffers();
1224 state.DidSwapBuffersComplete(); 1179 state.DidSwapBuffersComplete();
1225 1180
1226 // Verify another commit doesn't start on another frame either. 1181 // Verify another commit doesn't start on another frame either.
1227 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1182 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1228 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1183 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1229 EXPECT_FALSE(state.NeedsCommit()); 1184 EXPECT_FALSE(state.NeedsCommit());
1230 1185
1231 // Verify another commit can start if requested, though. 1186 // Verify another commit can start if requested, though.
1232 state.SetNeedsCommit(); 1187 state.SetNeedsCommit();
1233 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1188 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1234 EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1189 EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1235 } 1190 }
1236 1191
1237 TEST(SchedulerStateMachineTest,
1238 AbortBeginMainFrameAndRequestCommitWhenInvisible) {
1239 SchedulerSettings default_scheduler_settings;
1240 StateMachine state(default_scheduler_settings);
1241 state.SetCanStart();
1242 state.UpdateState(state.NextAction());
1243 state.DidCreateAndInitializeOutputSurface();
1244 state.SetVisible(true);
1245 state.SetCanDraw(true);
1246
1247 // Get into a begin frame / commit state.
1248 state.SetNeedsCommit();
1249
1250 EXPECT_ACTION_UPDATE_STATE(
1251 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1252 EXPECT_COMMIT_STATE(
1253 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1254 EXPECT_FALSE(state.NeedsCommit());
1255 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1256
1257 // Become invisible and abort BeginMainFrame.
1258 state.SetVisible(false);
1259 state.BeginMainFrameAborted(true);
1260
1261 // Verify that another commit doesn't start on the same frame.
1262 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1263 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1264 EXPECT_FALSE(state.NeedsCommit());
1265
1266 // Asking for a commit while not visible won't make it happen.
1267 state.SetNeedsCommit();
1268 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1269 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1270 EXPECT_TRUE(state.NeedsCommit());
1271
1272 // Become visible but nothing happens until the next frame.
1273 state.SetVisible(true);
1274 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1275 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1276 EXPECT_TRUE(state.NeedsCommit());
1277
1278 // We should get that commit when we begin the next frame.
1279 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
1280 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1281 EXPECT_ACTION_UPDATE_STATE(
1282 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1283 }
1284
1285 TEST(SchedulerStateMachineTest,
1286 AbortBeginMainFrameAndRequestCommitAndBeginImplFrameWhenInvisible) {
1287 SchedulerSettings default_scheduler_settings;
1288 StateMachine state(default_scheduler_settings);
1289 state.SetCanStart();
1290 state.UpdateState(state.NextAction());
1291 state.DidCreateAndInitializeOutputSurface();
1292 state.SetVisible(true);
1293 state.SetCanDraw(true);
1294
1295 // Get into a begin frame / commit state.
1296 state.SetNeedsCommit();
1297
1298 EXPECT_ACTION_UPDATE_STATE(
1299 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1300 EXPECT_COMMIT_STATE(
1301 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1302 EXPECT_FALSE(state.NeedsCommit());
1303 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1304
1305 // Become invisible and abort BeginMainFrame.
1306 state.SetVisible(false);
1307 state.BeginMainFrameAborted(true);
1308
1309 // Asking for a commit while not visible won't make it happen.
1310 state.SetNeedsCommit();
1311 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1312 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1313 EXPECT_TRUE(state.NeedsCommit());
1314
1315 // Begin a frame when not visible, the scheduler animates but does not commit.
1316 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
1317 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1318 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1319 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1320 EXPECT_TRUE(state.NeedsCommit());
1321
1322 // Become visible and the requested commit happens immediately.
1323 state.SetVisible(true);
1324 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1325 EXPECT_ACTION_UPDATE_STATE(
1326 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1327 }
1328
1329 TEST(SchedulerStateMachineTest, TestFirstContextCreation) { 1192 TEST(SchedulerStateMachineTest, TestFirstContextCreation) {
1330 SchedulerSettings default_scheduler_settings; 1193 SchedulerSettings default_scheduler_settings;
1331 StateMachine state(default_scheduler_settings); 1194 StateMachine state(default_scheduler_settings);
1332 state.SetCanStart(); 1195 state.SetCanStart();
1333 state.SetVisible(true); 1196 state.SetVisible(true);
1334 state.SetCanDraw(true); 1197 state.SetCanDraw(true);
1335 1198
1336 EXPECT_ACTION_UPDATE_STATE( 1199 EXPECT_ACTION_UPDATE_STATE(
1337 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1200 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1338 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1201 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 state.SetNeedsCommit(); 1613 state.SetNeedsCommit();
1751 1614
1752 // We should start the commit normally. 1615 // We should start the commit normally.
1753 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1616 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1754 EXPECT_ACTION_UPDATE_STATE( 1617 EXPECT_ACTION_UPDATE_STATE(
1755 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1618 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1756 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1619 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1757 1620
1758 // Since only the scroll offset changed, the main thread will abort the 1621 // Since only the scroll offset changed, the main thread will abort the
1759 // commit. 1622 // commit.
1760 state.BeginMainFrameAborted(true); 1623 state.BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES);
1761 1624
1762 // Since the commit was aborted, we should draw right away instead of waiting 1625 // Since the commit was aborted, we should draw right away instead of waiting
1763 // for the deadline. 1626 // for the deadline.
1764 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); 1627 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
1765 } 1628 }
1766 1629
1767 void FinishPreviousCommitAndDrawWithoutExitingDeadline( 1630 void FinishPreviousCommitAndDrawWithoutExitingDeadline(
1768 StateMachine* state_ptr) { 1631 StateMachine* state_ptr) {
1769 // Gross, but allows us to use macros below. 1632 // Gross, but allows us to use macros below.
1770 StateMachine& state = *state_ptr; 1633 StateMachine& state = *state_ptr;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 state.SetVisible(true); 1855 state.SetVisible(true);
1993 state.SetCanDraw(true); 1856 state.SetCanDraw(true);
1994 1857
1995 EXPECT_FALSE(state.BeginFrameNeeded()); 1858 EXPECT_FALSE(state.BeginFrameNeeded());
1996 state.SetChildrenNeedBeginFrames(true); 1859 state.SetChildrenNeedBeginFrames(true);
1997 EXPECT_TRUE(state.BeginFrameNeeded()); 1860 EXPECT_TRUE(state.BeginFrameNeeded());
1998 } 1861 }
1999 1862
2000 } // namespace 1863 } // namespace
2001 } // namespace cc 1864 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698