| 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/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
| 10 #include "cc/input/page_scale_animation.h" | 10 #include "cc/input/page_scale_animation.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 RemoveLayerShouldPushProperties(layer); | 258 RemoveLayerShouldPushProperties(layer); |
| 259 layer_id_map_.erase(layer->id()); | 259 layer_id_map_.erase(layer->id()); |
| 260 } | 260 } |
| 261 | 261 |
| 262 Layer* LayerTree::LayerById(int id) const { | 262 Layer* LayerTree::LayerById(int id) const { |
| 263 LayerIdMap::const_iterator iter = layer_id_map_.find(id); | 263 LayerIdMap::const_iterator iter = layer_id_map_.find(id); |
| 264 return iter != layer_id_map_.end() ? iter->second : nullptr; | 264 return iter != layer_id_map_.end() ? iter->second : nullptr; |
| 265 } | 265 } |
| 266 | 266 |
| 267 size_t LayerTree::NumLayers() const { |
| 268 return layer_id_map_.size(); |
| 269 } |
| 270 |
| 267 bool LayerTree::UpdateLayers(const LayerList& update_layer_list, | 271 bool LayerTree::UpdateLayers(const LayerList& update_layer_list, |
| 268 bool* content_is_suitable_for_gpu) { | 272 bool* content_is_suitable_for_gpu) { |
| 269 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); | 273 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); |
| 270 bool did_paint_content = false; | 274 bool did_paint_content = false; |
| 271 for (const auto& layer : update_layer_list) { | 275 for (const auto& layer : update_layer_list) { |
| 272 did_paint_content |= layer->Update(); | 276 did_paint_content |= layer->Update(); |
| 273 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); | 277 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); |
| 274 } | 278 } |
| 275 return did_paint_content; | 279 return did_paint_content; |
| 276 } | 280 } |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 LayerListReverseIterator<Layer> LayerTree::rend() { | 695 LayerListReverseIterator<Layer> LayerTree::rend() { |
| 692 return LayerListReverseIterator<Layer>(nullptr); | 696 return LayerListReverseIterator<Layer>(nullptr); |
| 693 } | 697 } |
| 694 | 698 |
| 695 void LayerTree::SetNeedsDisplayOnAllLayers() { | 699 void LayerTree::SetNeedsDisplayOnAllLayers() { |
| 696 for (auto* layer : *this) | 700 for (auto* layer : *this) |
| 697 layer->SetNeedsDisplay(); | 701 layer->SetNeedsDisplay(); |
| 698 } | 702 } |
| 699 | 703 |
| 700 } // namespace cc | 704 } // namespace cc |
| OLD | NEW |