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