| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 bool did_navigate = content_source_id_ != sync_tree->content_source_id(); | 310 bool did_navigate = content_source_id_ != sync_tree->content_source_id(); |
| 311 if (did_navigate) | 311 if (did_navigate) |
| 312 host_impl->ClearImageCacheOnNavigation(); | 312 host_impl->ClearImageCacheOnNavigation(); |
| 313 | 313 |
| 314 { | 314 { |
| 315 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); | 315 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); |
| 316 | 316 |
| 317 PushPropertyTreesTo(sync_tree); | 317 PushPropertyTreesTo(sync_tree); |
| 318 sync_tree->lifecycle().AdvanceTo(LayerTreeLifecycle::kSyncedPropertyTrees); | 318 sync_tree->lifecycle().AdvanceTo(LayerTreeLifecycle::kSyncedPropertyTrees); |
| 319 | 319 |
| 320 PushSurfaceIdsTo(sync_tree); |
| 320 TreeSynchronizer::PushLayerProperties(this, sync_tree); | 321 TreeSynchronizer::PushLayerProperties(this, sync_tree); |
| 321 sync_tree->lifecycle().AdvanceTo( | 322 sync_tree->lifecycle().AdvanceTo( |
| 322 LayerTreeLifecycle::kSyncedLayerProperties); | 323 LayerTreeLifecycle::kSyncedLayerProperties); |
| 323 | 324 |
| 324 PushLayerTreePropertiesTo(sync_tree); | 325 PushLayerTreePropertiesTo(sync_tree); |
| 325 PushLayerTreeHostPropertiesTo(host_impl); | 326 PushLayerTreeHostPropertiesTo(host_impl); |
| 326 | 327 |
| 327 sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises()); | 328 sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises()); |
| 328 | 329 |
| 329 // TODO(pdr): Move this into PushPropertyTreesTo or introduce a lifecycle | 330 // TODO(pdr): Move this into PushPropertyTreesTo or introduce a lifecycle |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 bool* content_is_suitable_for_gpu) { | 1086 bool* content_is_suitable_for_gpu) { |
| 1086 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); | 1087 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); |
| 1087 bool did_paint_content = false; | 1088 bool did_paint_content = false; |
| 1088 for (const auto& layer : update_layer_list) { | 1089 for (const auto& layer : update_layer_list) { |
| 1089 did_paint_content |= layer->Update(); | 1090 did_paint_content |= layer->Update(); |
| 1090 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); | 1091 *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); |
| 1091 } | 1092 } |
| 1092 return did_paint_content; | 1093 return did_paint_content; |
| 1093 } | 1094 } |
| 1094 | 1095 |
| 1096 void LayerTreeHost::AddSurfaceLayerId(const SurfaceId& surface_id) { |
| 1097 surface_layer_ids_.insert(surface_id); |
| 1098 needs_surface_ids_sync_ = true; |
| 1099 } |
| 1100 |
| 1101 void LayerTreeHost::RemoveSurfaceLayerId(const SurfaceId& surface_id) { |
| 1102 surface_layer_ids_.erase(surface_id); |
| 1103 needs_surface_ids_sync_ = true; |
| 1104 } |
| 1105 |
| 1106 const base::flat_set<SurfaceId>& LayerTreeHost::SurfaceLayerIds() const { |
| 1107 return surface_layer_ids_; |
| 1108 } |
| 1109 |
| 1095 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) { | 1110 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) { |
| 1096 layers_that_should_push_properties_.insert(layer); | 1111 layers_that_should_push_properties_.insert(layer); |
| 1097 } | 1112 } |
| 1098 | 1113 |
| 1099 void LayerTreeHost::RemoveLayerShouldPushProperties(Layer* layer) { | 1114 void LayerTreeHost::RemoveLayerShouldPushProperties(Layer* layer) { |
| 1100 layers_that_should_push_properties_.erase(layer); | 1115 layers_that_should_push_properties_.erase(layer); |
| 1101 } | 1116 } |
| 1102 | 1117 |
| 1103 std::unordered_set<Layer*>& LayerTreeHost::LayersThatShouldPushProperties() { | 1118 std::unordered_set<Layer*>& LayerTreeHost::LayersThatShouldPushProperties() { |
| 1104 return layers_that_should_push_properties_; | 1119 return layers_that_should_push_properties_; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 if (pending_page_scale_animation_) { | 1231 if (pending_page_scale_animation_) { |
| 1217 tree_impl->SetPendingPageScaleAnimation( | 1232 tree_impl->SetPendingPageScaleAnimation( |
| 1218 std::move(pending_page_scale_animation_)); | 1233 std::move(pending_page_scale_animation_)); |
| 1219 } | 1234 } |
| 1220 | 1235 |
| 1221 DCHECK(!tree_impl->ViewportSizeInvalid()); | 1236 DCHECK(!tree_impl->ViewportSizeInvalid()); |
| 1222 | 1237 |
| 1223 tree_impl->set_has_ever_been_drawn(false); | 1238 tree_impl->set_has_ever_been_drawn(false); |
| 1224 } | 1239 } |
| 1225 | 1240 |
| 1241 void LayerTreeHost::PushSurfaceIdsTo(LayerTreeImpl* tree_impl) { |
| 1242 if (needs_surface_ids_sync()) { |
| 1243 tree_impl->ClearSurfaceLayerIds(); |
| 1244 tree_impl->SetSurfaceLayerIds(SurfaceLayerIds()); |
| 1245 // Reset for next update |
| 1246 set_needs_surface_ids_sync(false); |
| 1247 } |
| 1248 } |
| 1249 |
| 1226 void LayerTreeHost::PushLayerTreeHostPropertiesTo( | 1250 void LayerTreeHost::PushLayerTreeHostPropertiesTo( |
| 1227 LayerTreeHostImpl* host_impl) { | 1251 LayerTreeHostImpl* host_impl) { |
| 1228 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 1252 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
| 1229 host_impl->SetContentIsSuitableForGpuRasterization( | 1253 host_impl->SetContentIsSuitableForGpuRasterization( |
| 1230 content_is_suitable_for_gpu_rasterization_); | 1254 content_is_suitable_for_gpu_rasterization_); |
| 1231 RecordGpuRasterizationHistogram(host_impl); | 1255 RecordGpuRasterizationHistogram(host_impl); |
| 1232 | 1256 |
| 1233 host_impl->SetViewportSize(device_viewport_size_); | 1257 host_impl->SetViewportSize(device_viewport_size_); |
| 1234 host_impl->SetDebugState(debug_state_); | 1258 host_impl->SetDebugState(debug_state_); |
| 1235 } | 1259 } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1509 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
| 1486 for (auto* layer : *this) | 1510 for (auto* layer : *this) |
| 1487 layer->SetNeedsDisplay(); | 1511 layer->SetNeedsDisplay(); |
| 1488 } | 1512 } |
| 1489 | 1513 |
| 1490 void LayerTreeHost::SetHasCopyRequest(bool has_copy_request) { | 1514 void LayerTreeHost::SetHasCopyRequest(bool has_copy_request) { |
| 1491 has_copy_request_ = has_copy_request; | 1515 has_copy_request_ = has_copy_request; |
| 1492 } | 1516 } |
| 1493 | 1517 |
| 1494 } // namespace cc | 1518 } // namespace cc |
| OLD | NEW |