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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 verify_property_trees(false), | 101 verify_property_trees(false), |
102 use_property_trees(true), | 102 use_property_trees(true), |
103 image_decode_tasks_enabled(false), | 103 image_decode_tasks_enabled(false), |
104 use_compositor_animation_timelines(true), | 104 use_compositor_animation_timelines(true), |
105 wait_for_beginframe_interval(true), | 105 wait_for_beginframe_interval(true), |
| 106 use_mouse_wheel_gestures(false), |
106 max_staging_buffer_usage_in_bytes(32 * 1024 * 1024), | 107 max_staging_buffer_usage_in_bytes(32 * 1024 * 1024), |
107 memory_policy_(64 * 1024 * 1024, | 108 memory_policy_(64 * 1024 * 1024, |
108 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 109 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
109 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} | 110 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} |
110 | 111 |
111 LayerTreeSettings::~LayerTreeSettings() {} | 112 LayerTreeSettings::~LayerTreeSettings() {} |
112 | 113 |
113 bool LayerTreeSettings::operator==(const LayerTreeSettings& other) const { | 114 bool LayerTreeSettings::operator==(const LayerTreeSettings& other) const { |
114 return renderer_settings == other.renderer_settings && | 115 return renderer_settings == other.renderer_settings && |
115 single_thread_proxy_scheduler == other.single_thread_proxy_scheduler && | 116 single_thread_proxy_scheduler == other.single_thread_proxy_scheduler && |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ignore_root_layer_flings == other.ignore_root_layer_flings && | 165 ignore_root_layer_flings == other.ignore_root_layer_flings && |
165 scheduled_raster_task_limit == other.scheduled_raster_task_limit && | 166 scheduled_raster_task_limit == other.scheduled_raster_task_limit && |
166 use_occlusion_for_tile_prioritization == | 167 use_occlusion_for_tile_prioritization == |
167 other.use_occlusion_for_tile_prioritization && | 168 other.use_occlusion_for_tile_prioritization && |
168 verify_property_trees == other.verify_property_trees && | 169 verify_property_trees == other.verify_property_trees && |
169 use_property_trees == other.use_property_trees && | 170 use_property_trees == other.use_property_trees && |
170 image_decode_tasks_enabled == other.image_decode_tasks_enabled && | 171 image_decode_tasks_enabled == other.image_decode_tasks_enabled && |
171 use_compositor_animation_timelines == | 172 use_compositor_animation_timelines == |
172 other.use_compositor_animation_timelines && | 173 other.use_compositor_animation_timelines && |
173 wait_for_beginframe_interval == other.wait_for_beginframe_interval && | 174 wait_for_beginframe_interval == other.wait_for_beginframe_interval && |
| 175 use_mouse_wheel_gestures == other.use_mouse_wheel_gestures && |
174 max_staging_buffer_usage_in_bytes == | 176 max_staging_buffer_usage_in_bytes == |
175 other.max_staging_buffer_usage_in_bytes && | 177 other.max_staging_buffer_usage_in_bytes && |
176 memory_policy_ == other.memory_policy_ && | 178 memory_policy_ == other.memory_policy_ && |
177 LayerTreeDebugState::Equal(initial_debug_state, | 179 LayerTreeDebugState::Equal(initial_debug_state, |
178 other.initial_debug_state); | 180 other.initial_debug_state); |
179 } | 181 } |
180 | 182 |
181 void LayerTreeSettings::ToProtobuf(proto::LayerTreeSettings* proto) const { | 183 void LayerTreeSettings::ToProtobuf(proto::LayerTreeSettings* proto) const { |
182 renderer_settings.ToProtobuf(proto->mutable_renderer_settings()); | 184 renderer_settings.ToProtobuf(proto->mutable_renderer_settings()); |
183 proto->set_single_thread_proxy_scheduler(single_thread_proxy_scheduler); | 185 proto->set_single_thread_proxy_scheduler(single_thread_proxy_scheduler); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 proto->set_ignore_root_layer_flings(ignore_root_layer_flings); | 230 proto->set_ignore_root_layer_flings(ignore_root_layer_flings); |
229 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); | 231 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); |
230 proto->set_use_occlusion_for_tile_prioritization( | 232 proto->set_use_occlusion_for_tile_prioritization( |
231 use_occlusion_for_tile_prioritization); | 233 use_occlusion_for_tile_prioritization); |
232 proto->set_verify_property_trees(verify_property_trees); | 234 proto->set_verify_property_trees(verify_property_trees); |
233 proto->set_use_property_trees(use_property_trees); | 235 proto->set_use_property_trees(use_property_trees); |
234 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); | 236 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); |
235 proto->set_use_compositor_animation_timelines( | 237 proto->set_use_compositor_animation_timelines( |
236 use_compositor_animation_timelines); | 238 use_compositor_animation_timelines); |
237 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); | 239 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); |
| 240 proto->set_use_mouse_wheel_gestures(use_mouse_wheel_gestures); |
238 proto->set_max_staging_buffer_usage_in_bytes( | 241 proto->set_max_staging_buffer_usage_in_bytes( |
239 max_staging_buffer_usage_in_bytes); | 242 max_staging_buffer_usage_in_bytes); |
240 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); | 243 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); |
241 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); | 244 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); |
242 | 245 |
243 for (unsigned u : use_image_texture_targets) | 246 for (unsigned u : use_image_texture_targets) |
244 proto->add_use_image_texture_targets(u); | 247 proto->add_use_image_texture_targets(u); |
245 } | 248 } |
246 | 249 |
247 void LayerTreeSettings::FromProtobuf(const proto::LayerTreeSettings& proto) { | 250 void LayerTreeSettings::FromProtobuf(const proto::LayerTreeSettings& proto) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ignore_root_layer_flings = proto.ignore_root_layer_flings(); | 299 ignore_root_layer_flings = proto.ignore_root_layer_flings(); |
297 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); | 300 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); |
298 use_occlusion_for_tile_prioritization = | 301 use_occlusion_for_tile_prioritization = |
299 proto.use_occlusion_for_tile_prioritization(); | 302 proto.use_occlusion_for_tile_prioritization(); |
300 verify_property_trees = proto.verify_property_trees(); | 303 verify_property_trees = proto.verify_property_trees(); |
301 use_property_trees = proto.use_property_trees(); | 304 use_property_trees = proto.use_property_trees(); |
302 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); | 305 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); |
303 use_compositor_animation_timelines = | 306 use_compositor_animation_timelines = |
304 proto.use_compositor_animation_timelines(); | 307 proto.use_compositor_animation_timelines(); |
305 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); | 308 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); |
| 309 use_mouse_wheel_gestures = proto.use_mouse_wheel_gestures(); |
306 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); | 310 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); |
307 memory_policy_.FromProtobuf(proto.memory_policy()); | 311 memory_policy_.FromProtobuf(proto.memory_policy()); |
308 initial_debug_state.FromProtobuf(proto.initial_debug_state()); | 312 initial_debug_state.FromProtobuf(proto.initial_debug_state()); |
309 | 313 |
310 for (int i = 0; i < proto.use_image_texture_targets_size(); ++i) | 314 for (int i = 0; i < proto.use_image_texture_targets_size(); ++i) |
311 use_image_texture_targets.push_back(proto.use_image_texture_targets(i)); | 315 use_image_texture_targets.push_back(proto.use_image_texture_targets(i)); |
312 } | 316 } |
313 | 317 |
314 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { | 318 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { |
315 SchedulerSettings scheduler_settings; | 319 SchedulerSettings scheduler_settings; |
316 scheduler_settings.use_external_begin_frame_source = | 320 scheduler_settings.use_external_begin_frame_source = |
317 use_external_begin_frame_source; | 321 use_external_begin_frame_source; |
318 scheduler_settings.main_frame_before_activation_enabled = | 322 scheduler_settings.main_frame_before_activation_enabled = |
319 main_frame_before_activation_enabled; | 323 main_frame_before_activation_enabled; |
320 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 324 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
321 timeout_and_draw_when_animation_checkerboards; | 325 timeout_and_draw_when_animation_checkerboards; |
322 scheduler_settings.using_synchronous_renderer_compositor = | 326 scheduler_settings.using_synchronous_renderer_compositor = |
323 using_synchronous_renderer_compositor; | 327 using_synchronous_renderer_compositor; |
324 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; | 328 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; |
325 scheduler_settings.background_frame_interval = | 329 scheduler_settings.background_frame_interval = |
326 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); | 330 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); |
327 return scheduler_settings; | 331 return scheduler_settings; |
328 } | 332 } |
329 | 333 |
330 } // namespace cc | 334 } // namespace cc |
OLD | NEW |