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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 : micro_benchmark_controller_(this), | 97 : micro_benchmark_controller_(this), |
98 image_worker_task_runner_(params->image_worker_task_runner), | 98 image_worker_task_runner_(params->image_worker_task_runner), |
99 compositor_mode_(mode), | 99 compositor_mode_(mode), |
100 ui_resource_manager_(base::MakeUnique<UIResourceManager>()), | 100 ui_resource_manager_(base::MakeUnique<UIResourceManager>()), |
101 client_(params->client), | 101 client_(params->client), |
102 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 102 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
103 settings_(*params->settings), | 103 settings_(*params->settings), |
104 debug_state_(settings_.initial_debug_state), | 104 debug_state_(settings_.initial_debug_state), |
105 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 105 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
106 task_graph_runner_(params->task_graph_runner), | 106 task_graph_runner_(params->task_graph_runner), |
| 107 content_source_id_(0), |
107 event_listener_properties_(), | 108 event_listener_properties_(), |
108 mutator_host_(params->mutator_host) { | 109 mutator_host_(params->mutator_host) { |
109 DCHECK(task_graph_runner_); | 110 DCHECK(task_graph_runner_); |
110 DCHECK(!settings_.enable_checker_imaging || image_worker_task_runner_); | 111 DCHECK(!settings_.enable_checker_imaging || image_worker_task_runner_); |
111 DCHECK(!settings_.enable_checker_imaging || | 112 DCHECK(!settings_.enable_checker_imaging || |
112 settings_.image_decode_tasks_enabled); | 113 settings_.image_decode_tasks_enabled); |
113 | 114 |
114 mutator_host_->SetMutatorHostClient(this); | 115 mutator_host_->SetMutatorHostClient(this); |
115 | 116 |
116 rendering_stats_instrumentation_->set_record_rendering_stats( | 117 rendering_stats_instrumentation_->set_record_rendering_stats( |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 966 |
966 void LayerTreeHost::SetDeviceColorSpace( | 967 void LayerTreeHost::SetDeviceColorSpace( |
967 const gfx::ColorSpace& device_color_space) { | 968 const gfx::ColorSpace& device_color_space) { |
968 if (device_color_space_ == device_color_space) | 969 if (device_color_space_ == device_color_space) |
969 return; | 970 return; |
970 device_color_space_ = device_color_space; | 971 device_color_space_ = device_color_space; |
971 LayerTreeHostCommon::CallFunctionForEveryLayer( | 972 LayerTreeHostCommon::CallFunctionForEveryLayer( |
972 this, [](Layer* layer) { layer->SetNeedsDisplay(); }); | 973 this, [](Layer* layer) { layer->SetNeedsDisplay(); }); |
973 } | 974 } |
974 | 975 |
| 976 void LayerTreeHost::SetContentSourceId(uint32_t id) { |
| 977 if (content_source_id_ == id) |
| 978 return; |
| 979 content_source_id_ = id; |
| 980 SetNeedsCommit(); |
| 981 } |
| 982 |
975 void LayerTreeHost::RegisterLayer(Layer* layer) { | 983 void LayerTreeHost::RegisterLayer(Layer* layer) { |
976 DCHECK(!LayerById(layer->id())); | 984 DCHECK(!LayerById(layer->id())); |
977 DCHECK(!in_paint_layer_contents_); | 985 DCHECK(!in_paint_layer_contents_); |
978 layer_id_map_[layer->id()] = layer; | 986 layer_id_map_[layer->id()] = layer; |
979 if (layer->element_id()) { | 987 if (layer->element_id()) { |
980 mutator_host_->RegisterElement(layer->element_id(), | 988 mutator_host_->RegisterElement(layer->element_id(), |
981 ElementListType::ACTIVE); | 989 ElementListType::ACTIVE); |
982 } | 990 } |
983 } | 991 } |
984 | 992 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 tree_impl->set_bottom_controls_height(bottom_controls_height_); | 1143 tree_impl->set_bottom_controls_height(bottom_controls_height_); |
1136 tree_impl->PushBrowserControlsFromMainThread(top_controls_shown_ratio_); | 1144 tree_impl->PushBrowserControlsFromMainThread(top_controls_shown_ratio_); |
1137 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); | 1145 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); |
1138 if (tree_impl->IsActiveTree()) | 1146 if (tree_impl->IsActiveTree()) |
1139 tree_impl->elastic_overscroll()->PushPendingToActive(); | 1147 tree_impl->elastic_overscroll()->PushPendingToActive(); |
1140 | 1148 |
1141 tree_impl->set_painted_device_scale_factor(painted_device_scale_factor_); | 1149 tree_impl->set_painted_device_scale_factor(painted_device_scale_factor_); |
1142 | 1150 |
1143 tree_impl->SetDeviceColorSpace(device_color_space_); | 1151 tree_impl->SetDeviceColorSpace(device_color_space_); |
1144 | 1152 |
| 1153 tree_impl->set_content_source_id(content_source_id_); |
| 1154 |
1145 if (pending_page_scale_animation_) { | 1155 if (pending_page_scale_animation_) { |
1146 tree_impl->SetPendingPageScaleAnimation( | 1156 tree_impl->SetPendingPageScaleAnimation( |
1147 std::move(pending_page_scale_animation_)); | 1157 std::move(pending_page_scale_animation_)); |
1148 } | 1158 } |
1149 | 1159 |
1150 DCHECK(!tree_impl->ViewportSizeInvalid()); | 1160 DCHECK(!tree_impl->ViewportSizeInvalid()); |
1151 | 1161 |
1152 tree_impl->set_has_ever_been_drawn(false); | 1162 tree_impl->set_has_ever_been_drawn(false); |
1153 } | 1163 } |
1154 | 1164 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 LayerListReverseIterator<Layer> LayerTreeHost::rend() { | 1318 LayerListReverseIterator<Layer> LayerTreeHost::rend() { |
1309 return LayerListReverseIterator<Layer>(nullptr); | 1319 return LayerListReverseIterator<Layer>(nullptr); |
1310 } | 1320 } |
1311 | 1321 |
1312 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1322 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
1313 for (auto* layer : *this) | 1323 for (auto* layer : *this) |
1314 layer->SetNeedsDisplay(); | 1324 layer->SetNeedsDisplay(); |
1315 } | 1325 } |
1316 | 1326 |
1317 } // namespace cc | 1327 } // namespace cc |
OLD | NEW |