Chromium Code Reviews| 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 begin_frame_state_ = BEGIN_FRAME_STATE_IDLE; | 874 begin_frame_state_ = BEGIN_FRAME_STATE_IDLE; |
| 875 } | 875 } |
| 876 | 876 |
| 877 bool SchedulerStateMachine::ShouldTriggerBeginFrameDeadlineEarly() const { | 877 bool SchedulerStateMachine::ShouldTriggerBeginFrameDeadlineEarly() const { |
| 878 // If we are in the middle of the readback, we won't swap, so there is | 878 // If we are in the middle of the readback, we won't swap, so there is |
| 879 // no reason to trigger the deadline early. | 879 // no reason to trigger the deadline early. |
| 880 if (readback_state_ != READBACK_STATE_IDLE) | 880 if (readback_state_ != READBACK_STATE_IDLE) |
| 881 return false; | 881 return false; |
| 882 | 882 |
| 883 // TODO(brianderson): This should take into account multiple commit sources. | 883 // TODO(brianderson): This should take into account multiple commit sources. |
| 884 return begin_frame_state_ == BEGIN_FRAME_STATE_INSIDE_BEGIN_FRAME && | 884 if (begin_frame_state_ == BEGIN_FRAME_STATE_INSIDE_BEGIN_FRAME && |
| 885 active_tree_needs_first_draw_; | 885 active_tree_needs_first_draw_) |
| 886 return true; | |
|
brianderson
2013/10/15 15:02:32
Sorry, I meant to split this into two conditions:
Sami
2013/10/15 15:12:51
Done.
| |
| 887 | |
| 888 // This is used to prioritize impl-thread draws when the main thread isn't | |
| 889 // producing anything, e.g., after an aborted commit. We also check that we | |
| 890 // don't have a pending tree -- otherwise we should give it a chance to | |
| 891 // activate. | |
| 892 // TODO(skyostil): Revisit this when we have more accurate deadline estimates. | |
| 893 if (commit_state_ == COMMIT_STATE_IDLE && needs_redraw_ && !has_pending_tree_) | |
| 894 return true; | |
| 895 | |
| 896 return false; | |
| 886 } | 897 } |
| 887 | 898 |
| 888 void SchedulerStateMachine::DidEnterPollForAnticipatedDrawTriggers() { | 899 void SchedulerStateMachine::DidEnterPollForAnticipatedDrawTriggers() { |
| 889 current_frame_number_++; | 900 current_frame_number_++; |
| 890 inside_poll_for_anticipated_draw_triggers_ = true; | 901 inside_poll_for_anticipated_draw_triggers_ = true; |
| 891 } | 902 } |
| 892 | 903 |
| 893 void SchedulerStateMachine::DidLeavePollForAnticipatedDrawTriggers() { | 904 void SchedulerStateMachine::DidLeavePollForAnticipatedDrawTriggers() { |
| 894 inside_poll_for_anticipated_draw_triggers_ = false; | 905 inside_poll_for_anticipated_draw_triggers_ = false; |
| 895 } | 906 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1003 case OUTPUT_SURFACE_ACTIVE: | 1014 case OUTPUT_SURFACE_ACTIVE: |
| 1004 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1015 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
| 1005 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1016 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
| 1006 return true; | 1017 return true; |
| 1007 } | 1018 } |
| 1008 NOTREACHED(); | 1019 NOTREACHED(); |
| 1009 return false; | 1020 return false; |
| 1010 } | 1021 } |
| 1011 | 1022 |
| 1012 } // namespace cc | 1023 } // namespace cc |
| OLD | NEW |