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
3 // found in the LICENSE file.
5 #include "cc/trees/layer_tree_settings.h"
10 #include "base/command_line.h"
11 #include "base/logging.h"
12 #include "base/strings/string_number_conversions.h"
16 LayerSettings::LayerSettings() : use_compositor_animation_timelines(false) {
19 LayerSettings::~LayerSettings() {
22 LayerTreeSettings::LayerTreeSettings()
23 : single_thread_proxy_scheduler(true),
24 use_external_begin_frame_source(false),
25 main_frame_before_activation_enabled(false),
26 using_synchronous_renderer_compositor(false),
27 accelerated_animation_enabled(true),
28 can_use_lcd_text(true),
29 use_distance_field_text(false),
30 gpu_rasterization_enabled(false),
31 gpu_rasterization_forced(false),
32 gpu_rasterization_msaa_sample_count(0),
33 gpu_rasterization_skewport_target_time_in_seconds(0.2f
),
34 create_low_res_tiling(false),
35 scrollbar_animator(NO_ANIMATOR
),
36 scrollbar_fade_delay_ms(0),
37 scrollbar_fade_resize_delay_ms(0),
38 scrollbar_fade_duration_ms(0),
39 solid_color_scrollbar_color(SK_ColorWHITE
),
40 timeout_and_draw_when_animation_checkerboards(true),
41 layer_transforms_should_scale_layer_contents(false),
42 layers_always_allowed_lcd_text(false),
43 minimum_contents_scale(0.0625f
),
44 low_res_contents_scale_factor(0.25f
),
45 top_controls_show_threshold(0.5f
),
46 top_controls_hide_threshold(0.5f
),
47 background_animation_rate(1.0),
48 max_partial_texture_updates(std::numeric_limits
<size_t>::max()),
49 default_tile_size(gfx::Size(256, 256)),
50 max_untiled_layer_size(gfx::Size(512, 512)),
51 default_tile_grid_size(gfx::Size(256, 256)),
52 minimum_occlusion_tracking_size(gfx::Size(160, 160)),
53 // 3000 pixels should give sufficient area for prepainting.
54 tiling_interest_area_padding(3000),
55 skewport_target_time_in_seconds(1.0f
),
56 skewport_extrapolation_limit_in_content_pixels(2000),
57 max_unused_resource_memory_percentage(100),
58 max_memory_for_prepaint_percentage(100),
59 strict_layer_property_change_checking(false),
62 use_persistent_map_for_gpu_memory_buffers(false),
63 enable_elastic_overscroll(false),
64 use_image_texture_target(GL_TEXTURE_2D
),
65 ignore_root_layer_flings(false),
66 scheduled_raster_task_limit(32),
67 use_occlusion_for_tile_prioritization(false),
68 record_full_layer(false),
69 use_display_lists(false),
70 verify_property_trees(false),
71 gather_pixel_refs(false),
72 use_compositor_animation_timelines(false),
73 invert_viewport_scroll_order(false),
74 wait_for_beginframe_interval(true) {}
76 LayerTreeSettings::~LayerTreeSettings() {}
78 SchedulerSettings
LayerTreeSettings::ToSchedulerSettings() const {
79 SchedulerSettings scheduler_settings
;
80 scheduler_settings
.use_external_begin_frame_source
=
81 use_external_begin_frame_source
;
82 scheduler_settings
.main_frame_before_activation_enabled
=
83 main_frame_before_activation_enabled
;
84 scheduler_settings
.timeout_and_draw_when_animation_checkerboards
=
85 timeout_and_draw_when_animation_checkerboards
;
86 scheduler_settings
.using_synchronous_renderer_compositor
=
87 using_synchronous_renderer_compositor
;
88 scheduler_settings
.throttle_frame_production
= wait_for_beginframe_interval
;
89 scheduler_settings
.background_frame_interval
=
90 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate
);
91 return scheduler_settings
;