 Chromium Code Reviews
 Chromium Code Reviews Issue 2905533002:
  cc : Store surface layer ids on LayerTreeHost and push them at commit  (Closed)
    
  
    Issue 2905533002:
  cc : Store surface layer ids on LayerTreeHost and push them at commit  (Closed) 
  | 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_host.h" | 5 #include "cc/trees/layer_tree_host.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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 bool* content_is_suitable_for_gpu) { | 1085 bool* content_is_suitable_for_gpu) { | 
| 1086 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); | 1086 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); | 
| 1087 bool did_paint_content = false; | 1087 bool did_paint_content = false; | 
| 1088 for (const auto& layer : update_layer_list) { | 1088 for (const auto& layer : update_layer_list) { | 
| 1089 did_paint_content |= layer->Update(); | 1089 did_paint_content |= layer->Update(); | 
| 1090 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); | 1090 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); | 
| 1091 } | 1091 } | 
| 1092 return did_paint_content; | 1092 return did_paint_content; | 
| 1093 } | 1093 } | 
| 1094 | 1094 | 
| 1095 void LayerTreeHost::AddSurfaceLayerId(const SurfaceId& surface_id) { | |
| 1096 auto pos = std::find(surface_layer_ids_.begin(), surface_layer_ids_.end(), | |
| 1097 surface_id); | |
| 1098 if (pos == surface_layer_ids_.end()) { | |
| 1099 surface_layer_ids_.push_back(surface_id); | |
| 1100 needs_surface_ids_sync_ = true; | |
| 1101 } | |
| 1102 } | |
| 1103 | |
| 1104 void LayerTreeHost::RemoveSurfaceLayerId(const SurfaceId& surface_id) { | |
| 1105 auto pos = std::find(surface_layer_ids_.begin(), surface_layer_ids_.end(), | |
| 
enne (OOO)
2017/05/24 18:44:54
What about flat_set over vector, so you don't have
 
jaydasika
2017/05/24 21:39:54
Done.
 | |
| 1106 surface_id); | |
| 1107 if (pos != surface_layer_ids_.end()) { | |
| 1108 surface_layer_ids_.erase(pos); | |
| 1109 needs_surface_ids_sync_ = true; | |
| 1110 } | |
| 1111 } | |
| 1112 | |
| 1113 const std::vector<SurfaceId>& LayerTreeHost::SurfaceLayerIds() const { | |
| 1114 return surface_layer_ids_; | |
| 1115 } | |
| 1116 | |
| 1095 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) { | 1117 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) { | 
| 1096 layers_that_should_push_properties_.insert(layer); | 1118 layers_that_should_push_properties_.insert(layer); | 
| 1097 } | 1119 } | 
| 1098 | 1120 | 
| 1099 void LayerTreeHost::RemoveLayerShouldPushProperties(Layer* layer) { | 1121 void LayerTreeHost::RemoveLayerShouldPushProperties(Layer* layer) { | 
| 1100 layers_that_should_push_properties_.erase(layer); | 1122 layers_that_should_push_properties_.erase(layer); | 
| 1101 } | 1123 } | 
| 1102 | 1124 | 
| 1103 std::unordered_set<Layer*>& LayerTreeHost::LayersThatShouldPushProperties() { | 1125 std::unordered_set<Layer*>& LayerTreeHost::LayersThatShouldPushProperties() { | 
| 1104 return layers_that_should_push_properties_; | 1126 return layers_that_should_push_properties_; | 
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1485 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1507 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 
| 1486 for (auto* layer : *this) | 1508 for (auto* layer : *this) | 
| 1487 layer->SetNeedsDisplay(); | 1509 layer->SetNeedsDisplay(); | 
| 1488 } | 1510 } | 
| 1489 | 1511 | 
| 1490 void LayerTreeHost::SetHasCopyRequest(bool has_copy_request) { | 1512 void LayerTreeHost::SetHasCopyRequest(bool has_copy_request) { | 
| 1491 has_copy_request_ = has_copy_request; | 1513 has_copy_request_ = has_copy_request; | 
| 1492 } | 1514 } | 
| 1493 | 1515 | 
| 1494 } // namespace cc | 1516 } // namespace cc | 
| OLD | NEW |