OLD | NEW |
---|---|
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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 // We should proactively request a BeginFrame if a commit is pending | 733 // We should proactively request a BeginFrame if a commit is pending |
734 // because we will want to draw if the commit completes quickly. | 734 // because we will want to draw if the commit completes quickly. |
735 if (needs_commit_ || commit_state_ != COMMIT_STATE_IDLE) | 735 if (needs_commit_ || commit_state_ != COMMIT_STATE_IDLE) |
736 return true; | 736 return true; |
737 | 737 |
738 // If the pending tree activates quickly, we'll want a BeginFrame soon | 738 // If the pending tree activates quickly, we'll want a BeginFrame soon |
739 // to draw the new active tree. | 739 // to draw the new active tree. |
740 if (has_pending_tree_) | 740 if (has_pending_tree_) |
741 return true; | 741 return true; |
742 | 742 |
743 // If we just swapped, it's likely that we are going to produce another | |
744 // frame soon. This helps avoid negative glitches in our SetNeedsBeginFrame | |
745 // requests, which may propagate to the BeginFrame provider and get sampled | |
746 // at an innpportune time, delaying the next BeginFrame. | |
enne (OOO)
2013/09/13 18:39:19
speling
| |
747 if (last_frame_number_swap_performed_ == current_frame_number_) | |
748 return true; | |
749 | |
743 return false; | 750 return false; |
744 } | 751 } |
745 | 752 |
746 void SchedulerStateMachine::DidEnterBeginFrame(const BeginFrameArgs& args) { | 753 void SchedulerStateMachine::DidEnterBeginFrame(const BeginFrameArgs& args) { |
747 current_frame_number_++; | 754 current_frame_number_++; |
748 inside_begin_frame_ = true; | 755 inside_begin_frame_ = true; |
749 last_begin_frame_args_ = args; | 756 last_begin_frame_args_ = args; |
750 } | 757 } |
751 | 758 |
752 void SchedulerStateMachine::DidLeaveBeginFrame() { | 759 void SchedulerStateMachine::DidLeaveBeginFrame() { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
861 case OUTPUT_SURFACE_ACTIVE: | 868 case OUTPUT_SURFACE_ACTIVE: |
862 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 869 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
863 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 870 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
864 return true; | 871 return true; |
865 } | 872 } |
866 NOTREACHED(); | 873 NOTREACHED(); |
867 return false; | 874 return false; |
868 } | 875 } |
869 | 876 |
870 } // namespace cc | 877 } // namespace cc |
OLD | NEW |