| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 | 717 |
| 718 // If we are planing to draw with the new commit, lock the layer textures for | 718 // If we are planing to draw with the new commit, lock the layer textures for |
| 719 // use on the impl thread. Otherwise, leave them unlocked. | 719 // use on the impl thread. Otherwise, leave them unlocked. |
| 720 if (has_pending_tree_ || needs_redraw_) | 720 if (has_pending_tree_ || needs_redraw_) |
| 721 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD; | 721 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD; |
| 722 else | 722 else |
| 723 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED; | 723 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED; |
| 724 } | 724 } |
| 725 | 725 |
| 726 void SchedulerStateMachine::UpdateStateOnActivation() { | 726 void SchedulerStateMachine::UpdateStateOnActivation() { |
| 727 // Update output surface state. | |
| 728 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION) | 727 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION) |
| 729 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; | 728 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; |
| 730 | 729 |
| 731 // Update readback state | |
| 732 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION) | 730 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION) |
| 733 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_DRAW; | 731 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_DRAW; |
| 734 | 732 |
| 735 // Update forced redraw state | |
| 736 if (readback_state_ == READBACK_STATE_WAITING_FOR_ACTIVATION) | 733 if (readback_state_ == READBACK_STATE_WAITING_FOR_ACTIVATION) |
| 737 readback_state_ = READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK; | 734 readback_state_ = READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK; |
| 738 else if (readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) | 735 else if (readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) |
| 739 readback_state_ = READBACK_STATE_IDLE; | 736 readback_state_ = READBACK_STATE_IDLE; |
| 740 | 737 |
| 741 has_pending_tree_ = false; | 738 has_pending_tree_ = false; |
| 742 pending_tree_is_ready_for_activation_ = false; | 739 pending_tree_is_ready_for_activation_ = false; |
| 743 active_tree_needs_first_draw_ = true; | 740 active_tree_needs_first_draw_ = true; |
| 744 needs_redraw_ = true; | 741 needs_redraw_ = true; |
| 745 } | 742 } |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 case OUTPUT_SURFACE_ACTIVE: | 1148 case OUTPUT_SURFACE_ACTIVE: |
| 1152 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1149 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
| 1153 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1150 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
| 1154 return true; | 1151 return true; |
| 1155 } | 1152 } |
| 1156 NOTREACHED(); | 1153 NOTREACHED(); |
| 1157 return false; | 1154 return false; |
| 1158 } | 1155 } |
| 1159 | 1156 |
| 1160 } // namespace cc | 1157 } // namespace cc |
| OLD | NEW |