| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode) | 94 LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode) |
| 95 : micro_benchmark_controller_(this), | 95 : micro_benchmark_controller_(this), |
| 96 compositor_mode_(mode), | 96 compositor_mode_(mode), |
| 97 ui_resource_manager_(base::MakeUnique<UIResourceManager>()), | 97 ui_resource_manager_(base::MakeUnique<UIResourceManager>()), |
| 98 client_(params->client), | 98 client_(params->client), |
| 99 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 99 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
| 100 settings_(*params->settings), | 100 settings_(*params->settings), |
| 101 debug_state_(settings_.initial_debug_state), | 101 debug_state_(settings_.initial_debug_state), |
| 102 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 102 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
| 103 task_graph_runner_(params->task_graph_runner), | 103 task_graph_runner_(params->task_graph_runner), |
| 104 content_source_id_(0), |
| 104 event_listener_properties_(), | 105 event_listener_properties_(), |
| 105 mutator_host_(params->mutator_host), | 106 mutator_host_(params->mutator_host), |
| 106 image_worker_task_runner_(params->image_worker_task_runner) { | 107 image_worker_task_runner_(params->image_worker_task_runner) { |
| 107 DCHECK(task_graph_runner_); | 108 DCHECK(task_graph_runner_); |
| 108 | 109 |
| 109 mutator_host_->SetMutatorHostClient(this); | 110 mutator_host_->SetMutatorHostClient(this); |
| 110 | 111 |
| 111 rendering_stats_instrumentation_->set_record_rendering_stats( | 112 rendering_stats_instrumentation_->set_record_rendering_stats( |
| 112 debug_state_.RecordRenderingStats()); | 113 debug_state_.RecordRenderingStats()); |
| 113 } | 114 } |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 955 |
| 955 void LayerTreeHost::SetDeviceColorSpace( | 956 void LayerTreeHost::SetDeviceColorSpace( |
| 956 const gfx::ColorSpace& device_color_space) { | 957 const gfx::ColorSpace& device_color_space) { |
| 957 if (device_color_space_ == device_color_space) | 958 if (device_color_space_ == device_color_space) |
| 958 return; | 959 return; |
| 959 device_color_space_ = device_color_space; | 960 device_color_space_ = device_color_space; |
| 960 LayerTreeHostCommon::CallFunctionForEveryLayer( | 961 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 961 this, [](Layer* layer) { layer->SetNeedsDisplay(); }); | 962 this, [](Layer* layer) { layer->SetNeedsDisplay(); }); |
| 962 } | 963 } |
| 963 | 964 |
| 965 void LayerTreeHost::SetContentSourceId(uint32_t id) { |
| 966 if (content_source_id_ == id) |
| 967 return; |
| 968 content_source_id_ = id; |
| 969 SetNeedsCommit(); |
| 970 } |
| 971 |
| 964 void LayerTreeHost::RegisterLayer(Layer* layer) { | 972 void LayerTreeHost::RegisterLayer(Layer* layer) { |
| 965 DCHECK(!LayerById(layer->id())); | 973 DCHECK(!LayerById(layer->id())); |
| 966 DCHECK(!in_paint_layer_contents_); | 974 DCHECK(!in_paint_layer_contents_); |
| 967 layer_id_map_[layer->id()] = layer; | 975 layer_id_map_[layer->id()] = layer; |
| 968 if (layer->element_id()) { | 976 if (layer->element_id()) { |
| 969 mutator_host_->RegisterElement(layer->element_id(), | 977 mutator_host_->RegisterElement(layer->element_id(), |
| 970 ElementListType::ACTIVE); | 978 ElementListType::ACTIVE); |
| 971 } | 979 } |
| 972 } | 980 } |
| 973 | 981 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 tree_impl->set_bottom_controls_height(bottom_controls_height_); | 1132 tree_impl->set_bottom_controls_height(bottom_controls_height_); |
| 1125 tree_impl->PushBrowserControlsFromMainThread(top_controls_shown_ratio_); | 1133 tree_impl->PushBrowserControlsFromMainThread(top_controls_shown_ratio_); |
| 1126 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); | 1134 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); |
| 1127 if (tree_impl->IsActiveTree()) | 1135 if (tree_impl->IsActiveTree()) |
| 1128 tree_impl->elastic_overscroll()->PushPendingToActive(); | 1136 tree_impl->elastic_overscroll()->PushPendingToActive(); |
| 1129 | 1137 |
| 1130 tree_impl->set_painted_device_scale_factor(painted_device_scale_factor_); | 1138 tree_impl->set_painted_device_scale_factor(painted_device_scale_factor_); |
| 1131 | 1139 |
| 1132 tree_impl->SetDeviceColorSpace(device_color_space_); | 1140 tree_impl->SetDeviceColorSpace(device_color_space_); |
| 1133 | 1141 |
| 1142 tree_impl->set_content_source_id(content_source_id_); |
| 1143 |
| 1134 if (pending_page_scale_animation_) { | 1144 if (pending_page_scale_animation_) { |
| 1135 tree_impl->SetPendingPageScaleAnimation( | 1145 tree_impl->SetPendingPageScaleAnimation( |
| 1136 std::move(pending_page_scale_animation_)); | 1146 std::move(pending_page_scale_animation_)); |
| 1137 } | 1147 } |
| 1138 | 1148 |
| 1139 DCHECK(!tree_impl->ViewportSizeInvalid()); | 1149 DCHECK(!tree_impl->ViewportSizeInvalid()); |
| 1140 | 1150 |
| 1141 tree_impl->set_has_ever_been_drawn(false); | 1151 tree_impl->set_has_ever_been_drawn(false); |
| 1142 } | 1152 } |
| 1143 | 1153 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 LayerListReverseIterator<Layer> LayerTreeHost::rend() { | 1273 LayerListReverseIterator<Layer> LayerTreeHost::rend() { |
| 1264 return LayerListReverseIterator<Layer>(nullptr); | 1274 return LayerListReverseIterator<Layer>(nullptr); |
| 1265 } | 1275 } |
| 1266 | 1276 |
| 1267 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1277 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
| 1268 for (auto* layer : *this) | 1278 for (auto* layer : *this) |
| 1269 layer->SetNeedsDisplay(); | 1279 layer->SetNeedsDisplay(); |
| 1270 } | 1280 } |
| 1271 | 1281 |
| 1272 } // namespace cc | 1282 } // namespace cc |
| OLD | NEW |