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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 commit_state_ = COMMIT_STATE_IDLE; | 666 commit_state_ = COMMIT_STATE_IDLE; |
667 } | 667 } |
668 | 668 |
669 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD) | 669 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD) |
670 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED; | 670 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED; |
671 | 671 |
672 needs_redraw_ = false; | 672 needs_redraw_ = false; |
673 draw_if_possible_failed_ = false; | 673 draw_if_possible_failed_ = false; |
674 active_tree_needs_first_draw_ = false; | 674 active_tree_needs_first_draw_ = false; |
675 | 675 |
676 if (did_swap) { | 676 if (did_swap) |
677 swap_used_incomplete_tile_ = false; | |
678 last_frame_number_swap_performed_ = current_frame_number_; | 677 last_frame_number_swap_performed_ = current_frame_number_; |
679 } | |
680 } | 678 } |
681 | 679 |
682 void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() { | 680 void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() { |
683 DCHECK(!main_thread_needs_layer_textures_); | 681 DCHECK(!main_thread_needs_layer_textures_); |
684 DCHECK_NE(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); | 682 DCHECK_NE(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); |
685 main_thread_needs_layer_textures_ = true; | 683 main_thread_needs_layer_textures_ = true; |
686 } | 684 } |
687 | 685 |
688 // These are the cases where we definitely (or almost definitely) have a | 686 // These are the cases where we definitely (or almost definitely) have a |
689 // new frame to draw and can draw. | 687 // new frame to draw and can draw. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 } | 750 } |
753 | 751 |
754 void SchedulerStateMachine::DidLeaveBeginFrame() { | 752 void SchedulerStateMachine::DidLeaveBeginFrame() { |
755 inside_begin_frame_ = false; | 753 inside_begin_frame_ = false; |
756 } | 754 } |
757 | 755 |
758 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } | 756 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } |
759 | 757 |
760 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } | 758 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } |
761 | 759 |
762 void SchedulerStateMachine::DidSwapUseIncompleteTile() { | 760 void SchedulerStateMachine::SetSwapUsedIncompleteTile( |
763 swap_used_incomplete_tile_ = true; | 761 bool used_incomplete_tile) { |
| 762 swap_used_incomplete_tile_ = used_incomplete_tile; |
764 } | 763 } |
765 | 764 |
766 void SchedulerStateMachine::DidDrawIfPossibleCompleted(bool success) { | 765 void SchedulerStateMachine::DidDrawIfPossibleCompleted(bool success) { |
767 draw_if_possible_failed_ = !success; | 766 draw_if_possible_failed_ = !success; |
768 if (draw_if_possible_failed_) { | 767 if (draw_if_possible_failed_) { |
769 needs_redraw_ = true; | 768 needs_redraw_ = true; |
770 needs_commit_ = true; | 769 needs_commit_ = true; |
771 consecutive_failed_draws_++; | 770 consecutive_failed_draws_++; |
772 if (settings_.timeout_and_draw_when_animation_checkerboards && | 771 if (settings_.timeout_and_draw_when_animation_checkerboards && |
773 consecutive_failed_draws_ >= | 772 consecutive_failed_draws_ >= |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 case OUTPUT_SURFACE_ACTIVE: | 857 case OUTPUT_SURFACE_ACTIVE: |
859 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 858 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
860 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 859 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
861 return true; | 860 return true; |
862 } | 861 } |
863 NOTREACHED(); | 862 NOTREACHED(); |
864 return false; | 863 return false; |
865 } | 864 } |
866 | 865 |
867 } // namespace cc | 866 } // namespace cc |
OLD | NEW |