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

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

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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') | 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/trace_event/trace_event.h" 7 #include "base/trace_event/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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 bool PendingActivationsShouldBeForced() const { 126 bool PendingActivationsShouldBeForced() const {
127 return SchedulerStateMachine::PendingActivationsShouldBeForced(); 127 return SchedulerStateMachine::PendingActivationsShouldBeForced();
128 } 128 }
129 129
130 void SetHasPendingTree(bool has_pending_tree) { 130 void SetHasPendingTree(bool has_pending_tree) {
131 has_pending_tree_ = has_pending_tree; 131 has_pending_tree_ = has_pending_tree;
132 } 132 }
133 133
134 using SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately; 134 using SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately;
135 using SchedulerStateMachine::ProactiveBeginFrameWanted;
136 using SchedulerStateMachine::UpdateStateOnCommit;
135 }; 137 };
136 138
137 TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { 139 TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) {
138 SchedulerSettings default_scheduler_settings; 140 SchedulerSettings default_scheduler_settings;
139 141
140 // If no commit needed, do nothing. 142 // If no commit needed, do nothing.
141 { 143 {
142 StateMachine state(default_scheduler_settings); 144 StateMachine state(default_scheduler_settings);
143 state.SetCanStart(); 145 state.SetCanStart();
144 EXPECT_ACTION_UPDATE_STATE( 146 EXPECT_ACTION_UPDATE_STATE(
145 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION) 147 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION)
146 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 148 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
147 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); 149 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
148 state.SetNeedsRedraw(false); 150 state.SetNeedsRedraw(false);
149 state.SetVisible(true); 151 state.SetVisible(true);
150 152
151 EXPECT_FALSE(state.BeginFrameNeeded()); 153 EXPECT_FALSE(state.BeginFrameNeeded());
152 154
153 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 155 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
154 EXPECT_FALSE(state.BeginFrameNeeded()); 156 EXPECT_FALSE(state.BeginFrameNeeded());
155 state.OnBeginImplFrame( 157 state.OnBeginImplFrame();
156 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
157 158
158 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 159 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
159 state.OnBeginImplFrameDeadline(); 160 state.OnBeginImplFrameDeadline();
160 } 161 }
161 162
162 // If commit requested but can_start is still false, do nothing. 163 // If commit requested but can_start is still false, do nothing.
163 { 164 {
164 StateMachine state(default_scheduler_settings); 165 StateMachine state(default_scheduler_settings);
165 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); 166 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
166 state.SetNeedsRedraw(false); 167 state.SetNeedsRedraw(false);
167 state.SetVisible(true); 168 state.SetVisible(true);
168 state.SetNeedsCommit(); 169 state.SetNeedsCommit();
169 170
170 EXPECT_FALSE(state.BeginFrameNeeded()); 171 EXPECT_FALSE(state.BeginFrameNeeded());
171 172
172 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 173 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
173 EXPECT_FALSE(state.BeginFrameNeeded()); 174 EXPECT_FALSE(state.BeginFrameNeeded());
174 state.OnBeginImplFrame( 175 state.OnBeginImplFrame();
175 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
176 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 176 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
177 state.OnBeginImplFrameDeadline(); 177 state.OnBeginImplFrameDeadline();
178 } 178 }
179 179
180 // If commit requested, begin a main frame. 180 // If commit requested, begin a main frame.
181 { 181 {
182 StateMachine state(default_scheduler_settings); 182 StateMachine state(default_scheduler_settings);
183 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); 183 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
184 state.SetCanStart(); 184 state.SetCanStart();
185 state.UpdateState(state.NextAction()); 185 state.UpdateState(state.NextAction());
186 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 186 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
187 state.SetNeedsRedraw(false); 187 state.SetNeedsRedraw(false);
188 state.SetVisible(true); 188 state.SetVisible(true);
189 state.SetNeedsCommit(); 189 state.SetNeedsCommit();
190 190
191 EXPECT_TRUE(state.BeginFrameNeeded()); 191 EXPECT_TRUE(state.BeginFrameNeeded());
192 192
193 state.OnBeginImplFrame( 193 state.OnBeginImplFrame();
194 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
195 EXPECT_ACTION_UPDATE_STATE( 194 EXPECT_ACTION_UPDATE_STATE(
196 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 195 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
197 } 196 }
198 197
199 // Begin the frame, make sure needs_commit and commit_state update correctly. 198 // Begin the frame, make sure needs_commit and commit_state update correctly.
200 { 199 {
201 StateMachine state(default_scheduler_settings); 200 StateMachine state(default_scheduler_settings);
202 state.SetCanStart(); 201 state.SetCanStart();
203 state.UpdateState(state.NextAction()); 202 state.UpdateState(state.NextAction());
204 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 203 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
(...skipping 12 matching lines...) Expand all
217 scheduler_settings.main_frame_before_activation_enabled = true; 216 scheduler_settings.main_frame_before_activation_enabled = true;
218 StateMachine state(scheduler_settings); 217 StateMachine state(scheduler_settings);
219 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); 218 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
220 SET_UP_STATE(state) 219 SET_UP_STATE(state)
221 state.SetNeedsRedraw(false); 220 state.SetNeedsRedraw(false);
222 state.SetNeedsCommit(); 221 state.SetNeedsCommit();
223 222
224 EXPECT_TRUE(state.BeginFrameNeeded()); 223 EXPECT_TRUE(state.BeginFrameNeeded());
225 224
226 // Commit to the pending tree. 225 // Commit to the pending tree.
227 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 226 state.OnBeginImplFrame();
228 EXPECT_ACTION_UPDATE_STATE( 227 EXPECT_ACTION_UPDATE_STATE(
229 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 228 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
230 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 229 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
231 230
232 state.NotifyBeginMainFrameStarted(); 231 state.NotifyBeginMainFrameStarted();
233 state.NotifyReadyToCommit(); 232 state.NotifyReadyToCommit();
234 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 233 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
235 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 234 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
236 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 235 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
237 236
238 state.OnBeginImplFrameDeadline(); 237 state.OnBeginImplFrameDeadline();
239 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 238 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
240 239
241 // Verify that the next commit starts while there is still a pending tree. 240 // Verify that the next commit starts while there is still a pending tree.
242 state.SetNeedsCommit(); 241 state.SetNeedsCommit();
243 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 242 state.OnBeginImplFrame();
244 EXPECT_ACTION_UPDATE_STATE( 243 EXPECT_ACTION_UPDATE_STATE(
245 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 244 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
246 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 245 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
247 246
248 // Verify the pending commit doesn't overwrite the pending 247 // Verify the pending commit doesn't overwrite the pending
249 // tree until the pending tree has been activated. 248 // tree until the pending tree has been activated.
250 state.NotifyBeginMainFrameStarted(); 249 state.NotifyBeginMainFrameStarted();
251 state.NotifyReadyToCommit(); 250 state.NotifyReadyToCommit();
252 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 251 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
253 252
(...skipping 16 matching lines...) Expand all
270 } 269 }
271 270
272 TEST(SchedulerStateMachineTest, 271 TEST(SchedulerStateMachineTest,
273 TestFailedDrawForAnimationCheckerboardSetsNeedsCommitAndDoesNotDrawAgain) { 272 TestFailedDrawForAnimationCheckerboardSetsNeedsCommitAndDoesNotDrawAgain) {
274 SchedulerSettings default_scheduler_settings; 273 SchedulerSettings default_scheduler_settings;
275 StateMachine state(default_scheduler_settings); 274 StateMachine state(default_scheduler_settings);
276 SET_UP_STATE(state) 275 SET_UP_STATE(state)
277 state.SetNeedsRedraw(true); 276 state.SetNeedsRedraw(true);
278 EXPECT_TRUE(state.RedrawPending()); 277 EXPECT_TRUE(state.RedrawPending());
279 EXPECT_TRUE(state.BeginFrameNeeded()); 278 EXPECT_TRUE(state.BeginFrameNeeded());
280 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 279 state.OnBeginImplFrame();
281 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 280 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
282 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 281 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
283 state.OnBeginImplFrameDeadline(); 282 state.OnBeginImplFrameDeadline();
284 283
285 // We're drawing now. 284 // We're drawing now.
286 EXPECT_ACTION_UPDATE_STATE( 285 EXPECT_ACTION_UPDATE_STATE(
287 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 286 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
288 state.DidSwapBuffers(); 287 state.DidSwapBuffers();
289 state.DidSwapBuffersComplete(); 288 state.DidSwapBuffersComplete();
290 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 289 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
291 290
292 EXPECT_FALSE(state.RedrawPending()); 291 EXPECT_FALSE(state.RedrawPending());
293 EXPECT_FALSE(state.CommitPending()); 292 EXPECT_FALSE(state.CommitPending());
294 293
295 // Failing the draw makes us require a commit. 294 // Failing the draw makes us require a commit.
296 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); 295 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
297 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 296 state.OnBeginImplFrame();
298 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 297 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
299 EXPECT_ACTION_UPDATE_STATE( 298 EXPECT_ACTION_UPDATE_STATE(
300 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 299 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
301 EXPECT_TRUE(state.RedrawPending()); 300 EXPECT_TRUE(state.RedrawPending());
302 EXPECT_TRUE(state.CommitPending()); 301 EXPECT_TRUE(state.CommitPending());
303 } 302 }
304 303
305 TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) { 304 TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) {
306 SchedulerSettings default_scheduler_settings; 305 SchedulerSettings default_scheduler_settings;
307 StateMachine state(default_scheduler_settings); 306 StateMachine state(default_scheduler_settings);
308 SET_UP_STATE(state) 307 SET_UP_STATE(state)
309 state.SetNeedsRedraw(true); 308 state.SetNeedsRedraw(true);
310 EXPECT_TRUE(state.RedrawPending()); 309 EXPECT_TRUE(state.RedrawPending());
311 EXPECT_TRUE(state.BeginFrameNeeded()); 310 EXPECT_TRUE(state.BeginFrameNeeded());
312 311
313 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 312 state.OnBeginImplFrame();
314 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 313 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
315 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 314 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
316 state.OnBeginImplFrameDeadline(); 315 state.OnBeginImplFrameDeadline();
317 EXPECT_ACTION_UPDATE_STATE( 316 EXPECT_ACTION_UPDATE_STATE(
318 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 317 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
319 state.DidSwapBuffers(); 318 state.DidSwapBuffers();
320 state.DidSwapBuffersComplete(); 319 state.DidSwapBuffersComplete();
321 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 320 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
322 EXPECT_FALSE(state.RedrawPending()); 321 EXPECT_FALSE(state.RedrawPending());
323 EXPECT_FALSE(state.CommitPending()); 322 EXPECT_FALSE(state.CommitPending());
324 323
325 // Missing high res content requires a commit (but not a redraw) 324 // Missing high res content requires a commit (but not a redraw)
326 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT); 325 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT);
327 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 326 state.OnBeginImplFrame();
328 EXPECT_ACTION_UPDATE_STATE( 327 EXPECT_ACTION_UPDATE_STATE(
329 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 328 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
330 EXPECT_FALSE(state.RedrawPending()); 329 EXPECT_FALSE(state.RedrawPending());
331 EXPECT_TRUE(state.CommitPending()); 330 EXPECT_TRUE(state.CommitPending());
332 } 331 }
333 332
334 TEST(SchedulerStateMachineTest, 333 TEST(SchedulerStateMachineTest,
335 TestsetNeedsRedrawDuringFailedDrawDoesNotRemoveNeedsRedraw) { 334 TestsetNeedsRedrawDuringFailedDrawDoesNotRemoveNeedsRedraw) {
336 SchedulerSettings default_scheduler_settings; 335 SchedulerSettings default_scheduler_settings;
337 StateMachine state(default_scheduler_settings); 336 StateMachine state(default_scheduler_settings);
338 SET_UP_STATE(state) 337 SET_UP_STATE(state)
339 state.SetNeedsRedraw(true); 338 state.SetNeedsRedraw(true);
340 EXPECT_TRUE(state.RedrawPending()); 339 EXPECT_TRUE(state.RedrawPending());
341 EXPECT_TRUE(state.BeginFrameNeeded()); 340 EXPECT_TRUE(state.BeginFrameNeeded());
342 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 341 state.OnBeginImplFrame();
343 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 342 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
344 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 343 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
345 state.OnBeginImplFrameDeadline(); 344 state.OnBeginImplFrameDeadline();
346 345
347 // We're drawing now. 346 // We're drawing now.
348 EXPECT_ACTION_UPDATE_STATE( 347 EXPECT_ACTION_UPDATE_STATE(
349 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 348 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
350 state.DidSwapBuffers(); 349 state.DidSwapBuffers();
351 state.DidSwapBuffersComplete(); 350 state.DidSwapBuffersComplete();
352 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 351 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
353 EXPECT_FALSE(state.RedrawPending()); 352 EXPECT_FALSE(state.RedrawPending());
354 EXPECT_FALSE(state.CommitPending()); 353 EXPECT_FALSE(state.CommitPending());
355 354
356 // While still in the same BeginMainFrame callback on the main thread, 355 // While still in the same BeginMainFrame callback on the main thread,
357 // set needs redraw again. This should not redraw. 356 // set needs redraw again. This should not redraw.
358 state.SetNeedsRedraw(true); 357 state.SetNeedsRedraw(true);
359 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 358 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
360 359
361 // Failing the draw for animation checkerboards makes us require a commit. 360 // Failing the draw for animation checkerboards makes us require a commit.
362 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); 361 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
363 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 362 state.OnBeginImplFrame();
364 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 363 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
365 EXPECT_ACTION_UPDATE_STATE( 364 EXPECT_ACTION_UPDATE_STATE(
366 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 365 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
367 EXPECT_TRUE(state.RedrawPending()); 366 EXPECT_TRUE(state.RedrawPending());
368 } 367 }
369 368
370 TEST(SchedulerStateMachineTest, 369 TEST(SchedulerStateMachineTest,
371 TestFailedDrawsEventuallyForceDrawAfterNextCommit) { 370 TestFailedDrawsEventuallyForceDrawAfterNextCommit) {
372 SchedulerSettings scheduler_settings; 371 SchedulerSettings scheduler_settings;
373 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 1; 372 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 1;
374 StateMachine state(scheduler_settings); 373 StateMachine state(scheduler_settings);
375 SET_UP_STATE(state) 374 SET_UP_STATE(state)
376 375
377 // Start a commit. 376 // Start a commit.
378 state.SetNeedsCommit(); 377 state.SetNeedsCommit();
379 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 378 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
380 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 379 state.OnBeginImplFrame();
381 EXPECT_ACTION_UPDATE_STATE( 380 EXPECT_ACTION_UPDATE_STATE(
382 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 381 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
383 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 382 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
384 EXPECT_TRUE(state.CommitPending()); 383 EXPECT_TRUE(state.CommitPending());
385 384
386 // Then initiate a draw. 385 // Then initiate a draw.
387 state.SetNeedsRedraw(true); 386 state.SetNeedsRedraw(true);
388 state.OnBeginImplFrameDeadline(); 387 state.OnBeginImplFrameDeadline();
389 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 388 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
390 EXPECT_ACTION_UPDATE_STATE( 389 EXPECT_ACTION_UPDATE_STATE(
391 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 390 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
392 391
393 // Fail the draw. 392 // Fail the draw.
394 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); 393 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
395 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 394 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
396 EXPECT_TRUE(state.BeginFrameNeeded()); 395 EXPECT_TRUE(state.BeginFrameNeeded());
397 EXPECT_TRUE(state.RedrawPending()); 396 EXPECT_TRUE(state.RedrawPending());
398 // But the commit is ongoing. 397 // But the commit is ongoing.
399 EXPECT_TRUE(state.CommitPending()); 398 EXPECT_TRUE(state.CommitPending());
400 399
401 // Finish the commit. Note, we should not yet be forcing a draw, but should 400 // Finish the commit. Note, we should not yet be forcing a draw, but should
402 // continue the commit as usual. 401 // continue the commit as usual.
403 state.NotifyBeginMainFrameStarted(); 402 state.NotifyBeginMainFrameStarted();
404 state.NotifyReadyToCommit(); 403 state.NotifyReadyToCommit();
405 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 404 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
406 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 405 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
407 EXPECT_TRUE(state.RedrawPending()); 406 EXPECT_TRUE(state.RedrawPending());
408 407
409 // The redraw should be forced at the end of the next BeginImplFrame. 408 // The redraw should be forced at the end of the next BeginImplFrame.
410 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 409 state.OnBeginImplFrame();
411 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 410 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
412 EXPECT_ACTION_UPDATE_STATE( 411 EXPECT_ACTION_UPDATE_STATE(
413 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 412 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
414 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 413 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
415 state.OnBeginImplFrameDeadline(); 414 state.OnBeginImplFrameDeadline();
416 EXPECT_ACTION_UPDATE_STATE( 415 EXPECT_ACTION_UPDATE_STATE(
417 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED); 416 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED);
418 state.DidSwapBuffers(); 417 state.DidSwapBuffers();
419 state.DidSwapBuffersComplete(); 418 state.DidSwapBuffersComplete();
420 } 419 }
421 420
422 TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) { 421 TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) {
423 SchedulerSettings scheduler_settings; 422 SchedulerSettings scheduler_settings;
424 int draw_limit = 1; 423 int draw_limit = 1;
425 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 424 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ =
426 draw_limit; 425 draw_limit;
427 scheduler_settings.impl_side_painting = true; 426 scheduler_settings.impl_side_painting = true;
428 StateMachine state(scheduler_settings); 427 StateMachine state(scheduler_settings);
429 SET_UP_STATE(state) 428 SET_UP_STATE(state)
430 429
431 // Start a commit. 430 // Start a commit.
432 state.SetNeedsCommit(); 431 state.SetNeedsCommit();
433 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 432 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
434 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 433 state.OnBeginImplFrame();
435 EXPECT_ACTION_UPDATE_STATE( 434 EXPECT_ACTION_UPDATE_STATE(
436 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 435 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
437 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 436 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
438 EXPECT_TRUE(state.CommitPending()); 437 EXPECT_TRUE(state.CommitPending());
439 438
440 // Then initiate a draw. 439 // Then initiate a draw.
441 state.SetNeedsRedraw(true); 440 state.SetNeedsRedraw(true);
442 state.OnBeginImplFrameDeadline(); 441 state.OnBeginImplFrameDeadline();
443 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 442 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
444 EXPECT_ACTION_UPDATE_STATE( 443 EXPECT_ACTION_UPDATE_STATE(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 476 }
478 477
479 TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) { 478 TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) {
480 SchedulerSettings default_scheduler_settings; 479 SchedulerSettings default_scheduler_settings;
481 StateMachine state(default_scheduler_settings); 480 StateMachine state(default_scheduler_settings);
482 SET_UP_STATE(state) 481 SET_UP_STATE(state)
483 482
484 // Start a draw. 483 // Start a draw.
485 state.SetNeedsRedraw(true); 484 state.SetNeedsRedraw(true);
486 EXPECT_TRUE(state.BeginFrameNeeded()); 485 EXPECT_TRUE(state.BeginFrameNeeded());
487 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 486 state.OnBeginImplFrame();
488 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 487 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
489 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 488 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
490 state.OnBeginImplFrameDeadline(); 489 state.OnBeginImplFrameDeadline();
491 EXPECT_TRUE(state.RedrawPending()); 490 EXPECT_TRUE(state.RedrawPending());
492 EXPECT_ACTION_UPDATE_STATE( 491 EXPECT_ACTION_UPDATE_STATE(
493 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 492 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
494 493
495 // Failing the draw for animation checkerboards makes us require a commit. 494 // Failing the draw for animation checkerboards makes us require a commit.
496 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); 495 state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
497 EXPECT_ACTION_UPDATE_STATE( 496 EXPECT_ACTION_UPDATE_STATE(
498 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 497 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
499 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 498 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
500 EXPECT_TRUE(state.RedrawPending()); 499 EXPECT_TRUE(state.RedrawPending());
501 500
502 // We should not be trying to draw again now, but we have a commit pending. 501 // We should not be trying to draw again now, but we have a commit pending.
503 EXPECT_TRUE(state.BeginFrameNeeded()); 502 EXPECT_TRUE(state.BeginFrameNeeded());
504 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 503 state.OnBeginImplFrame();
505 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 504 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
506 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 505 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
507 506
508 // We should try to draw again at the end of the next BeginImplFrame on 507 // We should try to draw again at the end of the next BeginImplFrame on
509 // the impl thread. 508 // the impl thread.
510 state.OnBeginImplFrameDeadline(); 509 state.OnBeginImplFrameDeadline();
511 EXPECT_ACTION_UPDATE_STATE( 510 EXPECT_ACTION_UPDATE_STATE(
512 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 511 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
513 state.DidSwapBuffers(); 512 state.DidSwapBuffers();
514 state.DidSwapBuffersComplete(); 513 state.DidSwapBuffersComplete();
515 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 514 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
516 } 515 }
517 516
518 TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { 517 TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) {
519 SchedulerSettings default_scheduler_settings; 518 SchedulerSettings default_scheduler_settings;
520 StateMachine state(default_scheduler_settings); 519 StateMachine state(default_scheduler_settings);
521 SET_UP_STATE(state) 520 SET_UP_STATE(state)
522 state.SetNeedsRedraw(true); 521 state.SetNeedsRedraw(true);
523 522
524 // Draw the first frame. 523 // Draw the first frame.
525 EXPECT_TRUE(state.BeginFrameNeeded()); 524 EXPECT_TRUE(state.BeginFrameNeeded());
526 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 525 state.OnBeginImplFrame();
527 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 526 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
528 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 527 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
529 528
530 state.OnBeginImplFrameDeadline(); 529 state.OnBeginImplFrameDeadline();
531 EXPECT_ACTION_UPDATE_STATE( 530 EXPECT_ACTION_UPDATE_STATE(
532 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 531 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
533 state.DidSwapBuffers(); 532 state.DidSwapBuffers();
534 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS); 533 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
535 state.DidSwapBuffersComplete(); 534 state.DidSwapBuffersComplete();
536 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 535 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
537 536
538 // Before the next BeginImplFrame, set needs redraw again. 537 // Before the next BeginImplFrame, set needs redraw again.
539 // This should not redraw until the next BeginImplFrame. 538 // This should not redraw until the next BeginImplFrame.
540 state.SetNeedsRedraw(true); 539 state.SetNeedsRedraw(true);
541 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 540 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
542 541
543 // Move to another frame. This should now draw. 542 // Move to another frame. This should now draw.
544 EXPECT_TRUE(state.BeginFrameNeeded()); 543 EXPECT_TRUE(state.BeginFrameNeeded());
545 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 544 state.OnBeginImplFrame();
546 545
547 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 546 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
548 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 547 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
549 548
550 state.OnBeginImplFrameDeadline(); 549 state.OnBeginImplFrameDeadline();
551 EXPECT_ACTION_UPDATE_STATE( 550 EXPECT_ACTION_UPDATE_STATE(
552 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 551 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
553 state.DidSwapBuffers(); 552 state.DidSwapBuffers();
554 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS); 553 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
555 state.DidSwapBuffersComplete(); 554 state.DidSwapBuffersComplete();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // There shouldn't be any drawing regardless of BeginImplFrame. 669 // There shouldn't be any drawing regardless of BeginImplFrame.
671 for (size_t j = 0; j < 2; ++j) { 670 for (size_t j = 0; j < 2; ++j) {
672 StateMachine state(default_scheduler_settings); 671 StateMachine state(default_scheduler_settings);
673 state.SetCanStart(); 672 state.SetCanStart();
674 state.UpdateState(state.NextAction()); 673 state.UpdateState(state.NextAction());
675 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 674 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
676 state.SetCommitState(all_commit_states[i]); 675 state.SetCommitState(all_commit_states[i]);
677 state.SetVisible(false); 676 state.SetVisible(false);
678 state.SetNeedsRedraw(true); 677 state.SetNeedsRedraw(true);
679 if (j == 1) 678 if (j == 1)
680 state.OnBeginImplFrame( 679 state.OnBeginImplFrame();
681 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
682 680
683 state.SetCanDraw(false); 681 state.SetCanDraw(false);
684 EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE, 682 EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE,
685 state.NextAction()); 683 state.NextAction());
686 } 684 }
687 } 685 }
688 } 686 }
689 687
690 TEST(SchedulerStateMachineTest, 688 TEST(SchedulerStateMachineTest,
691 TestCanRedrawWithWaitingForFirstDrawMakesProgress) { 689 TestCanRedrawWithWaitingForFirstDrawMakesProgress) {
692 SchedulerSettings default_scheduler_settings; 690 SchedulerSettings default_scheduler_settings;
693 StateMachine state(default_scheduler_settings); 691 StateMachine state(default_scheduler_settings);
694 state.SetCanStart(); 692 state.SetCanStart();
695 state.UpdateState(state.NextAction()); 693 state.UpdateState(state.NextAction());
696 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 694 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
697 695
698 state.SetActiveTreeNeedsFirstDraw(true); 696 state.SetActiveTreeNeedsFirstDraw(true);
699 state.SetNeedsCommit(); 697 state.SetNeedsCommit();
700 state.SetNeedsRedraw(true); 698 state.SetNeedsRedraw(true);
701 state.SetVisible(true); 699 state.SetVisible(true);
702 state.SetCanDraw(false); 700 state.SetCanDraw(false);
703 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 701 state.OnBeginImplFrame();
704 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 702 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
705 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 703 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
706 EXPECT_ACTION_UPDATE_STATE( 704 EXPECT_ACTION_UPDATE_STATE(
707 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 705 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
708 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 706 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
709 state.NotifyBeginMainFrameStarted(); 707 state.NotifyBeginMainFrameStarted();
710 state.NotifyReadyToCommit(); 708 state.NotifyReadyToCommit();
711 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 709 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
712 state.OnBeginImplFrameDeadline(); 710 state.OnBeginImplFrameDeadline();
713 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 711 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
714 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 712 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
715 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 713 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
716 } 714 }
717 715
718 TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) { 716 TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) {
719 SchedulerSettings scheduler_settings; 717 SchedulerSettings scheduler_settings;
720 StateMachine state(scheduler_settings); 718 StateMachine state(scheduler_settings);
721 SET_UP_STATE(state) 719 SET_UP_STATE(state)
722 state.SetNeedsCommit(); 720 state.SetNeedsCommit();
723 721
724 EXPECT_TRUE(state.BeginFrameNeeded()); 722 EXPECT_TRUE(state.BeginFrameNeeded());
725 723
726 // Begin the frame. 724 // Begin the frame.
727 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 725 state.OnBeginImplFrame();
728 EXPECT_ACTION_UPDATE_STATE( 726 EXPECT_ACTION_UPDATE_STATE(
729 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 727 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
730 EXPECT_COMMIT_STATE( 728 EXPECT_COMMIT_STATE(
731 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 729 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
732 730
733 // Now, while the frame is in progress, set another commit. 731 // Now, while the frame is in progress, set another commit.
734 state.SetNeedsCommit(); 732 state.SetNeedsCommit();
735 EXPECT_TRUE(state.NeedsCommit()); 733 EXPECT_TRUE(state.NeedsCommit());
736 734
737 // Let the frame finish. 735 // Let the frame finish.
(...skipping 13 matching lines...) Expand all
751 749
752 state.OnBeginImplFrameDeadline(); 750 state.OnBeginImplFrameDeadline();
753 EXPECT_IMPL_FRAME_STATE( 751 EXPECT_IMPL_FRAME_STATE(
754 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE); 752 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE);
755 EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT); 753 EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT);
756 754
757 state.OnBeginImplFrameIdle(); 755 state.OnBeginImplFrameIdle();
758 EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 756 EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
759 EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT); 757 EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT);
760 758
761 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 759 state.OnBeginImplFrame();
762 EXPECT_IMPL_FRAME_STATE( 760 EXPECT_IMPL_FRAME_STATE(
763 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING); 761 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING);
764 EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT); 762 EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT);
765 763
766 // Finish the commit, then make sure we start the next commit immediately 764 // Finish the commit, then make sure we start the next commit immediately
767 // and draw on the next BeginImplFrame. 765 // and draw on the next BeginImplFrame.
768 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 766 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
769 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 767 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
770 EXPECT_ACTION_UPDATE_STATE( 768 EXPECT_ACTION_UPDATE_STATE(
771 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 769 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
(...skipping 12 matching lines...) Expand all
784 782
785 TEST(SchedulerStateMachineTest, TestFullCycle) { 783 TEST(SchedulerStateMachineTest, TestFullCycle) {
786 SchedulerSettings default_scheduler_settings; 784 SchedulerSettings default_scheduler_settings;
787 StateMachine state(default_scheduler_settings); 785 StateMachine state(default_scheduler_settings);
788 SET_UP_STATE(state) 786 SET_UP_STATE(state)
789 787
790 // Start clean and set commit. 788 // Start clean and set commit.
791 state.SetNeedsCommit(); 789 state.SetNeedsCommit();
792 790
793 // Begin the frame. 791 // Begin the frame.
794 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 792 state.OnBeginImplFrame();
795 EXPECT_ACTION_UPDATE_STATE( 793 EXPECT_ACTION_UPDATE_STATE(
796 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 794 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
797 EXPECT_COMMIT_STATE( 795 EXPECT_COMMIT_STATE(
798 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 796 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
799 EXPECT_FALSE(state.NeedsCommit()); 797 EXPECT_FALSE(state.NeedsCommit());
800 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 798 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
801 799
802 // Tell the scheduler the frame finished. 800 // Tell the scheduler the frame finished.
803 state.NotifyBeginMainFrameStarted(); 801 state.NotifyBeginMainFrameStarted();
804 state.NotifyReadyToCommit(); 802 state.NotifyReadyToCommit();
(...skipping 25 matching lines...) Expand all
830 TEST(SchedulerStateMachineTest, TestFullCycleWithMainThreadLowLatencyMode) { 828 TEST(SchedulerStateMachineTest, TestFullCycleWithMainThreadLowLatencyMode) {
831 SchedulerSettings scheduler_settings; 829 SchedulerSettings scheduler_settings;
832 scheduler_settings.main_thread_should_always_be_low_latency = true; 830 scheduler_settings.main_thread_should_always_be_low_latency = true;
833 StateMachine state(scheduler_settings); 831 StateMachine state(scheduler_settings);
834 SET_UP_STATE(state) 832 SET_UP_STATE(state)
835 833
836 // Start clean and set commit. 834 // Start clean and set commit.
837 state.SetNeedsCommit(); 835 state.SetNeedsCommit();
838 836
839 // Begin the frame. 837 // Begin the frame.
840 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 838 state.OnBeginImplFrame();
841 EXPECT_ACTION_UPDATE_STATE( 839 EXPECT_ACTION_UPDATE_STATE(
842 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 840 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
843 EXPECT_COMMIT_STATE( 841 EXPECT_COMMIT_STATE(
844 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 842 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
845 EXPECT_FALSE(state.NeedsCommit()); 843 EXPECT_FALSE(state.NeedsCommit());
846 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 844 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
847 845
848 // Tell the scheduler the frame finished. 846 // Tell the scheduler the frame finished.
849 state.NotifyBeginMainFrameStarted(); 847 state.NotifyBeginMainFrameStarted();
850 state.NotifyReadyToCommit(); 848 state.NotifyReadyToCommit();
851 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT); 849 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT);
852 850
853 // Commit. 851 // Commit.
854 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 852 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
855 EXPECT_TRUE(state.active_tree_needs_first_draw()); 853 EXPECT_TRUE(state.active_tree_needs_first_draw());
856 EXPECT_TRUE(state.needs_redraw()); 854 EXPECT_TRUE(state.needs_redraw());
857 855
858 // Now commit should wait for draw. 856 // Now commit should wait for draw.
859 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_DRAW); 857 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_DRAW);
860 858
861 // Swap throttled. Do not draw. 859 // Swap throttled. Do not draw.
862 state.DidSwapBuffers(); 860 state.DidSwapBuffers();
863 state.OnBeginImplFrameDeadline(); 861 state.OnBeginImplFrameDeadline();
864 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 862 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
865 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 863 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
866 state.DidSwapBuffersComplete(); 864 state.DidSwapBuffersComplete();
867 865
868 // Haven't draw since last commit, do not begin new main frame. 866 // Haven't draw since last commit, do not begin new main frame.
869 state.SetNeedsCommit(); 867 state.SetNeedsCommit();
870 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 868 state.OnBeginImplFrame();
871 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 869 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
872 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 870 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
873 871
874 // At BeginImplFrame deadline, draw. 872 // At BeginImplFrame deadline, draw.
875 state.OnBeginImplFrameDeadline(); 873 state.OnBeginImplFrameDeadline();
876 EXPECT_ACTION_UPDATE_STATE( 874 EXPECT_ACTION_UPDATE_STATE(
877 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 875 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
878 state.DidSwapBuffers(); 876 state.DidSwapBuffers();
879 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS); 877 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
880 state.DidSwapBuffersComplete(); 878 state.DidSwapBuffersComplete();
(...skipping 10 matching lines...) Expand all
891 SchedulerSettings scheduler_settings; 889 SchedulerSettings scheduler_settings;
892 scheduler_settings.main_thread_should_always_be_low_latency = true; 890 scheduler_settings.main_thread_should_always_be_low_latency = true;
893 scheduler_settings.impl_side_painting = true; 891 scheduler_settings.impl_side_painting = true;
894 StateMachine state(scheduler_settings); 892 StateMachine state(scheduler_settings);
895 SET_UP_STATE(state) 893 SET_UP_STATE(state)
896 894
897 // Start clean and set commit. 895 // Start clean and set commit.
898 state.SetNeedsCommit(); 896 state.SetNeedsCommit();
899 897
900 // Begin the frame. 898 // Begin the frame.
901 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 899 state.OnBeginImplFrame();
902 EXPECT_ACTION_UPDATE_STATE( 900 EXPECT_ACTION_UPDATE_STATE(
903 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 901 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
904 EXPECT_COMMIT_STATE( 902 EXPECT_COMMIT_STATE(
905 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 903 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
906 EXPECT_FALSE(state.NeedsCommit()); 904 EXPECT_FALSE(state.NeedsCommit());
907 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 905 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
908 906
909 // Tell the scheduler the frame finished. 907 // Tell the scheduler the frame finished.
910 state.NotifyBeginMainFrameStarted(); 908 state.NotifyBeginMainFrameStarted();
911 state.NotifyReadyToCommit(); 909 state.NotifyReadyToCommit();
(...skipping 10 matching lines...) Expand all
922 // frame, and still block BeginMainFrame. 920 // frame, and still block BeginMainFrame.
923 state.SetNeedsRedraw(true); 921 state.SetNeedsRedraw(true);
924 state.SetNeedsCommit(); 922 state.SetNeedsCommit();
925 state.OnBeginImplFrameDeadline(); 923 state.OnBeginImplFrameDeadline();
926 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 924 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
927 EXPECT_ACTION_UPDATE_STATE( 925 EXPECT_ACTION_UPDATE_STATE(
928 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 926 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
929 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 927 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
930 928
931 // Cannot BeginMainFrame yet since last commit is not yet activated and drawn. 929 // Cannot BeginMainFrame yet since last commit is not yet activated and drawn.
932 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 930 state.OnBeginImplFrame();
933 EXPECT_COMMIT_STATE( 931 EXPECT_COMMIT_STATE(
934 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_ACTIVATION); 932 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_ACTIVATION);
935 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 933 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
936 934
937 // Now activate sync tree. 935 // Now activate sync tree.
938 state.NotifyReadyToActivate(); 936 state.NotifyReadyToActivate();
939 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); 937 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
940 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 938 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
941 EXPECT_TRUE(state.active_tree_needs_first_draw()); 939 EXPECT_TRUE(state.active_tree_needs_first_draw());
942 EXPECT_TRUE(state.needs_redraw()); 940 EXPECT_TRUE(state.needs_redraw());
943 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_DRAW); 941 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_DRAW);
944 942
945 // Swap throttled. Do not draw. 943 // Swap throttled. Do not draw.
946 state.DidSwapBuffers(); 944 state.DidSwapBuffers();
947 state.OnBeginImplFrameDeadline(); 945 state.OnBeginImplFrameDeadline();
948 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 946 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
949 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 947 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
950 state.DidSwapBuffersComplete(); 948 state.DidSwapBuffersComplete();
951 949
952 // Haven't draw since last commit, do not begin new main frame. 950 // Haven't draw since last commit, do not begin new main frame.
953 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 951 state.OnBeginImplFrame();
954 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 952 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
955 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 953 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
956 954
957 // At BeginImplFrame deadline, draw. This draws unblocks BeginMainFrame. 955 // At BeginImplFrame deadline, draw. This draws unblocks BeginMainFrame.
958 state.OnBeginImplFrameDeadline(); 956 state.OnBeginImplFrameDeadline();
959 EXPECT_ACTION_UPDATE_STATE( 957 EXPECT_ACTION_UPDATE_STATE(
960 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 958 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
961 state.DidSwapBuffers(); 959 state.DidSwapBuffers();
962 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS); 960 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
963 state.DidSwapBuffersComplete(); 961 state.DidSwapBuffersComplete();
964 962
965 // Now will be able to start main frame. 963 // Now will be able to start main frame.
966 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 964 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
967 EXPECT_FALSE(state.needs_redraw()); 965 EXPECT_FALSE(state.needs_redraw());
968 EXPECT_ACTION_UPDATE_STATE( 966 EXPECT_ACTION_UPDATE_STATE(
969 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 967 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
970 } 968 }
971 969
972 TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) { 970 TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) {
973 SchedulerSettings default_scheduler_settings; 971 SchedulerSettings default_scheduler_settings;
974 StateMachine state(default_scheduler_settings); 972 StateMachine state(default_scheduler_settings);
975 SET_UP_STATE(state) 973 SET_UP_STATE(state)
976 974
977 // Start clean and set commit. 975 // Start clean and set commit.
978 state.SetNeedsCommit(); 976 state.SetNeedsCommit();
979 977
980 // Begin the frame. 978 // Begin the frame.
981 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 979 state.OnBeginImplFrame();
982 EXPECT_ACTION_UPDATE_STATE( 980 EXPECT_ACTION_UPDATE_STATE(
983 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 981 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
984 EXPECT_COMMIT_STATE( 982 EXPECT_COMMIT_STATE(
985 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 983 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
986 EXPECT_FALSE(state.NeedsCommit()); 984 EXPECT_FALSE(state.NeedsCommit());
987 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 985 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
988 986
989 // Request another commit while the commit is in flight. 987 // Request another commit while the commit is in flight.
990 state.SetNeedsCommit(); 988 state.SetNeedsCommit();
991 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 989 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
(...skipping 19 matching lines...) Expand all
1011 state.DidSwapBuffers(); 1009 state.DidSwapBuffers();
1012 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS); 1010 state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
1013 state.DidSwapBuffersComplete(); 1011 state.DidSwapBuffersComplete();
1014 1012
1015 // Should be synchronized, no draw needed, no action needed. 1013 // Should be synchronized, no draw needed, no action needed.
1016 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1014 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1017 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1015 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1018 EXPECT_FALSE(state.needs_redraw()); 1016 EXPECT_FALSE(state.needs_redraw());
1019 1017
1020 // Next BeginImplFrame should initiate second commit. 1018 // Next BeginImplFrame should initiate second commit.
1021 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1019 state.OnBeginImplFrame();
1022 EXPECT_ACTION_UPDATE_STATE( 1020 EXPECT_ACTION_UPDATE_STATE(
1023 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1021 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1024 } 1022 }
1025 1023
1026 TEST(SchedulerStateMachineTest, TestRequestCommitInvisible) { 1024 TEST(SchedulerStateMachineTest, TestRequestCommitInvisible) {
1027 SchedulerSettings default_scheduler_settings; 1025 SchedulerSettings default_scheduler_settings;
1028 StateMachine state(default_scheduler_settings); 1026 StateMachine state(default_scheduler_settings);
1029 state.SetCanStart(); 1027 state.SetCanStart();
1030 state.UpdateState(state.NextAction()); 1028 state.UpdateState(state.NextAction());
1031 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1029 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1032 state.SetNeedsCommit(); 1030 state.SetNeedsCommit();
1033 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1031 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1034 } 1032 }
1035 1033
1036 // See ThreadProxy::BeginMainFrame "EarlyOut_NotVisible" / 1034 // See ThreadProxy::BeginMainFrame "EarlyOut_NotVisible" /
1037 // "EarlyOut_OutputSurfaceLost" cases. 1035 // "EarlyOut_OutputSurfaceLost" cases.
1038 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { 1036 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) {
1039 SchedulerSettings default_scheduler_settings; 1037 SchedulerSettings default_scheduler_settings;
1040 StateMachine state(default_scheduler_settings); 1038 StateMachine state(default_scheduler_settings);
1041 SET_UP_STATE(state) 1039 SET_UP_STATE(state)
1042 1040
1043 // Start clean and set commit. 1041 // Start clean and set commit.
1044 state.SetNeedsCommit(); 1042 state.SetNeedsCommit();
1045 1043
1046 // Begin the frame while visible. 1044 // Begin the frame while visible.
1047 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1045 state.OnBeginImplFrame();
1048 EXPECT_ACTION_UPDATE_STATE( 1046 EXPECT_ACTION_UPDATE_STATE(
1049 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1047 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1050 EXPECT_COMMIT_STATE( 1048 EXPECT_COMMIT_STATE(
1051 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1049 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1052 EXPECT_FALSE(state.NeedsCommit()); 1050 EXPECT_FALSE(state.NeedsCommit());
1053 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1051 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1054 1052
1055 // Become invisible and abort BeginMainFrame. 1053 // Become invisible and abort BeginMainFrame.
1056 state.SetVisible(false); 1054 state.SetVisible(false);
1057 state.BeginMainFrameAborted(CommitEarlyOutReason::ABORTED_NOT_VISIBLE); 1055 state.BeginMainFrameAborted(CommitEarlyOutReason::ABORTED_NOT_VISIBLE);
(...skipping 13 matching lines...) Expand all
1071 // Become visible again. 1069 // Become visible again.
1072 state.SetVisible(true); 1070 state.SetVisible(true);
1073 1071
1074 // Although we have aborted on this frame and haven't cancelled the commit 1072 // Although we have aborted on this frame and haven't cancelled the commit
1075 // (i.e. need another), don't send another BeginMainFrame yet. 1073 // (i.e. need another), don't send another BeginMainFrame yet.
1076 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1074 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1077 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1075 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1078 EXPECT_TRUE(state.NeedsCommit()); 1076 EXPECT_TRUE(state.NeedsCommit());
1079 1077
1080 // Start a new frame. 1078 // Start a new frame.
1081 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1079 state.OnBeginImplFrame();
1082 EXPECT_ACTION_UPDATE_STATE( 1080 EXPECT_ACTION_UPDATE_STATE(
1083 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1081 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1084 1082
1085 // We should be starting the commit now. 1083 // We should be starting the commit now.
1086 EXPECT_COMMIT_STATE( 1084 EXPECT_COMMIT_STATE(
1087 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1085 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1088 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1086 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1089 } 1087 }
1090 1088
1091 // See ThreadProxy::BeginMainFrame "EarlyOut_NoUpdates" case. 1089 // See ThreadProxy::BeginMainFrame "EarlyOut_NoUpdates" case.
1092 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { 1090 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) {
1093 SchedulerSettings default_scheduler_settings; 1091 SchedulerSettings default_scheduler_settings;
1094 StateMachine state(default_scheduler_settings); 1092 StateMachine state(default_scheduler_settings);
1095 state.SetCanStart(); 1093 state.SetCanStart();
1096 state.UpdateState(state.NextAction()); 1094 state.UpdateState(state.NextAction());
1097 state.DidCreateAndInitializeOutputSurface(); 1095 state.DidCreateAndInitializeOutputSurface();
1098 state.SetVisible(true); 1096 state.SetVisible(true);
1099 state.SetCanDraw(true); 1097 state.SetCanDraw(true);
1100 1098
1101 // Get into a begin frame / commit state. 1099 // Get into a begin frame / commit state.
1102 state.SetNeedsCommit(); 1100 state.SetNeedsCommit();
1103 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1101 state.OnBeginImplFrame();
1104 EXPECT_ACTION_UPDATE_STATE( 1102 EXPECT_ACTION_UPDATE_STATE(
1105 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1103 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1106 EXPECT_COMMIT_STATE( 1104 EXPECT_COMMIT_STATE(
1107 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1105 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1108 EXPECT_FALSE(state.NeedsCommit()); 1106 EXPECT_FALSE(state.NeedsCommit());
1109 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1107 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1110 1108
1111 // Abort the commit, true means that the BeginMainFrame was sent but there 1109 // Abort the commit, true means that the BeginMainFrame was sent but there
1112 // was no work to do on the main thread. 1110 // was no work to do on the main thread.
1113 state.BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES); 1111 state.BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES);
1114 1112
1115 // NeedsCommit should now be false because the commit was actually handled. 1113 // NeedsCommit should now be false because the commit was actually handled.
1116 EXPECT_FALSE(state.NeedsCommit()); 1114 EXPECT_FALSE(state.NeedsCommit());
1117 1115
1118 // Even though the commit was aborted, we still expect to draw the new frame. 1116 // Even though the commit was aborted, we still expect to draw the new frame.
1119 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1117 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1120 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1118 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1121 state.OnBeginImplFrameDeadline(); 1119 state.OnBeginImplFrameDeadline();
1122 EXPECT_ACTION_UPDATE_STATE( 1120 EXPECT_ACTION_UPDATE_STATE(
1123 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1121 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1124 state.DidSwapBuffers(); 1122 state.DidSwapBuffers();
1125 state.DidSwapBuffersComplete(); 1123 state.DidSwapBuffersComplete();
1126 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1124 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1127 1125
1128 // Verify another commit doesn't start on another frame either. 1126 // Verify another commit doesn't start on another frame either.
1129 EXPECT_FALSE(state.NeedsCommit()); 1127 EXPECT_FALSE(state.NeedsCommit());
1130 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1128 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1131 1129
1132 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1130 state.OnBeginImplFrame();
1133 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1131 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1134 state.OnBeginImplFrameDeadline(); 1132 state.OnBeginImplFrameDeadline();
1135 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1133 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1136 1134
1137 // Verify another commit can start if requested, though. 1135 // Verify another commit can start if requested, though.
1138 state.SetNeedsCommit(); 1136 state.SetNeedsCommit();
1139 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); 1137 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
1140 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1138 state.OnBeginImplFrame();
1141 EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1139 EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1142 } 1140 }
1143 1141
1144 TEST(SchedulerStateMachineTest, TestFirstContextCreation) { 1142 TEST(SchedulerStateMachineTest, TestFirstContextCreation) {
1145 SchedulerSettings default_scheduler_settings; 1143 SchedulerSettings default_scheduler_settings;
1146 StateMachine state(default_scheduler_settings); 1144 StateMachine state(default_scheduler_settings);
1147 state.SetCanStart(); 1145 state.SetCanStart();
1148 state.SetVisible(true); 1146 state.SetVisible(true);
1149 state.SetCanDraw(true); 1147 state.SetCanDraw(true);
1150 1148
1151 EXPECT_ACTION_UPDATE_STATE( 1149 EXPECT_ACTION_UPDATE_STATE(
1152 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1150 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1153 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1151 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1154 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1152 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1155 1153
1156 // Check that the first init does not SetNeedsCommit. 1154 // Check that the first init does not SetNeedsCommit.
1157 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1155 state.OnBeginImplFrame();
1158 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1156 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1159 state.OnBeginImplFrameDeadline(); 1157 state.OnBeginImplFrameDeadline();
1160 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1158 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1161 1159
1162 // Check that a needs commit initiates a BeginMainFrame. 1160 // Check that a needs commit initiates a BeginMainFrame.
1163 state.SetNeedsCommit(); 1161 state.SetNeedsCommit();
1164 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1162 state.OnBeginImplFrame();
1165 EXPECT_ACTION_UPDATE_STATE( 1163 EXPECT_ACTION_UPDATE_STATE(
1166 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1164 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1167 } 1165 }
1168 1166
1169 TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) { 1167 TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) {
1170 SchedulerSettings default_scheduler_settings; 1168 SchedulerSettings default_scheduler_settings;
1171 StateMachine state(default_scheduler_settings); 1169 StateMachine state(default_scheduler_settings);
1172 SET_UP_STATE(state) 1170 SET_UP_STATE(state)
1173 1171
1174 EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION, 1172 EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
1175 state.NextAction()); 1173 state.NextAction());
1176 state.DidLoseOutputSurface(); 1174 state.DidLoseOutputSurface();
1177 1175
1178 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1176 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1179 state.UpdateState(state.NextAction()); 1177 state.UpdateState(state.NextAction());
1180 1178
1181 // Once context recreation begins, nothing should happen. 1179 // Once context recreation begins, nothing should happen.
1182 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1180 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1183 1181
1184 // Recreate the context. 1182 // Recreate the context.
1185 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1183 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1186 1184
1187 // When the context is recreated, we should begin a commit. 1185 // When the context is recreated, we should begin a commit.
1188 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1186 state.OnBeginImplFrame();
1189 EXPECT_ACTION_UPDATE_STATE( 1187 EXPECT_ACTION_UPDATE_STATE(
1190 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1188 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1191 } 1189 }
1192 1190
1193 TEST(SchedulerStateMachineTest, 1191 TEST(SchedulerStateMachineTest,
1194 TestContextLostWhenIdleAndCommitRequestedWhileRecreating) { 1192 TestContextLostWhenIdleAndCommitRequestedWhileRecreating) {
1195 SchedulerSettings default_scheduler_settings; 1193 SchedulerSettings default_scheduler_settings;
1196 // We use impl side painting because it's the more complicated version. 1194 // We use impl side painting because it's the more complicated version.
1197 default_scheduler_settings.impl_side_painting = true; 1195 default_scheduler_settings.impl_side_painting = true;
1198 StateMachine state(default_scheduler_settings); 1196 StateMachine state(default_scheduler_settings);
1199 SET_UP_STATE(state) 1197 SET_UP_STATE(state)
1200 1198
1201 EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION, 1199 EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
1202 state.NextAction()); 1200 state.NextAction());
1203 state.DidLoseOutputSurface(); 1201 state.DidLoseOutputSurface();
1204 EXPECT_EQ(state.output_surface_state(), 1202 EXPECT_EQ(state.output_surface_state(),
1205 SchedulerStateMachine::OUTPUT_SURFACE_LOST); 1203 SchedulerStateMachine::OUTPUT_SURFACE_LOST);
1206 1204
1207 EXPECT_ACTION_UPDATE_STATE( 1205 EXPECT_ACTION_UPDATE_STATE(
1208 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1206 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1209 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1207 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1210 1208
1211 // Once context recreation begins, nothing should happen. 1209 // Once context recreation begins, nothing should happen.
1212 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1210 state.OnBeginImplFrame();
1213 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1211 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1214 state.OnBeginImplFrameDeadline(); 1212 state.OnBeginImplFrameDeadline();
1215 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1213 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1216 1214
1217 // While context is recreating, commits shouldn't begin. 1215 // While context is recreating, commits shouldn't begin.
1218 state.SetNeedsCommit(); 1216 state.SetNeedsCommit();
1219 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1217 state.OnBeginImplFrame();
1220 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1218 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1221 state.OnBeginImplFrameDeadline(); 1219 state.OnBeginImplFrameDeadline();
1222 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1220 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1223 1221
1224 // Recreate the context 1222 // Recreate the context
1225 state.DidCreateAndInitializeOutputSurface(); 1223 state.DidCreateAndInitializeOutputSurface();
1226 EXPECT_EQ(state.output_surface_state(), 1224 EXPECT_EQ(state.output_surface_state(),
1227 SchedulerStateMachine::OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT); 1225 SchedulerStateMachine::OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT);
1228 EXPECT_FALSE(state.RedrawPending()); 1226 EXPECT_FALSE(state.RedrawPending());
1229 1227
1230 // When the context is recreated, we wait until the next BeginImplFrame 1228 // When the context is recreated, we wait until the next BeginImplFrame
1231 // before starting. 1229 // before starting.
1232 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1230 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1233 1231
1234 // When the BeginFrame comes in we should begin a commit 1232 // When the BeginFrame comes in we should begin a commit
1235 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1233 state.OnBeginImplFrame();
1236 EXPECT_ACTION_UPDATE_STATE( 1234 EXPECT_ACTION_UPDATE_STATE(
1237 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1235 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1238 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1236 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1239 EXPECT_COMMIT_STATE( 1237 EXPECT_COMMIT_STATE(
1240 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); 1238 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
1241 1239
1242 // Until that commit finishes, we shouldn't be drawing or animate. 1240 // Until that commit finishes, we shouldn't be drawing or animate.
1243 state.OnBeginImplFrameDeadline(); 1241 state.OnBeginImplFrameDeadline();
1244 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1242 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1245 1243
1246 // Finish the commit, which should make the surface active. 1244 // Finish the commit, which should make the surface active.
1247 state.NotifyBeginMainFrameStarted(); 1245 state.NotifyBeginMainFrameStarted();
1248 state.NotifyReadyToCommit(); 1246 state.NotifyReadyToCommit();
1249 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1247 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1250 EXPECT_EQ(state.output_surface_state(), 1248 EXPECT_EQ(state.output_surface_state(),
1251 SchedulerStateMachine::OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION); 1249 SchedulerStateMachine::OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION);
1252 state.NotifyReadyToActivate(); 1250 state.NotifyReadyToActivate();
1253 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); 1251 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
1254 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1252 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1255 EXPECT_EQ(state.output_surface_state(), 1253 EXPECT_EQ(state.output_surface_state(),
1256 SchedulerStateMachine::OUTPUT_SURFACE_ACTIVE); 1254 SchedulerStateMachine::OUTPUT_SURFACE_ACTIVE);
1257 1255
1258 // Finishing the first commit after initializing an output surface should 1256 // Finishing the first commit after initializing an output surface should
1259 // automatically cause a redraw. 1257 // automatically cause a redraw.
1260 EXPECT_TRUE(state.RedrawPending()); 1258 EXPECT_TRUE(state.RedrawPending());
1261 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1259 state.OnBeginImplFrame();
1262 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1260 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1263 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1261 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1264 state.OnBeginImplFrameDeadline(); 1262 state.OnBeginImplFrameDeadline();
1265 EXPECT_ACTION_UPDATE_STATE( 1263 EXPECT_ACTION_UPDATE_STATE(
1266 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1264 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1267 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1265 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1268 EXPECT_FALSE(state.RedrawPending()); 1266 EXPECT_FALSE(state.RedrawPending());
1269 1267
1270 // Next frame as no work to do. 1268 // Next frame as no work to do.
1271 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1269 state.OnBeginImplFrame();
1272 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1270 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1273 state.OnBeginImplFrameDeadline(); 1271 state.OnBeginImplFrameDeadline();
1274 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1272 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1275 1273
1276 // Once the context is recreated, whether we draw should be based on 1274 // Once the context is recreated, whether we draw should be based on
1277 // SetCanDraw if waiting on first draw after activate. 1275 // SetCanDraw if waiting on first draw after activate.
1278 state.SetNeedsRedraw(true); 1276 state.SetNeedsRedraw(true);
1279 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1277 state.OnBeginImplFrame();
1280 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1278 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1281 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1279 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1282 state.OnBeginImplFrameDeadline(); 1280 state.OnBeginImplFrameDeadline();
1283 EXPECT_ACTION(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1281 EXPECT_ACTION(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1284 state.SetCanDraw(false); 1282 state.SetCanDraw(false);
1285 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1283 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1286 state.SetCanDraw(true); 1284 state.SetCanDraw(true);
1287 EXPECT_ACTION_UPDATE_STATE( 1285 EXPECT_ACTION_UPDATE_STATE(
1288 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1286 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1289 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1287 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1290 1288
1291 // Once the context is recreated, whether we draw should be based on 1289 // Once the context is recreated, whether we draw should be based on
1292 // SetCanDraw if waiting on first draw after activate. 1290 // SetCanDraw if waiting on first draw after activate.
1293 state.SetNeedsRedraw(true); 1291 state.SetNeedsRedraw(true);
1294 state.SetNeedsCommit(); 1292 state.SetNeedsCommit();
1295 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1293 state.OnBeginImplFrame();
1296 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1294 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1297 EXPECT_ACTION_UPDATE_STATE( 1295 EXPECT_ACTION_UPDATE_STATE(
1298 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1296 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1299 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1297 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1300 // Activate so we need the first draw 1298 // Activate so we need the first draw
1301 state.NotifyBeginMainFrameStarted(); 1299 state.NotifyBeginMainFrameStarted();
1302 state.NotifyReadyToCommit(); 1300 state.NotifyReadyToCommit();
1303 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1301 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1304 state.NotifyReadyToActivate(); 1302 state.NotifyReadyToActivate();
1305 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); 1303 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
(...skipping 13 matching lines...) Expand all
1319 TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) { 1317 TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) {
1320 SchedulerSettings scheduler_settings; 1318 SchedulerSettings scheduler_settings;
1321 StateMachine state(scheduler_settings); 1319 StateMachine state(scheduler_settings);
1322 SET_UP_STATE(state) 1320 SET_UP_STATE(state)
1323 1321
1324 // Get a commit in flight. 1322 // Get a commit in flight.
1325 state.SetNeedsCommit(); 1323 state.SetNeedsCommit();
1326 1324
1327 // Set damage and expect a draw. 1325 // Set damage and expect a draw.
1328 state.SetNeedsRedraw(true); 1326 state.SetNeedsRedraw(true);
1329 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1327 state.OnBeginImplFrame();
1330 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1328 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1331 EXPECT_ACTION_UPDATE_STATE( 1329 EXPECT_ACTION_UPDATE_STATE(
1332 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1330 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1333 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1331 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1334 state.OnBeginImplFrameDeadline(); 1332 state.OnBeginImplFrameDeadline();
1335 EXPECT_ACTION_UPDATE_STATE( 1333 EXPECT_ACTION_UPDATE_STATE(
1336 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1334 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1337 state.DidSwapBuffers(); 1335 state.DidSwapBuffers();
1338 state.DidSwapBuffersComplete(); 1336 state.DidSwapBuffersComplete();
1339 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1337 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
(...skipping 12 matching lines...) Expand all
1352 1350
1353 // We will abort the draw when the output surface is lost if we are 1351 // We will abort the draw when the output surface is lost if we are
1354 // waiting for the first draw to unblock the main thread. 1352 // waiting for the first draw to unblock the main thread.
1355 EXPECT_TRUE(state.active_tree_needs_first_draw()); 1353 EXPECT_TRUE(state.active_tree_needs_first_draw());
1356 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 1354 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
1357 1355
1358 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE 1356 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE
1359 EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 1357 EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
1360 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1358 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1361 1359
1362 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1360 state.OnBeginImplFrame();
1363 EXPECT_IMPL_FRAME_STATE( 1361 EXPECT_IMPL_FRAME_STATE(
1364 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING); 1362 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING);
1365 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1363 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1366 1364
1367 state.OnBeginImplFrameDeadlinePending(); 1365 state.OnBeginImplFrameDeadlinePending();
1368 EXPECT_IMPL_FRAME_STATE( 1366 EXPECT_IMPL_FRAME_STATE(
1369 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME); 1367 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME);
1370 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1368 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1371 1369
1372 state.OnBeginImplFrameDeadline(); 1370 state.OnBeginImplFrameDeadline();
1373 EXPECT_IMPL_FRAME_STATE( 1371 EXPECT_IMPL_FRAME_STATE(
1374 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE); 1372 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE);
1375 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1373 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1376 } 1374 }
1377 1375
1378 TEST(SchedulerStateMachineTest, 1376 TEST(SchedulerStateMachineTest,
1379 TestContextLostWhileCommitInProgressAndAnotherCommitRequested) { 1377 TestContextLostWhileCommitInProgressAndAnotherCommitRequested) {
1380 SchedulerSettings scheduler_settings; 1378 SchedulerSettings scheduler_settings;
1381 StateMachine state(scheduler_settings); 1379 StateMachine state(scheduler_settings);
1382 SET_UP_STATE(state) 1380 SET_UP_STATE(state)
1383 1381
1384 // Get a commit in flight. 1382 // Get a commit in flight.
1385 state.SetNeedsCommit(); 1383 state.SetNeedsCommit();
1386 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1384 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1387 1385
1388 // Set damage and expect a draw. 1386 // Set damage and expect a draw.
1389 state.SetNeedsRedraw(true); 1387 state.SetNeedsRedraw(true);
1390 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1388 state.OnBeginImplFrame();
1391 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1389 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1392 EXPECT_ACTION_UPDATE_STATE( 1390 EXPECT_ACTION_UPDATE_STATE(
1393 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1391 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1394 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1392 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1395 state.OnBeginImplFrameDeadline(); 1393 state.OnBeginImplFrameDeadline();
1396 EXPECT_ACTION_UPDATE_STATE( 1394 EXPECT_ACTION_UPDATE_STATE(
1397 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1395 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1398 state.DidSwapBuffers(); 1396 state.DidSwapBuffers();
1399 state.DidSwapBuffersComplete(); 1397 state.DidSwapBuffersComplete();
1400 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1398 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
(...skipping 12 matching lines...) Expand all
1413 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1411 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1414 EXPECT_TRUE(state.active_tree_needs_first_draw()); 1412 EXPECT_TRUE(state.active_tree_needs_first_draw());
1415 1413
1416 // Because the output surface is missing, we expect the draw to abort. 1414 // Because the output surface is missing, we expect the draw to abort.
1417 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); 1415 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
1418 1416
1419 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE 1417 // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE
1420 EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 1418 EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
1421 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1419 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1422 1420
1423 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1421 state.OnBeginImplFrame();
1424 EXPECT_IMPL_FRAME_STATE( 1422 EXPECT_IMPL_FRAME_STATE(
1425 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING); 1423 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING);
1426 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1424 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1427 1425
1428 state.OnBeginImplFrameDeadlinePending(); 1426 state.OnBeginImplFrameDeadlinePending();
1429 EXPECT_IMPL_FRAME_STATE( 1427 EXPECT_IMPL_FRAME_STATE(
1430 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME); 1428 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME);
1431 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1429 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1432 1430
1433 state.OnBeginImplFrameDeadline(); 1431 state.OnBeginImplFrameDeadline();
1434 EXPECT_IMPL_FRAME_STATE( 1432 EXPECT_IMPL_FRAME_STATE(
1435 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE); 1433 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE);
1436 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); 1434 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
1437 1435
1438 state.OnBeginImplFrameIdle(); 1436 state.OnBeginImplFrameIdle();
1439 EXPECT_ACTION_UPDATE_STATE( 1437 EXPECT_ACTION_UPDATE_STATE(
1440 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1438 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1441 1439
1442 // After we get a new output surface, the commit flow should start. 1440 // After we get a new output surface, the commit flow should start.
1443 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1441 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1444 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1442 state.OnBeginImplFrame();
1445 EXPECT_ACTION_UPDATE_STATE( 1443 EXPECT_ACTION_UPDATE_STATE(
1446 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1444 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1447 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1445 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1448 state.NotifyBeginMainFrameStarted(); 1446 state.NotifyBeginMainFrameStarted();
1449 state.NotifyReadyToCommit(); 1447 state.NotifyReadyToCommit();
1450 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1448 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1451 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1449 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1452 state.OnBeginImplFrameDeadline(); 1450 state.OnBeginImplFrameDeadline();
1453 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1451 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1454 EXPECT_ACTION_UPDATE_STATE( 1452 EXPECT_ACTION_UPDATE_STATE(
(...skipping 10 matching lines...) Expand all
1465 1463
1466 state.SetNeedsRedraw(true); 1464 state.SetNeedsRedraw(true);
1467 1465
1468 // Cause a lost output surface, and restore it. 1466 // Cause a lost output surface, and restore it.
1469 state.DidLoseOutputSurface(); 1467 state.DidLoseOutputSurface();
1470 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1468 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1471 state.UpdateState(state.NextAction()); 1469 state.UpdateState(state.NextAction());
1472 state.DidCreateAndInitializeOutputSurface(); 1470 state.DidCreateAndInitializeOutputSurface();
1473 1471
1474 EXPECT_FALSE(state.RedrawPending()); 1472 EXPECT_FALSE(state.RedrawPending());
1475 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1473 state.OnBeginImplFrame();
1476 EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1474 EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1477 } 1475 }
1478 1476
1479 TEST(SchedulerStateMachineTest, 1477 TEST(SchedulerStateMachineTest,
1480 TestPendingActivationsShouldBeForcedAfterLostOutputSurface) { 1478 TestPendingActivationsShouldBeForcedAfterLostOutputSurface) {
1481 SchedulerSettings settings; 1479 SchedulerSettings settings;
1482 settings.impl_side_painting = true; 1480 settings.impl_side_painting = true;
1483 StateMachine state(settings); 1481 StateMachine state(settings);
1484 SET_UP_STATE(state) 1482 SET_UP_STATE(state)
1485 1483
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 1577
1580 TEST(SchedulerStateMachineTest, 1578 TEST(SchedulerStateMachineTest,
1581 TestTriggerDeadlineImmediatelyAfterAbortedCommit) { 1579 TestTriggerDeadlineImmediatelyAfterAbortedCommit) {
1582 SchedulerSettings settings; 1580 SchedulerSettings settings;
1583 settings.impl_side_painting = true; 1581 settings.impl_side_painting = true;
1584 StateMachine state(settings); 1582 StateMachine state(settings);
1585 SET_UP_STATE(state) 1583 SET_UP_STATE(state)
1586 1584
1587 // This test mirrors what happens during the first frame of a scroll gesture. 1585 // This test mirrors what happens during the first frame of a scroll gesture.
1588 // First we get the input event and a BeginFrame. 1586 // First we get the input event and a BeginFrame.
1589 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1587 state.OnBeginImplFrame();
1590 1588
1591 // As a response the compositor requests a redraw and a commit to tell the 1589 // As a response the compositor requests a redraw and a commit to tell the
1592 // main thread about the new scroll offset. 1590 // main thread about the new scroll offset.
1593 state.SetNeedsRedraw(true); 1591 state.SetNeedsRedraw(true);
1594 state.SetNeedsCommit(); 1592 state.SetNeedsCommit();
1595 1593
1596 // We should start the commit normally. 1594 // We should start the commit normally.
1597 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1595 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1598 EXPECT_ACTION_UPDATE_STATE( 1596 EXPECT_ACTION_UPDATE_STATE(
1599 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1597 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
(...skipping 14 matching lines...) Expand all
1614 StateMachine& state = *state_ptr; 1612 StateMachine& state = *state_ptr;
1615 1613
1616 state.NotifyBeginMainFrameStarted(); 1614 state.NotifyBeginMainFrameStarted();
1617 state.NotifyReadyToCommit(); 1615 state.NotifyReadyToCommit();
1618 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1616 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1619 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1617 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1620 state.NotifyReadyToActivate(); 1618 state.NotifyReadyToActivate();
1621 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); 1619 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
1622 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1620 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1623 1621
1624 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1622 state.OnBeginImplFrame();
1625 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1623 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1626 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1624 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1627 1625
1628 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); 1626 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
1629 state.OnBeginImplFrameDeadline(); 1627 state.OnBeginImplFrameDeadline();
1630 EXPECT_ACTION_UPDATE_STATE( 1628 EXPECT_ACTION_UPDATE_STATE(
1631 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1629 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1632 state.DidSwapBuffers(); 1630 state.DidSwapBuffers();
1633 } 1631 }
1634 1632
1635 TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) { 1633 TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) {
1636 SchedulerSettings settings; 1634 SchedulerSettings settings;
1637 settings.impl_side_painting = true; 1635 settings.impl_side_painting = true;
1638 StateMachine state(settings); 1636 StateMachine state(settings);
1639 SET_UP_STATE(state) 1637 SET_UP_STATE(state)
1640 1638
1641 // This test ensures that impl-draws are prioritized over main thread updates 1639 // This test ensures that impl-draws are prioritized over main thread updates
1642 // in prefer impl latency mode. 1640 // in prefer impl latency mode.
1643 state.SetNeedsRedraw(true); 1641 state.SetNeedsRedraw(true);
1644 state.SetNeedsCommit(); 1642 state.SetNeedsCommit();
1645 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1643 state.OnBeginImplFrame();
1646 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1644 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1647 EXPECT_ACTION_UPDATE_STATE( 1645 EXPECT_ACTION_UPDATE_STATE(
1648 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1646 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1649 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1647 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1650 1648
1651 // Verify the deadline is not triggered early until we enter 1649 // Verify the deadline is not triggered early until we enter
1652 // prefer impl latency mode. 1650 // prefer impl latency mode.
1653 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); 1651 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
1654 state.SetImplLatencyTakesPriority(true); 1652 state.SetImplLatencyTakesPriority(true);
1655 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); 1653 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
(...skipping 16 matching lines...) Expand all
1672 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1670 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1673 1671
1674 // Finish the previous commit and draw it. 1672 // Finish the previous commit and draw it.
1675 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); 1673 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state);
1676 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1674 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1677 1675
1678 // Verify we do not send another BeginMainFrame if was are swap throttled 1676 // Verify we do not send another BeginMainFrame if was are swap throttled
1679 // and did not just swap. 1677 // and did not just swap.
1680 state.SetNeedsCommit(); 1678 state.SetNeedsCommit();
1681 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1679 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1682 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1680 state.OnBeginImplFrame();
1683 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1681 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1684 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); 1682 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
1685 state.OnBeginImplFrameDeadline(); 1683 state.OnBeginImplFrameDeadline();
1686 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1684 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1687 } 1685 }
1688 1686
1689 TEST(SchedulerStateMachineTest, 1687 TEST(SchedulerStateMachineTest,
1690 TestTriggerDeadlineImmediatelyOnLostOutputSurface) { 1688 TestTriggerDeadlineImmediatelyOnLostOutputSurface) {
1691 SchedulerSettings default_scheduler_settings; 1689 SchedulerSettings default_scheduler_settings;
1692 StateMachine state(default_scheduler_settings); 1690 StateMachine state(default_scheduler_settings);
1693 SET_UP_STATE(state) 1691 SET_UP_STATE(state)
1694 1692
1695 state.SetNeedsCommit(); 1693 state.SetNeedsCommit();
1696 1694
1697 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1695 state.OnBeginImplFrame();
1698 EXPECT_ACTION_UPDATE_STATE( 1696 EXPECT_ACTION_UPDATE_STATE(
1699 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1697 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1700 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1698 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1701 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); 1699 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
1702 1700
1703 state.DidLoseOutputSurface(); 1701 state.DidLoseOutputSurface();
1704 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1702 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1705 // The deadline should be triggered immediately when output surface is lost. 1703 // The deadline should be triggered immediately when output surface is lost.
1706 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); 1704 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
1707 } 1705 }
1708 1706
1709 TEST(SchedulerStateMachineTest, TestSetNeedsAnimate) { 1707 TEST(SchedulerStateMachineTest, TestSetNeedsAnimate) {
1710 SchedulerSettings settings; 1708 SchedulerSettings settings;
1711 settings.impl_side_painting = true; 1709 settings.impl_side_painting = true;
1712 StateMachine state(settings); 1710 StateMachine state(settings);
1713 SET_UP_STATE(state) 1711 SET_UP_STATE(state)
1714 1712
1715 // Test requesting an animation that, when run, causes us to draw. 1713 // Test requesting an animation that, when run, causes us to draw.
1716 state.SetNeedsAnimate(); 1714 state.SetNeedsAnimate();
1717 EXPECT_TRUE(state.BeginFrameNeeded()); 1715 EXPECT_TRUE(state.BeginFrameNeeded());
1718 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1716 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1719 1717
1720 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1718 state.OnBeginImplFrame();
1721 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1719 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1722 1720
1723 state.OnBeginImplFrameDeadlinePending(); 1721 state.OnBeginImplFrameDeadlinePending();
1724 state.OnBeginImplFrameDeadline(); 1722 state.OnBeginImplFrameDeadline();
1725 EXPECT_ACTION_UPDATE_STATE( 1723 EXPECT_ACTION_UPDATE_STATE(
1726 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1724 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1727 } 1725 }
1728 1726
1729 TEST(SchedulerStateMachineTest, TestAnimateBeforeCommit) { 1727 TEST(SchedulerStateMachineTest, TestAnimateBeforeCommit) {
1730 SchedulerSettings settings; 1728 SchedulerSettings settings;
1731 settings.impl_side_painting = true; 1729 settings.impl_side_painting = true;
1732 StateMachine state(settings); 1730 StateMachine state(settings);
1733 SET_UP_STATE(state) 1731 SET_UP_STATE(state)
1734 1732
1735 // Check that animations are updated before we start a commit. 1733 // Check that animations are updated before we start a commit.
1736 state.SetNeedsAnimate(); 1734 state.SetNeedsAnimate();
1737 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1735 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1738 state.SetNeedsCommit(); 1736 state.SetNeedsCommit();
1739 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1737 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1740 EXPECT_TRUE(state.BeginFrameNeeded()); 1738 EXPECT_TRUE(state.BeginFrameNeeded());
1741 1739
1742 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1740 state.OnBeginImplFrame();
1743 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1741 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1744 EXPECT_ACTION_UPDATE_STATE( 1742 EXPECT_ACTION_UPDATE_STATE(
1745 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1743 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1746 1744
1747 state.OnBeginImplFrameDeadlinePending(); 1745 state.OnBeginImplFrameDeadlinePending();
1748 state.OnBeginImplFrameDeadline(); 1746 state.OnBeginImplFrameDeadline();
1749 EXPECT_ACTION_UPDATE_STATE( 1747 EXPECT_ACTION_UPDATE_STATE(
1750 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1748 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1751 } 1749 }
1752 1750
1753 TEST(SchedulerStateMachineTest, TestAnimateAfterCommitBeforeDraw) { 1751 TEST(SchedulerStateMachineTest, TestAnimateAfterCommitBeforeDraw) {
1754 SchedulerSettings settings; 1752 SchedulerSettings settings;
1755 settings.impl_side_painting = true; 1753 settings.impl_side_painting = true;
1756 StateMachine state(settings); 1754 StateMachine state(settings);
1757 SET_UP_STATE(state) 1755 SET_UP_STATE(state)
1758 1756
1759 // Check that animations are updated before we start a commit. 1757 // Check that animations are updated before we start a commit.
1760 state.SetNeedsAnimate(); 1758 state.SetNeedsAnimate();
1761 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1759 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1762 state.SetNeedsCommit(); 1760 state.SetNeedsCommit();
1763 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1761 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1764 EXPECT_TRUE(state.BeginFrameNeeded()); 1762 EXPECT_TRUE(state.BeginFrameNeeded());
1765 1763
1766 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1764 state.OnBeginImplFrame();
1767 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1765 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1768 EXPECT_ACTION_UPDATE_STATE( 1766 EXPECT_ACTION_UPDATE_STATE(
1769 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1767 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1770 1768
1771 state.NotifyBeginMainFrameStarted(); 1769 state.NotifyBeginMainFrameStarted();
1772 state.NotifyReadyToCommit(); 1770 state.NotifyReadyToCommit();
1773 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); 1771 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1774 1772
1775 state.OnBeginImplFrameDeadlinePending(); 1773 state.OnBeginImplFrameDeadlinePending();
1776 state.OnBeginImplFrameDeadline(); 1774 state.OnBeginImplFrameDeadline();
1777 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1775 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1778 EXPECT_ACTION_UPDATE_STATE( 1776 EXPECT_ACTION_UPDATE_STATE(
1779 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1777 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1780 } 1778 }
1781 1779
1782 TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) { 1780 TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) {
1783 SchedulerSettings settings; 1781 SchedulerSettings settings;
1784 settings.impl_side_painting = true; 1782 settings.impl_side_painting = true;
1785 StateMachine state(settings); 1783 StateMachine state(settings);
1786 SET_UP_STATE(state) 1784 SET_UP_STATE(state)
1787 1785
1788 // Test requesting an animation after we have already animated during this 1786 // Test requesting an animation after we have already animated during this
1789 // frame. 1787 // frame.
1790 state.SetNeedsRedraw(true); 1788 state.SetNeedsRedraw(true);
1791 EXPECT_TRUE(state.BeginFrameNeeded()); 1789 EXPECT_TRUE(state.BeginFrameNeeded());
1792 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1790 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1793 1791
1794 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1792 state.OnBeginImplFrame();
1795 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1793 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1796 1794
1797 state.SetNeedsAnimate(); 1795 state.SetNeedsAnimate();
1798 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1796 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1799 1797
1800 state.OnBeginImplFrameDeadline(); 1798 state.OnBeginImplFrameDeadline();
1801 EXPECT_ACTION_UPDATE_STATE( 1799 EXPECT_ACTION_UPDATE_STATE(
1802 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1800 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1803 } 1801 }
1804 1802
(...skipping 11 matching lines...) Expand all
1816 SchedulerSettings settings; 1814 SchedulerSettings settings;
1817 StateMachine state(settings); 1815 StateMachine state(settings);
1818 SET_UP_STATE(state) 1816 SET_UP_STATE(state)
1819 1817
1820 state.SetDeferCommits(true); 1818 state.SetDeferCommits(true);
1821 1819
1822 state.SetNeedsCommit(); 1820 state.SetNeedsCommit();
1823 EXPECT_TRUE(state.BeginFrameNeeded()); 1821 EXPECT_TRUE(state.BeginFrameNeeded());
1824 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1822 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1825 1823
1826 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1824 state.OnBeginImplFrame();
1827 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1825 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1828 1826
1829 state.OnBeginImplFrameDeadline(); 1827 state.OnBeginImplFrameDeadline();
1830 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1828 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1831 1829
1832 state.SetDeferCommits(false); 1830 state.SetDeferCommits(false);
1833 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 1831 state.OnBeginImplFrame();
1834 EXPECT_ACTION_UPDATE_STATE( 1832 EXPECT_ACTION_UPDATE_STATE(
1835 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1833 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1836 } 1834 }
1837 1835
1836 TEST(SchedulerStateMachineTest, EarlyOutCommitWantsProactiveBeginFrame) {
1837 SchedulerSettings settings;
1838 StateMachine state(settings);
1839 SET_UP_STATE(state);
1840
1841 EXPECT_FALSE(state.ProactiveBeginFrameWanted());
1842 bool commit_has_no_updates = true;
1843 state.UpdateStateOnCommit(commit_has_no_updates);
1844 EXPECT_TRUE(state.ProactiveBeginFrameWanted());
1845 state.OnBeginImplFrame();
1846 EXPECT_FALSE(state.ProactiveBeginFrameWanted());
1847 }
1848
1838 } // namespace 1849 } // namespace
1839 } // namespace cc 1850 } // 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