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_settings.h" | 5 #include "cc/trees/layer_tree_settings.h" |
6 | 6 |
7 #include "cc/proto/gfx_conversions.h" | 7 #include "cc/proto/gfx_conversions.h" |
8 #include "cc/proto/layer_tree_settings.pb.h" | 8 #include "cc/proto/layer_tree_settings.pb.h" |
9 #include "third_party/khronos/GLES2/gl2.h" | 9 #include "third_party/khronos/GLES2/gl2.h" |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 return LayerTreeSettings::ScrollbarAnimator::NO_ANIMATOR; | 44 return LayerTreeSettings::ScrollbarAnimator::NO_ANIMATOR; |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 LayerTreeSettings::LayerTreeSettings() | 49 LayerTreeSettings::LayerTreeSettings() |
50 : default_tile_size(gfx::Size(256, 256)), | 50 : default_tile_size(gfx::Size(256, 256)), |
51 max_untiled_layer_size(gfx::Size(512, 512)), | 51 max_untiled_layer_size(gfx::Size(512, 512)), |
52 minimum_occlusion_tracking_size(gfx::Size(160, 160)), | 52 minimum_occlusion_tracking_size(gfx::Size(160, 160)), |
53 use_image_texture_targets( | |
54 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, | |
55 GL_TEXTURE_2D), | |
56 memory_policy_(64 * 1024 * 1024, | 53 memory_policy_(64 * 1024 * 1024, |
57 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 54 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
58 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} | 55 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} |
59 | 56 |
60 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default; | 57 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default; |
61 LayerTreeSettings::~LayerTreeSettings() = default; | 58 LayerTreeSettings::~LayerTreeSettings() = default; |
62 | 59 |
63 bool LayerTreeSettings::operator==(const LayerTreeSettings& other) const { | 60 bool LayerTreeSettings::operator==(const LayerTreeSettings& other) const { |
64 return renderer_settings == other.renderer_settings && | 61 return renderer_settings == other.renderer_settings && |
65 single_thread_proxy_scheduler == other.single_thread_proxy_scheduler && | 62 single_thread_proxy_scheduler == other.single_thread_proxy_scheduler && |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 tiling_interest_area_padding == other.tiling_interest_area_padding && | 98 tiling_interest_area_padding == other.tiling_interest_area_padding && |
102 skewport_target_time_in_seconds == | 99 skewport_target_time_in_seconds == |
103 other.skewport_target_time_in_seconds && | 100 other.skewport_target_time_in_seconds && |
104 skewport_extrapolation_limit_in_screen_pixels == | 101 skewport_extrapolation_limit_in_screen_pixels == |
105 other.skewport_extrapolation_limit_in_screen_pixels && | 102 other.skewport_extrapolation_limit_in_screen_pixels && |
106 max_memory_for_prepaint_percentage == | 103 max_memory_for_prepaint_percentage == |
107 other.max_memory_for_prepaint_percentage && | 104 other.max_memory_for_prepaint_percentage && |
108 use_zero_copy == other.use_zero_copy && | 105 use_zero_copy == other.use_zero_copy && |
109 use_partial_raster == other.use_partial_raster && | 106 use_partial_raster == other.use_partial_raster && |
110 enable_elastic_overscroll == other.enable_elastic_overscroll && | 107 enable_elastic_overscroll == other.enable_elastic_overscroll && |
111 use_image_texture_targets == other.use_image_texture_targets && | |
112 ignore_root_layer_flings == other.ignore_root_layer_flings && | 108 ignore_root_layer_flings == other.ignore_root_layer_flings && |
113 scheduled_raster_task_limit == other.scheduled_raster_task_limit && | 109 scheduled_raster_task_limit == other.scheduled_raster_task_limit && |
114 use_occlusion_for_tile_prioritization == | 110 use_occlusion_for_tile_prioritization == |
115 other.use_occlusion_for_tile_prioritization && | 111 other.use_occlusion_for_tile_prioritization && |
116 verify_clip_tree_calculations == other.verify_clip_tree_calculations && | 112 verify_clip_tree_calculations == other.verify_clip_tree_calculations && |
117 verify_transform_tree_calculations == | 113 verify_transform_tree_calculations == |
118 other.verify_transform_tree_calculations && | 114 other.verify_transform_tree_calculations && |
119 image_decode_tasks_enabled == other.image_decode_tasks_enabled && | 115 image_decode_tasks_enabled == other.image_decode_tasks_enabled && |
120 wait_for_beginframe_interval == other.wait_for_beginframe_interval && | 116 wait_for_beginframe_interval == other.wait_for_beginframe_interval && |
121 max_staging_buffer_usage_in_bytes == | 117 max_staging_buffer_usage_in_bytes == |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); | 171 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); |
176 proto->set_use_occlusion_for_tile_prioritization( | 172 proto->set_use_occlusion_for_tile_prioritization( |
177 use_occlusion_for_tile_prioritization); | 173 use_occlusion_for_tile_prioritization); |
178 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); | 174 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); |
179 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); | 175 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); |
180 proto->set_max_staging_buffer_usage_in_bytes( | 176 proto->set_max_staging_buffer_usage_in_bytes( |
181 max_staging_buffer_usage_in_bytes); | 177 max_staging_buffer_usage_in_bytes); |
182 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); | 178 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); |
183 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); | 179 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); |
184 proto->set_use_cached_picture_raster(use_cached_picture_raster); | 180 proto->set_use_cached_picture_raster(use_cached_picture_raster); |
185 | |
186 for (unsigned u : use_image_texture_targets) | |
187 proto->add_use_image_texture_targets(u); | |
188 } | 181 } |
189 | 182 |
190 void LayerTreeSettings::FromProtobuf(const proto::LayerTreeSettings& proto) { | 183 void LayerTreeSettings::FromProtobuf(const proto::LayerTreeSettings& proto) { |
191 renderer_settings.FromProtobuf(proto.renderer_settings()); | 184 renderer_settings.FromProtobuf(proto.renderer_settings()); |
192 single_thread_proxy_scheduler = proto.single_thread_proxy_scheduler(); | 185 single_thread_proxy_scheduler = proto.single_thread_proxy_scheduler(); |
193 use_external_begin_frame_source = proto.use_external_begin_frame_source(); | 186 use_external_begin_frame_source = proto.use_external_begin_frame_source(); |
194 main_frame_before_activation_enabled = | 187 main_frame_before_activation_enabled = |
195 proto.main_frame_before_activation_enabled(); | 188 proto.main_frame_before_activation_enabled(); |
196 using_synchronous_renderer_compositor = | 189 using_synchronous_renderer_compositor = |
197 proto.using_synchronous_renderer_compositor(); | 190 proto.using_synchronous_renderer_compositor(); |
(...skipping 27 matching lines...) Expand all Loading... |
225 ProtoToSize(proto.minimum_occlusion_tracking_size()); | 218 ProtoToSize(proto.minimum_occlusion_tracking_size()); |
226 tiling_interest_area_padding = proto.tiling_interest_area_padding(); | 219 tiling_interest_area_padding = proto.tiling_interest_area_padding(); |
227 skewport_target_time_in_seconds = proto.skewport_target_time_in_seconds(); | 220 skewport_target_time_in_seconds = proto.skewport_target_time_in_seconds(); |
228 skewport_extrapolation_limit_in_screen_pixels = | 221 skewport_extrapolation_limit_in_screen_pixels = |
229 proto.skewport_extrapolation_limit_in_screen_pixels(); | 222 proto.skewport_extrapolation_limit_in_screen_pixels(); |
230 max_memory_for_prepaint_percentage = | 223 max_memory_for_prepaint_percentage = |
231 proto.max_memory_for_prepaint_percentage(); | 224 proto.max_memory_for_prepaint_percentage(); |
232 use_zero_copy = proto.use_zero_copy(); | 225 use_zero_copy = proto.use_zero_copy(); |
233 use_partial_raster = proto.use_partial_raster(); | 226 use_partial_raster = proto.use_partial_raster(); |
234 enable_elastic_overscroll = proto.enable_elastic_overscroll(); | 227 enable_elastic_overscroll = proto.enable_elastic_overscroll(); |
235 // |use_image_texture_targets| contains default values, so clear first. | |
236 use_image_texture_targets.clear(); | |
237 ignore_root_layer_flings = proto.ignore_root_layer_flings(); | 228 ignore_root_layer_flings = proto.ignore_root_layer_flings(); |
238 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); | 229 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); |
239 use_occlusion_for_tile_prioritization = | 230 use_occlusion_for_tile_prioritization = |
240 proto.use_occlusion_for_tile_prioritization(); | 231 proto.use_occlusion_for_tile_prioritization(); |
241 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); | 232 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); |
242 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); | 233 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); |
243 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); | 234 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); |
244 memory_policy_.FromProtobuf(proto.memory_policy()); | 235 memory_policy_.FromProtobuf(proto.memory_policy()); |
245 initial_debug_state.FromProtobuf(proto.initial_debug_state()); | 236 initial_debug_state.FromProtobuf(proto.initial_debug_state()); |
246 use_cached_picture_raster = proto.use_cached_picture_raster(); | 237 use_cached_picture_raster = proto.use_cached_picture_raster(); |
247 | |
248 for (int i = 0; i < proto.use_image_texture_targets_size(); ++i) | |
249 use_image_texture_targets.push_back(proto.use_image_texture_targets(i)); | |
250 } | 238 } |
251 | 239 |
252 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { | 240 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { |
253 SchedulerSettings scheduler_settings; | 241 SchedulerSettings scheduler_settings; |
254 scheduler_settings.use_external_begin_frame_source = | 242 scheduler_settings.use_external_begin_frame_source = |
255 use_external_begin_frame_source; | 243 use_external_begin_frame_source; |
256 scheduler_settings.main_frame_before_activation_enabled = | 244 scheduler_settings.main_frame_before_activation_enabled = |
257 main_frame_before_activation_enabled; | 245 main_frame_before_activation_enabled; |
258 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 246 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
259 timeout_and_draw_when_animation_checkerboards; | 247 timeout_and_draw_when_animation_checkerboards; |
260 scheduler_settings.using_synchronous_renderer_compositor = | 248 scheduler_settings.using_synchronous_renderer_compositor = |
261 using_synchronous_renderer_compositor; | 249 using_synchronous_renderer_compositor; |
262 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; | 250 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; |
263 scheduler_settings.background_frame_interval = | 251 scheduler_settings.background_frame_interval = |
264 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); | 252 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); |
265 scheduler_settings.abort_commit_before_output_surface_creation = | 253 scheduler_settings.abort_commit_before_output_surface_creation = |
266 abort_commit_before_output_surface_creation; | 254 abort_commit_before_output_surface_creation; |
267 return scheduler_settings; | 255 return scheduler_settings; |
268 } | 256 } |
269 | 257 |
270 } // namespace cc | 258 } // namespace cc |
OLD | NEW |