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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 DCHECK(LayerListIsEmpty()); | 93 DCHECK(LayerListIsEmpty()); |
94 DCHECK(layers_->empty()); | 94 DCHECK(layers_->empty()); |
95 } | 95 } |
96 | 96 |
97 void LayerTreeImpl::Shutdown() { | 97 void LayerTreeImpl::Shutdown() { |
98 DetachLayers(); | 98 DetachLayers(); |
99 DCHECK(LayerListIsEmpty()); | 99 DCHECK(LayerListIsEmpty()); |
100 } | 100 } |
101 | 101 |
102 void LayerTreeImpl::ReleaseResources() { | 102 void LayerTreeImpl::ReleaseResources() { |
| 103 #if DCHECK_IS_ON() |
| 104 // These DCHECKs catch tests that add layers to the tree but fail to build the |
| 105 // layer list afterward. |
| 106 LayerListIterator<LayerImpl> it(root_layer_for_testing_); |
| 107 size_t i = 0; |
| 108 for (; it != LayerListIterator<LayerImpl>(nullptr); ++it, ++i) { |
| 109 DCHECK_LT(i, layer_list_.size()); |
| 110 DCHECK_EQ(layer_list_[i], *it); |
| 111 } |
| 112 #endif |
| 113 |
103 if (!LayerListIsEmpty()) { | 114 if (!LayerListIsEmpty()) { |
104 LayerTreeHostCommon::CallFunctionForEveryLayer( | 115 LayerTreeHostCommon::CallFunctionForEveryLayer( |
105 this, [](LayerImpl* layer) { layer->ReleaseResources(); }); | 116 this, [](LayerImpl* layer) { layer->ReleaseResources(); }); |
106 } | 117 } |
107 } | 118 } |
108 | 119 |
109 void LayerTreeImpl::RecreateResources() { | 120 void LayerTreeImpl::RecreateResources() { |
110 if (!LayerListIsEmpty()) { | 121 if (!LayerListIsEmpty()) { |
111 LayerTreeHostCommon::CallFunctionForEveryLayer( | 122 LayerTreeHostCommon::CallFunctionForEveryLayer( |
112 this, [](LayerImpl* layer) { layer->RecreateResources(); }); | 123 this, [](LayerImpl* layer) { layer->RecreateResources(); }); |
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 | 2108 |
2098 void LayerTreeImpl::ResetAllChangeTracking() { | 2109 void LayerTreeImpl::ResetAllChangeTracking() { |
2099 layers_that_should_push_properties_.clear(); | 2110 layers_that_should_push_properties_.clear(); |
2100 // Iterate over all layers, including masks and replicas. | 2111 // Iterate over all layers, including masks and replicas. |
2101 for (auto& layer : *layers_) | 2112 for (auto& layer : *layers_) |
2102 layer->ResetChangeTracking(); | 2113 layer->ResetChangeTracking(); |
2103 property_trees_.ResetAllChangeTracking(); | 2114 property_trees_.ResetAllChangeTracking(); |
2104 } | 2115 } |
2105 | 2116 |
2106 } // namespace cc | 2117 } // namespace cc |
OLD | NEW |