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 <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 use_zero_copy(false), | 92 use_zero_copy(false), |
93 use_partial_raster(false), | 93 use_partial_raster(false), |
94 enable_elastic_overscroll(false), | 94 enable_elastic_overscroll(false), |
95 use_image_texture_targets( | 95 use_image_texture_targets( |
96 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, | 96 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, |
97 GL_TEXTURE_2D), | 97 GL_TEXTURE_2D), |
98 ignore_root_layer_flings(false), | 98 ignore_root_layer_flings(false), |
99 scheduled_raster_task_limit(32), | 99 scheduled_raster_task_limit(32), |
100 use_occlusion_for_tile_prioritization(false), | 100 use_occlusion_for_tile_prioritization(false), |
101 image_decode_tasks_enabled(false), | 101 image_decode_tasks_enabled(false), |
102 use_compositor_animation_timelines(true), | |
103 wait_for_beginframe_interval(true), | 102 wait_for_beginframe_interval(true), |
104 abort_commit_before_output_surface_creation(true), | 103 abort_commit_before_output_surface_creation(true), |
105 use_mouse_wheel_gestures(false), | 104 use_mouse_wheel_gestures(false), |
106 max_staging_buffer_usage_in_bytes(32 * 1024 * 1024), | 105 max_staging_buffer_usage_in_bytes(32 * 1024 * 1024), |
107 memory_policy_(64 * 1024 * 1024, | 106 memory_policy_(64 * 1024 * 1024, |
108 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 107 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
109 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} | 108 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} |
110 | 109 |
111 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default; | 110 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default; |
112 | 111 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 other.strict_layer_property_change_checking && | 160 other.strict_layer_property_change_checking && |
162 use_zero_copy == other.use_zero_copy && | 161 use_zero_copy == other.use_zero_copy && |
163 use_partial_raster == other.use_partial_raster && | 162 use_partial_raster == other.use_partial_raster && |
164 enable_elastic_overscroll == other.enable_elastic_overscroll && | 163 enable_elastic_overscroll == other.enable_elastic_overscroll && |
165 use_image_texture_targets == other.use_image_texture_targets && | 164 use_image_texture_targets == other.use_image_texture_targets && |
166 ignore_root_layer_flings == other.ignore_root_layer_flings && | 165 ignore_root_layer_flings == other.ignore_root_layer_flings && |
167 scheduled_raster_task_limit == other.scheduled_raster_task_limit && | 166 scheduled_raster_task_limit == other.scheduled_raster_task_limit && |
168 use_occlusion_for_tile_prioritization == | 167 use_occlusion_for_tile_prioritization == |
169 other.use_occlusion_for_tile_prioritization && | 168 other.use_occlusion_for_tile_prioritization && |
170 image_decode_tasks_enabled == other.image_decode_tasks_enabled && | 169 image_decode_tasks_enabled == other.image_decode_tasks_enabled && |
171 use_compositor_animation_timelines == | |
172 other.use_compositor_animation_timelines && | |
173 wait_for_beginframe_interval == other.wait_for_beginframe_interval && | 170 wait_for_beginframe_interval == other.wait_for_beginframe_interval && |
174 use_mouse_wheel_gestures == other.use_mouse_wheel_gestures && | 171 use_mouse_wheel_gestures == other.use_mouse_wheel_gestures && |
175 max_staging_buffer_usage_in_bytes == | 172 max_staging_buffer_usage_in_bytes == |
176 other.max_staging_buffer_usage_in_bytes && | 173 other.max_staging_buffer_usage_in_bytes && |
177 memory_policy_ == other.memory_policy_ && | 174 memory_policy_ == other.memory_policy_ && |
178 LayerTreeDebugState::Equal(initial_debug_state, | 175 LayerTreeDebugState::Equal(initial_debug_state, |
179 other.initial_debug_state); | 176 other.initial_debug_state); |
180 } | 177 } |
181 | 178 |
182 void LayerTreeSettings::ToProtobuf(proto::LayerTreeSettings* proto) const { | 179 void LayerTreeSettings::ToProtobuf(proto::LayerTreeSettings* proto) const { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 proto->set_strict_layer_property_change_checking( | 221 proto->set_strict_layer_property_change_checking( |
225 strict_layer_property_change_checking); | 222 strict_layer_property_change_checking); |
226 proto->set_use_zero_copy(use_zero_copy); | 223 proto->set_use_zero_copy(use_zero_copy); |
227 proto->set_use_partial_raster(use_partial_raster); | 224 proto->set_use_partial_raster(use_partial_raster); |
228 proto->set_enable_elastic_overscroll(enable_elastic_overscroll); | 225 proto->set_enable_elastic_overscroll(enable_elastic_overscroll); |
229 proto->set_ignore_root_layer_flings(ignore_root_layer_flings); | 226 proto->set_ignore_root_layer_flings(ignore_root_layer_flings); |
230 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); | 227 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); |
231 proto->set_use_occlusion_for_tile_prioritization( | 228 proto->set_use_occlusion_for_tile_prioritization( |
232 use_occlusion_for_tile_prioritization); | 229 use_occlusion_for_tile_prioritization); |
233 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); | 230 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); |
234 proto->set_use_compositor_animation_timelines( | |
235 use_compositor_animation_timelines); | |
236 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); | 231 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); |
237 proto->set_use_mouse_wheel_gestures(use_mouse_wheel_gestures); | 232 proto->set_use_mouse_wheel_gestures(use_mouse_wheel_gestures); |
238 proto->set_max_staging_buffer_usage_in_bytes( | 233 proto->set_max_staging_buffer_usage_in_bytes( |
239 max_staging_buffer_usage_in_bytes); | 234 max_staging_buffer_usage_in_bytes); |
240 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); | 235 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); |
241 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); | 236 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); |
242 | 237 |
243 for (unsigned u : use_image_texture_targets) | 238 for (unsigned u : use_image_texture_targets) |
244 proto->add_use_image_texture_targets(u); | 239 proto->add_use_image_texture_targets(u); |
245 } | 240 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 use_zero_copy = proto.use_zero_copy(); | 286 use_zero_copy = proto.use_zero_copy(); |
292 use_partial_raster = proto.use_partial_raster(); | 287 use_partial_raster = proto.use_partial_raster(); |
293 enable_elastic_overscroll = proto.enable_elastic_overscroll(); | 288 enable_elastic_overscroll = proto.enable_elastic_overscroll(); |
294 // |use_image_texture_targets| contains default values, so clear first. | 289 // |use_image_texture_targets| contains default values, so clear first. |
295 use_image_texture_targets.clear(); | 290 use_image_texture_targets.clear(); |
296 ignore_root_layer_flings = proto.ignore_root_layer_flings(); | 291 ignore_root_layer_flings = proto.ignore_root_layer_flings(); |
297 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); | 292 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); |
298 use_occlusion_for_tile_prioritization = | 293 use_occlusion_for_tile_prioritization = |
299 proto.use_occlusion_for_tile_prioritization(); | 294 proto.use_occlusion_for_tile_prioritization(); |
300 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); | 295 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); |
301 use_compositor_animation_timelines = | |
302 proto.use_compositor_animation_timelines(); | |
303 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); | 296 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); |
304 use_mouse_wheel_gestures = proto.use_mouse_wheel_gestures(); | 297 use_mouse_wheel_gestures = proto.use_mouse_wheel_gestures(); |
305 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); | 298 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); |
306 memory_policy_.FromProtobuf(proto.memory_policy()); | 299 memory_policy_.FromProtobuf(proto.memory_policy()); |
307 initial_debug_state.FromProtobuf(proto.initial_debug_state()); | 300 initial_debug_state.FromProtobuf(proto.initial_debug_state()); |
308 | 301 |
309 for (int i = 0; i < proto.use_image_texture_targets_size(); ++i) | 302 for (int i = 0; i < proto.use_image_texture_targets_size(); ++i) |
310 use_image_texture_targets.push_back(proto.use_image_texture_targets(i)); | 303 use_image_texture_targets.push_back(proto.use_image_texture_targets(i)); |
311 } | 304 } |
312 | 305 |
313 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { | 306 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { |
314 SchedulerSettings scheduler_settings; | 307 SchedulerSettings scheduler_settings; |
315 scheduler_settings.use_external_begin_frame_source = | 308 scheduler_settings.use_external_begin_frame_source = |
316 use_external_begin_frame_source; | 309 use_external_begin_frame_source; |
317 scheduler_settings.main_frame_before_activation_enabled = | 310 scheduler_settings.main_frame_before_activation_enabled = |
318 main_frame_before_activation_enabled; | 311 main_frame_before_activation_enabled; |
319 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 312 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
320 timeout_and_draw_when_animation_checkerboards; | 313 timeout_and_draw_when_animation_checkerboards; |
321 scheduler_settings.using_synchronous_renderer_compositor = | 314 scheduler_settings.using_synchronous_renderer_compositor = |
322 using_synchronous_renderer_compositor; | 315 using_synchronous_renderer_compositor; |
323 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; | 316 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; |
324 scheduler_settings.background_frame_interval = | 317 scheduler_settings.background_frame_interval = |
325 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); | 318 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); |
326 scheduler_settings.abort_commit_before_output_surface_creation = | 319 scheduler_settings.abort_commit_before_output_surface_creation = |
327 abort_commit_before_output_surface_creation; | 320 abort_commit_before_output_surface_creation; |
328 return scheduler_settings; | 321 return scheduler_settings; |
329 } | 322 } |
330 | 323 |
331 } // namespace cc | 324 } // namespace cc |
OLD | NEW |