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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1267 } | 1267 } |
1268 | 1268 |
1269 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { | 1269 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { |
1270 // Only the active tree needs to know about layers with copy requests, as | 1270 // Only the active tree needs to know about layers with copy requests, as |
1271 // they are aborted if not serviced during draw. | 1271 // they are aborted if not serviced during draw. |
1272 DCHECK(IsActiveTree()); | 1272 DCHECK(IsActiveTree()); |
1273 | 1273 |
1274 // DCHECK(std::find(layers_with_copy_output_request_.begin(), | 1274 // DCHECK(std::find(layers_with_copy_output_request_.begin(), |
1275 // layers_with_copy_output_request_.end(), | 1275 // layers_with_copy_output_request_.end(), |
1276 // layer) == layers_with_copy_output_request_.end()); | 1276 // layer) == layers_with_copy_output_request_.end()); |
1277 // TODO(danakj): Remove this once crash is found crbug.com/309777 | 1277 // TODO(danakj): Remove this once crash is found crbug.com/309777 |
danakj
2015/11/16 21:45:46
Oh, I should do this :)
Can you add a similar DCH
| |
1278 for (size_t i = 0; i < layers_with_copy_output_request_.size(); ++i) { | 1278 for (size_t i = 0; i < layers_with_copy_output_request_.size(); ++i) { |
1279 CHECK(layers_with_copy_output_request_[i] != layer) | 1279 CHECK(layers_with_copy_output_request_[i] != layer) |
1280 << i << " of " << layers_with_copy_output_request_.size(); | 1280 << i << " of " << layers_with_copy_output_request_.size(); |
1281 } | 1281 } |
1282 layers_with_copy_output_request_.push_back(layer); | 1282 layers_with_copy_output_request_.push_back(layer); |
1283 } | 1283 } |
1284 | 1284 |
1285 void LayerTreeImpl::RemoveLayerWithCopyOutputRequest(LayerImpl* layer) { | 1285 void LayerTreeImpl::RemoveLayerWithCopyOutputRequest(LayerImpl* layer) { |
1286 // Only the active tree needs to know about layers with copy requests, as | 1286 // Only the active tree needs to know about layers with copy requests, as |
1287 // they are aborted if not serviced during draw. | 1287 // they are aborted if not serviced during draw. |
1288 DCHECK(IsActiveTree()); | 1288 DCHECK(IsActiveTree()); |
1289 | 1289 |
1290 std::vector<LayerImpl*>::iterator it = std::find( | 1290 std::vector<LayerImpl*>::iterator it = std::find( |
1291 layers_with_copy_output_request_.begin(), | 1291 layers_with_copy_output_request_.begin(), |
1292 layers_with_copy_output_request_.end(), | 1292 layers_with_copy_output_request_.end(), |
1293 layer); | 1293 layer); |
1294 DCHECK(it != layers_with_copy_output_request_.end()); | 1294 DCHECK(it != layers_with_copy_output_request_.end()); |
1295 layers_with_copy_output_request_.erase(it); | 1295 layers_with_copy_output_request_.erase(it); |
1296 | 1296 |
1297 // TODO(danakj): Remove this once crash is found crbug.com/309777 | 1297 // TODO(danakj): Remove this once crash is found crbug.com/309777 |
1298 for (size_t i = 0; i < layers_with_copy_output_request_.size(); ++i) { | 1298 for (size_t i = 0; i < layers_with_copy_output_request_.size(); ++i) { |
1299 CHECK(layers_with_copy_output_request_[i] != layer) | 1299 CHECK(layers_with_copy_output_request_[i] != layer) |
1300 << i << " of " << layers_with_copy_output_request_.size(); | 1300 << i << " of " << layers_with_copy_output_request_.size(); |
1301 } | 1301 } |
1302 } | 1302 } |
1303 | 1303 |
1304 void LayerTreeImpl::AddSurfaceLayer(LayerImpl* layer) { | |
1305 surface_layers_.push_back(layer); | |
1306 } | |
1307 | |
1308 void LayerTreeImpl::RemoveSurfaceLayer(LayerImpl* layer) { | |
1309 std::vector<LayerImpl*>::iterator it = | |
1310 std::find(surface_layers_.begin(), surface_layers_.end(), layer); | |
1311 DCHECK(it != surface_layers_.end()); | |
1312 surface_layers_.erase(it); | |
1313 } | |
1314 | |
1304 const std::vector<LayerImpl*>& LayerTreeImpl::LayersWithCopyOutputRequest() | 1315 const std::vector<LayerImpl*>& LayerTreeImpl::LayersWithCopyOutputRequest() |
1305 const { | 1316 const { |
1306 // Only the active tree needs to know about layers with copy requests, as | 1317 // Only the active tree needs to know about layers with copy requests, as |
1307 // they are aborted if not serviced during draw. | 1318 // they are aborted if not serviced during draw. |
1308 DCHECK(IsActiveTree()); | 1319 DCHECK(IsActiveTree()); |
1309 | 1320 |
1310 return layers_with_copy_output_request_; | 1321 return layers_with_copy_output_request_; |
1311 } | 1322 } |
1312 | 1323 |
1313 template <typename LayerType> | 1324 template <typename LayerType> |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1927 const gfx::BoxF& box, | 1938 const gfx::BoxF& box, |
1928 gfx::BoxF* bounds) const { | 1939 gfx::BoxF* bounds) const { |
1929 *bounds = gfx::BoxF(); | 1940 *bounds = gfx::BoxF(); |
1930 return layer_tree_host_impl_->animation_host() | 1941 return layer_tree_host_impl_->animation_host() |
1931 ? layer_tree_host_impl_->animation_host() | 1942 ? layer_tree_host_impl_->animation_host() |
1932 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) | 1943 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) |
1933 : true; | 1944 : true; |
1934 } | 1945 } |
1935 | 1946 |
1936 } // namespace cc | 1947 } // namespace cc |
OLD | NEW |