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 | |
114 DCHECK_EQ(!root_layer_, LayerListIsEmpty()); | |
jaydasika
2016/06/28 17:10:47
This line is no longer valid. root_layer_ is used
danakj
2016/06/29 23:06:25
Oh ok. I meant to remove it when I wrote the one a
| |
103 if (!LayerListIsEmpty()) { | 115 if (!LayerListIsEmpty()) { |
104 LayerTreeHostCommon::CallFunctionForEveryLayer( | 116 LayerTreeHostCommon::CallFunctionForEveryLayer( |
105 this, [](LayerImpl* layer) { layer->ReleaseResources(); }); | 117 this, [](LayerImpl* layer) { layer->ReleaseResources(); }); |
106 } | 118 } |
107 } | 119 } |
108 | 120 |
109 void LayerTreeImpl::RecreateResources() { | 121 void LayerTreeImpl::RecreateResources() { |
110 if (!LayerListIsEmpty()) { | 122 if (!LayerListIsEmpty()) { |
111 LayerTreeHostCommon::CallFunctionForEveryLayer( | 123 LayerTreeHostCommon::CallFunctionForEveryLayer( |
112 this, [](LayerImpl* layer) { layer->RecreateResources(); }); | 124 this, [](LayerImpl* layer) { layer->RecreateResources(); }); |
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2087 | 2099 |
2088 void LayerTreeImpl::ResetAllChangeTracking() { | 2100 void LayerTreeImpl::ResetAllChangeTracking() { |
2089 layers_that_should_push_properties_.clear(); | 2101 layers_that_should_push_properties_.clear(); |
2090 // Iterate over all layers, including masks and replicas. | 2102 // Iterate over all layers, including masks and replicas. |
2091 for (auto& layer : *layers_) | 2103 for (auto& layer : *layers_) |
2092 layer->ResetChangeTracking(); | 2104 layer->ResetChangeTracking(); |
2093 property_trees_.ResetAllChangeTracking(); | 2105 property_trees_.ResetAllChangeTracking(); |
2094 } | 2106 } |
2095 | 2107 |
2096 } // namespace cc | 2108 } // namespace cc |
OLD | NEW |