| 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 void LayerTreeImpl::ClearViewportLayers() { | 760 void LayerTreeImpl::ClearViewportLayers() { |
| 761 overscroll_elasticity_layer_id_ = Layer::INVALID_ID; | 761 overscroll_elasticity_layer_id_ = Layer::INVALID_ID; |
| 762 page_scale_layer_id_ = Layer::INVALID_ID; | 762 page_scale_layer_id_ = Layer::INVALID_ID; |
| 763 inner_viewport_scroll_layer_id_ = Layer::INVALID_ID; | 763 inner_viewport_scroll_layer_id_ = Layer::INVALID_ID; |
| 764 outer_viewport_scroll_layer_id_ = Layer::INVALID_ID; | 764 outer_viewport_scroll_layer_id_ = Layer::INVALID_ID; |
| 765 } | 765 } |
| 766 | 766 |
| 767 #if DCHECK_IS_ON() | 767 #if DCHECK_IS_ON() |
| 768 int SanityCheckCopyRequestCounts(LayerImpl* layer) { | 768 void SanityCheckCopyRequestCounts(LayerTreeImpl* layer_tree_impl) { |
| 769 int count = layer->HasCopyRequest() ? 1 : 0; | 769 EffectTree& effect_tree = layer_tree_impl->property_trees()->effect_tree; |
| 770 for (size_t i = 0; i < layer->children().size(); ++i) { | 770 const int effect_tree_size = static_cast<int>(effect_tree.size()); |
| 771 count += SanityCheckCopyRequestCounts(layer->child_at(i)); | 771 std::vector<int> copy_requests_count_in_effect_tree(effect_tree_size); |
| 772 for (auto* layer : *layer_tree_impl) { |
| 773 if (layer->HasCopyRequest()) { |
| 774 copy_requests_count_in_effect_tree[layer->effect_tree_index()]++; |
| 775 } |
| 772 } | 776 } |
| 773 if (layer->layer_tree_impl() | 777 for (int i = effect_tree_size - 1; i >= 0; i--) { |
| 774 ->property_trees() | 778 EffectNode* node = effect_tree.Node(i); |
| 775 ->effect_tree.Node(layer->effect_tree_index()) | 779 DCHECK_EQ(node->data.num_copy_requests_in_subtree, |
| 776 ->owner_id == layer->id()) { | 780 copy_requests_count_in_effect_tree[i]); |
| 777 DCHECK_EQ(count, layer->num_copy_requests_in_target_subtree()) | 781 if (node->parent_id >= 0) |
| 778 << ", id: " << layer->id(); | 782 copy_requests_count_in_effect_tree[node->parent_id] += |
| 779 } else { | 783 copy_requests_count_in_effect_tree[i]; |
| 780 DCHECK_LE(count, layer->num_copy_requests_in_target_subtree()) | |
| 781 << ", id: " << layer->id(); | |
| 782 } | 784 } |
| 783 return count; | |
| 784 } | 785 } |
| 785 #endif | 786 #endif |
| 786 | 787 |
| 787 bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) { | 788 bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) { |
| 788 #if DCHECK_IS_ON() | 789 #if DCHECK_IS_ON() |
| 789 if (root_layer()) | 790 if (root_layer()) |
| 790 SanityCheckCopyRequestCounts(root_layer()); | 791 SanityCheckCopyRequestCounts(root_layer()->layer_tree_impl()); |
| 791 #endif | 792 #endif |
| 792 | 793 |
| 793 if (!needs_update_draw_properties_) | 794 if (!needs_update_draw_properties_) |
| 794 return true; | 795 return true; |
| 795 | 796 |
| 796 // Calling UpdateDrawProperties must clear this flag, so there can be no | 797 // Calling UpdateDrawProperties must clear this flag, so there can be no |
| 797 // early outs before this. | 798 // early outs before this. |
| 798 needs_update_draw_properties_ = false; | 799 needs_update_draw_properties_ = false; |
| 799 | 800 |
| 800 // For max_texture_size. When the renderer is re-created in | 801 // For max_texture_size. When the renderer is re-created in |
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 } | 2106 } |
| 2106 | 2107 |
| 2107 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { | 2108 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { |
| 2108 layers_that_should_push_properties_.clear(); | 2109 layers_that_should_push_properties_.clear(); |
| 2109 for (auto* layer : *this) | 2110 for (auto* layer : *this) |
| 2110 layer->ResetChangeTracking(); | 2111 layer->ResetChangeTracking(); |
| 2111 property_trees_.ResetAllChangeTracking(flag); | 2112 property_trees_.ResetAllChangeTracking(flag); |
| 2112 } | 2113 } |
| 2113 | 2114 |
| 2114 } // namespace cc | 2115 } // namespace cc |
| OLD | NEW |