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/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(LayerImpl* root_layer) { |
|
ajuma
2016/03/29 19:30:43
This is only using the root_layer in order to get
jaydasika
2016/03/29 19:35:15
Done.
| |
| 769 int count = layer->HasCopyRequest() ? 1 : 0; | 769 EffectTree& effect_tree = |
| 770 for (size_t i = 0; i < layer->children().size(); ++i) { | 770 root_layer->layer_tree_impl()->property_trees()->effect_tree; |
| 771 count += SanityCheckCopyRequestCounts(layer->child_at(i)); | 771 const int effect_tree_size = static_cast<int>(effect_tree.size()); |
| 772 std::vector<int> copy_requests_count_in_effect_tree(effect_tree_size); | |
| 773 for (auto* layer : *root_layer->layer_tree_impl()) { | |
| 774 if (layer->HasCopyRequest()) { | |
| 775 copy_requests_count_in_effect_tree[layer->effect_tree_index()]++; | |
| 776 } | |
| 772 } | 777 } |
| 773 if (layer->layer_tree_impl() | 778 for (int i = effect_tree_size - 1; i >= 0; i--) { |
| 774 ->property_trees() | 779 EffectNode* node = effect_tree.Node(i); |
| 775 ->effect_tree.Node(layer->effect_tree_index()) | 780 DCHECK_EQ(node->data.num_copy_requests_in_subtree, |
| 776 ->owner_id == layer->id()) { | 781 copy_requests_count_in_effect_tree[i]); |
| 777 DCHECK_EQ(count, layer->num_copy_requests_in_target_subtree()) | 782 if (node->parent_id >= 0) |
| 778 << ", id: " << layer->id(); | 783 copy_requests_count_in_effect_tree[node->parent_id] += |
| 779 } else { | 784 copy_requests_count_in_effect_tree[i]; |
| 780 DCHECK_LE(count, layer->num_copy_requests_in_target_subtree()) | |
| 781 << ", id: " << layer->id(); | |
| 782 } | 785 } |
| 783 return count; | |
| 784 } | 786 } |
| 785 #endif | 787 #endif |
| 786 | 788 |
| 787 bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) { | 789 bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) { |
| 788 #if DCHECK_IS_ON() | 790 #if DCHECK_IS_ON() |
| 789 if (root_layer()) | 791 if (root_layer()) |
| 790 SanityCheckCopyRequestCounts(root_layer()); | 792 SanityCheckCopyRequestCounts(root_layer()); |
| 791 #endif | 793 #endif |
| 792 | 794 |
| 793 if (!needs_update_draw_properties_) | 795 if (!needs_update_draw_properties_) |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2105 } | 2107 } |
| 2106 | 2108 |
| 2107 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { | 2109 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { |
| 2108 layers_that_should_push_properties_.clear(); | 2110 layers_that_should_push_properties_.clear(); |
| 2109 for (auto* layer : *this) | 2111 for (auto* layer : *this) |
| 2110 layer->ResetChangeTracking(); | 2112 layer->ResetChangeTracking(); |
| 2111 property_trees_.ResetAllChangeTracking(flag); | 2113 property_trees_.ResetAllChangeTracking(flag); |
| 2112 } | 2114 } |
| 2113 | 2115 |
| 2114 } // namespace cc | 2116 } // namespace cc |
| OLD | NEW |