| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 ignore_root_layer_flings(false), | 97 ignore_root_layer_flings(false), |
| 98 scheduled_raster_task_limit(32), | 98 scheduled_raster_task_limit(32), |
| 99 use_occlusion_for_tile_prioritization(false), | 99 use_occlusion_for_tile_prioritization(false), |
| 100 image_decode_tasks_enabled(false), | 100 image_decode_tasks_enabled(false), |
| 101 wait_for_beginframe_interval(true), | 101 wait_for_beginframe_interval(true), |
| 102 abort_commit_before_output_surface_creation(true), | 102 abort_commit_before_output_surface_creation(true), |
| 103 use_mouse_wheel_gestures(false), | 103 use_mouse_wheel_gestures(false), |
| 104 max_staging_buffer_usage_in_bytes(32 * 1024 * 1024), | 104 max_staging_buffer_usage_in_bytes(32 * 1024 * 1024), |
| 105 memory_policy_(64 * 1024 * 1024, | 105 memory_policy_(64 * 1024 * 1024, |
| 106 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 106 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
| 107 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} | 107 ManagedMemoryPolicy::kDefaultNumResourcesLimit), |
| 108 use_cached_picture_raster(true) {} |
| 108 | 109 |
| 109 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default; | 110 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default; |
| 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 && |
| 116 use_external_begin_frame_source == | 117 use_external_begin_frame_source == |
| 117 other.use_external_begin_frame_source && | 118 other.use_external_begin_frame_source && |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 scheduled_raster_task_limit == other.scheduled_raster_task_limit && | 165 scheduled_raster_task_limit == other.scheduled_raster_task_limit && |
| 165 use_occlusion_for_tile_prioritization == | 166 use_occlusion_for_tile_prioritization == |
| 166 other.use_occlusion_for_tile_prioritization && | 167 other.use_occlusion_for_tile_prioritization && |
| 167 image_decode_tasks_enabled == other.image_decode_tasks_enabled && | 168 image_decode_tasks_enabled == other.image_decode_tasks_enabled && |
| 168 wait_for_beginframe_interval == other.wait_for_beginframe_interval && | 169 wait_for_beginframe_interval == other.wait_for_beginframe_interval && |
| 169 use_mouse_wheel_gestures == other.use_mouse_wheel_gestures && | 170 use_mouse_wheel_gestures == other.use_mouse_wheel_gestures && |
| 170 max_staging_buffer_usage_in_bytes == | 171 max_staging_buffer_usage_in_bytes == |
| 171 other.max_staging_buffer_usage_in_bytes && | 172 other.max_staging_buffer_usage_in_bytes && |
| 172 memory_policy_ == other.memory_policy_ && | 173 memory_policy_ == other.memory_policy_ && |
| 173 LayerTreeDebugState::Equal(initial_debug_state, | 174 LayerTreeDebugState::Equal(initial_debug_state, |
| 174 other.initial_debug_state); | 175 other.initial_debug_state) && |
| 176 use_cached_picture_raster == other.use_cached_picture_raster; |
| 175 } | 177 } |
| 176 | 178 |
| 177 void LayerTreeSettings::ToProtobuf(proto::LayerTreeSettings* proto) const { | 179 void LayerTreeSettings::ToProtobuf(proto::LayerTreeSettings* proto) const { |
| 178 renderer_settings.ToProtobuf(proto->mutable_renderer_settings()); | 180 renderer_settings.ToProtobuf(proto->mutable_renderer_settings()); |
| 179 proto->set_single_thread_proxy_scheduler(single_thread_proxy_scheduler); | 181 proto->set_single_thread_proxy_scheduler(single_thread_proxy_scheduler); |
| 180 proto->set_use_external_begin_frame_source(use_external_begin_frame_source); | 182 proto->set_use_external_begin_frame_source(use_external_begin_frame_source); |
| 181 proto->set_main_frame_before_activation_enabled( | 183 proto->set_main_frame_before_activation_enabled( |
| 182 main_frame_before_activation_enabled); | 184 main_frame_before_activation_enabled); |
| 183 proto->set_using_synchronous_renderer_compositor( | 185 proto->set_using_synchronous_renderer_compositor( |
| 184 using_synchronous_renderer_compositor); | 186 using_synchronous_renderer_compositor); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); | 226 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit); |
| 225 proto->set_use_occlusion_for_tile_prioritization( | 227 proto->set_use_occlusion_for_tile_prioritization( |
| 226 use_occlusion_for_tile_prioritization); | 228 use_occlusion_for_tile_prioritization); |
| 227 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); | 229 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled); |
| 228 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); | 230 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval); |
| 229 proto->set_use_mouse_wheel_gestures(use_mouse_wheel_gestures); | 231 proto->set_use_mouse_wheel_gestures(use_mouse_wheel_gestures); |
| 230 proto->set_max_staging_buffer_usage_in_bytes( | 232 proto->set_max_staging_buffer_usage_in_bytes( |
| 231 max_staging_buffer_usage_in_bytes); | 233 max_staging_buffer_usage_in_bytes); |
| 232 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); | 234 memory_policy_.ToProtobuf(proto->mutable_memory_policy()); |
| 233 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); | 235 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state()); |
| 236 proto->set_use_cached_picture_raster(use_cached_picture_raster); |
| 234 | 237 |
| 235 for (unsigned u : use_image_texture_targets) | 238 for (unsigned u : use_image_texture_targets) |
| 236 proto->add_use_image_texture_targets(u); | 239 proto->add_use_image_texture_targets(u); |
| 237 } | 240 } |
| 238 | 241 |
| 239 void LayerTreeSettings::FromProtobuf(const proto::LayerTreeSettings& proto) { | 242 void LayerTreeSettings::FromProtobuf(const proto::LayerTreeSettings& proto) { |
| 240 renderer_settings.FromProtobuf(proto.renderer_settings()); | 243 renderer_settings.FromProtobuf(proto.renderer_settings()); |
| 241 single_thread_proxy_scheduler = proto.single_thread_proxy_scheduler(); | 244 single_thread_proxy_scheduler = proto.single_thread_proxy_scheduler(); |
| 242 use_external_begin_frame_source = proto.use_external_begin_frame_source(); | 245 use_external_begin_frame_source = proto.use_external_begin_frame_source(); |
| 243 main_frame_before_activation_enabled = | 246 main_frame_before_activation_enabled = |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 ignore_root_layer_flings = proto.ignore_root_layer_flings(); | 290 ignore_root_layer_flings = proto.ignore_root_layer_flings(); |
| 288 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); | 291 scheduled_raster_task_limit = proto.scheduled_raster_task_limit(); |
| 289 use_occlusion_for_tile_prioritization = | 292 use_occlusion_for_tile_prioritization = |
| 290 proto.use_occlusion_for_tile_prioritization(); | 293 proto.use_occlusion_for_tile_prioritization(); |
| 291 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); | 294 image_decode_tasks_enabled = proto.image_decode_tasks_enabled(); |
| 292 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); | 295 wait_for_beginframe_interval = proto.wait_for_beginframe_interval(); |
| 293 use_mouse_wheel_gestures = proto.use_mouse_wheel_gestures(); | 296 use_mouse_wheel_gestures = proto.use_mouse_wheel_gestures(); |
| 294 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); | 297 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes(); |
| 295 memory_policy_.FromProtobuf(proto.memory_policy()); | 298 memory_policy_.FromProtobuf(proto.memory_policy()); |
| 296 initial_debug_state.FromProtobuf(proto.initial_debug_state()); | 299 initial_debug_state.FromProtobuf(proto.initial_debug_state()); |
| 300 use_cached_picture_raster = proto.use_cached_picture_raster(); |
| 297 | 301 |
| 298 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) |
| 299 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)); |
| 300 } | 304 } |
| 301 | 305 |
| 302 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { | 306 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { |
| 303 SchedulerSettings scheduler_settings; | 307 SchedulerSettings scheduler_settings; |
| 304 scheduler_settings.use_external_begin_frame_source = | 308 scheduler_settings.use_external_begin_frame_source = |
| 305 use_external_begin_frame_source; | 309 use_external_begin_frame_source; |
| 306 scheduler_settings.main_frame_before_activation_enabled = | 310 scheduler_settings.main_frame_before_activation_enabled = |
| 307 main_frame_before_activation_enabled; | 311 main_frame_before_activation_enabled; |
| 308 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 312 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
| 309 timeout_and_draw_when_animation_checkerboards; | 313 timeout_and_draw_when_animation_checkerboards; |
| 310 scheduler_settings.using_synchronous_renderer_compositor = | 314 scheduler_settings.using_synchronous_renderer_compositor = |
| 311 using_synchronous_renderer_compositor; | 315 using_synchronous_renderer_compositor; |
| 312 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; | 316 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; |
| 313 scheduler_settings.background_frame_interval = | 317 scheduler_settings.background_frame_interval = |
| 314 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); | 318 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); |
| 315 scheduler_settings.abort_commit_before_output_surface_creation = | 319 scheduler_settings.abort_commit_before_output_surface_creation = |
| 316 abort_commit_before_output_surface_creation; | 320 abort_commit_before_output_surface_creation; |
| 317 return scheduler_settings; | 321 return scheduler_settings; |
| 318 } | 322 } |
| 319 | 323 |
| 320 } // namespace cc | 324 } // namespace cc |
| OLD | NEW |