| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.h" | 5 #include "cc/trees/layer_tree.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "cc/input/page_scale_animation.h" | 9 #include "cc/input/page_scale_animation.h" |
| 10 #include "cc/layers/heads_up_display_layer.h" | 10 #include "cc/layers/heads_up_display_layer.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 RemoveLayerShouldPushProperties(layer); | 235 RemoveLayerShouldPushProperties(layer); |
| 236 layer_id_map_.erase(layer->id()); | 236 layer_id_map_.erase(layer->id()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 Layer* LayerTree::LayerById(int id) const { | 239 Layer* LayerTree::LayerById(int id) const { |
| 240 LayerIdMap::const_iterator iter = layer_id_map_.find(id); | 240 LayerIdMap::const_iterator iter = layer_id_map_.find(id); |
| 241 return iter != layer_id_map_.end() ? iter->second : nullptr; | 241 return iter != layer_id_map_.end() ? iter->second : nullptr; |
| 242 } | 242 } |
| 243 | 243 |
| 244 size_t LayerTree::NumLayers() const { |
| 245 return layer_id_map_.size(); |
| 246 } |
| 247 |
| 244 bool LayerTree::UpdateLayers(const LayerList& update_layer_list, | 248 bool LayerTree::UpdateLayers(const LayerList& update_layer_list, |
| 245 bool* content_is_suitable_for_gpu) { | 249 bool* content_is_suitable_for_gpu) { |
| 246 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); | 250 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); |
| 247 bool did_paint_content = false; | 251 bool did_paint_content = false; |
| 248 for (const auto& layer : update_layer_list) { | 252 for (const auto& layer : update_layer_list) { |
| 249 did_paint_content |= layer->Update(); | 253 did_paint_content |= layer->Update(); |
| 250 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); | 254 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); |
| 251 } | 255 } |
| 252 return did_paint_content; | 256 return did_paint_content; |
| 253 } | 257 } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 LayerListReverseIterator<Layer> LayerTree::rend() { | 583 LayerListReverseIterator<Layer> LayerTree::rend() { |
| 580 return LayerListReverseIterator<Layer>(nullptr); | 584 return LayerListReverseIterator<Layer>(nullptr); |
| 581 } | 585 } |
| 582 | 586 |
| 583 void LayerTree::SetNeedsDisplayOnAllLayers() { | 587 void LayerTree::SetNeedsDisplayOnAllLayers() { |
| 584 for (auto* layer : *this) | 588 for (auto* layer : *this) |
| 585 layer->SetNeedsDisplay(); | 589 layer->SetNeedsDisplay(); |
| 586 } | 590 } |
| 587 | 591 |
| 588 } // namespace cc | 592 } // namespace cc |
| OLD | NEW |