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

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

Issue 462803002: Fix failing (flaky) LayerTreeHostTestLCDNotification test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: flakylcd: fixnewcontexttest Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/scheduler/scheduler_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (last_frame_number_animate_performed_ == current_frame_number_) 411 if (last_frame_number_animate_performed_ == current_frame_number_)
412 return false; 412 return false;
413 413
414 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING && 414 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING &&
415 begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) 415 begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE)
416 return false; 416 return false;
417 417
418 return needs_redraw_ || needs_animate_; 418 return needs_redraw_ || needs_animate_;
419 } 419 }
420 420
421 bool SchedulerStateMachine::CouldSendBeginMainFrame() const {
422 if (!needs_commit_)
423 return false;
424
425 // We can not perform commits if we are not visible.
426 if (!visible_)
427 return false;
428
429 return true;
430 }
431
421 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { 432 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
422 if (!needs_commit_) 433 if (!CouldSendBeginMainFrame())
423 return false; 434 return false;
424 435
425 // Only send BeginMainFrame when there isn't another commit pending already. 436 // Only send BeginMainFrame when there isn't another commit pending already.
426 if (commit_state_ != COMMIT_STATE_IDLE) 437 if (commit_state_ != COMMIT_STATE_IDLE)
427 return false; 438 return false;
428 439
429 // Don't send BeginMainFrame early if we are prioritizing the active tree 440 // Don't send BeginMainFrame early if we are prioritizing the active tree
430 // because of smoothness_takes_priority. 441 // because of smoothness_takes_priority.
431 if (smoothness_takes_priority_ && 442 if (smoothness_takes_priority_ &&
432 (has_pending_tree_ || active_tree_needs_first_draw_)) { 443 (has_pending_tree_ || active_tree_needs_first_draw_)) {
433 return false; 444 return false;
434 } 445 }
435 446
436 // We do not need commits if we are not visible.
437 if (!visible_)
438 return false;
439
440 // We want to start the first commit after we get a new output surface ASAP. 447 // We want to start the first commit after we get a new output surface ASAP.
441 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) 448 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT)
442 return true; 449 return true;
443 450
444 // We should not send BeginMainFrame while we are in 451 // We should not send BeginMainFrame while we are in
445 // BEGIN_IMPL_FRAME_STATE_IDLE since we might have new 452 // BEGIN_IMPL_FRAME_STATE_IDLE since we might have new
446 // user input arriving soon. 453 // user input arriving soon.
447 // TODO(brianderson): Allow sending BeginMainFrame while idle when the main 454 // TODO(brianderson): Allow sending BeginMainFrame while idle when the main
448 // thread isn't consuming user input. 455 // thread isn't consuming user input.
449 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE && 456 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE &&
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 case OUTPUT_SURFACE_ACTIVE: 1080 case OUTPUT_SURFACE_ACTIVE:
1074 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: 1081 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT:
1075 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: 1082 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION:
1076 return true; 1083 return true;
1077 } 1084 }
1078 NOTREACHED(); 1085 NOTREACHED();
1079 return false; 1086 return false;
1080 } 1087 }
1081 1088
1082 } // namespace cc 1089 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698