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_); |
| 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 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 | 2101 |
2091 void LayerTreeImpl::ResetAllChangeTracking() { | 2102 void LayerTreeImpl::ResetAllChangeTracking() { |
2092 layers_that_should_push_properties_.clear(); | 2103 layers_that_should_push_properties_.clear(); |
2093 // Iterate over all layers, including masks and replicas. | 2104 // Iterate over all layers, including masks and replicas. |
2094 for (auto& layer : *layers_) | 2105 for (auto& layer : *layers_) |
2095 layer->ResetChangeTracking(); | 2106 layer->ResetChangeTracking(); |
2096 property_trees_.ResetAllChangeTracking(); | 2107 property_trees_.ResetAllChangeTracking(); |
2097 } | 2108 } |
2098 | 2109 |
2099 } // namespace cc | 2110 } // namespace cc |
OLD | NEW |