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 : impl_side_painting(false),
25 single_thread_proxy_scheduler(true),
26 use_external_begin_frame_source(false),
27 main_frame_before_activation_enabled(false),
28 using_synchronous_renderer_compositor(false),
29 report_overscroll_only_for_scrollable_axes(false),
30 per_tile_painting_enabled(false),
31 accelerated_animation_enabled(true),
32 can_use_lcd_text(true),
33 use_distance_field_text(false),
34 gpu_rasterization_enabled(false),
35 gpu_rasterization_forced(false),
36 gpu_rasterization_msaa_sample_count(0),
37 gpu_rasterization_skewport_target_time_in_seconds(0.2f
),
38 create_low_res_tiling(false),
39 scrollbar_animator(NO_ANIMATOR
),
40 scrollbar_fade_delay_ms(0),
41 scrollbar_fade_resize_delay_ms(0),
42 scrollbar_fade_duration_ms(0),
43 scrollbar_show_scale_threshold(1.0f
),
44 solid_color_scrollbar_color(SK_ColorWHITE
),
45 timeout_and_draw_when_animation_checkerboards(true),
46 maximum_number_of_failed_draws_before_draw_is_forced_(3),
47 layer_transforms_should_scale_layer_contents(false),
48 layers_always_allowed_lcd_text(false),
49 minimum_contents_scale(0.0625f
),
50 low_res_contents_scale_factor(0.25f
),
51 top_controls_show_threshold(0.5f
),
52 top_controls_hide_threshold(0.5f
),
53 background_animation_rate(1.0),
54 max_partial_texture_updates(std::numeric_limits
<size_t>::max()),
55 default_tile_size(gfx::Size(256, 256)),
56 max_untiled_layer_size(gfx::Size(512, 512)),
57 default_tile_grid_size(gfx::Size(256, 256)),
58 minimum_occlusion_tracking_size(gfx::Size(160, 160)),
59 tiling_interest_area_viewport_multiplier(9.0f
),
60 skewport_target_time_in_seconds(1.0f
),
61 skewport_extrapolation_limit_in_content_pixels(2000),
62 max_unused_resource_memory_percentage(100),
63 max_memory_for_prepaint_percentage(100),
64 strict_layer_property_change_checking(false),
67 use_persistent_map_for_gpu_memory_buffers(false),
68 enable_elastic_overscroll(false),
69 use_image_texture_target(GL_TEXTURE_2D
),
70 ignore_root_layer_flings(false),
71 scheduled_raster_task_limit(32),
72 use_occlusion_for_tile_prioritization(false),
73 record_full_layer(false),
74 use_display_lists(false),
75 verify_property_trees(false),
76 gather_pixel_refs(false),
77 use_compositor_animation_timelines(false),
78 max_bytes_per_copy_operation(std::numeric_limits
<int>::max()) {
81 LayerTreeSettings::~LayerTreeSettings() {}
83 SchedulerSettings
LayerTreeSettings::ToSchedulerSettings() const {
84 SchedulerSettings scheduler_settings
;
85 scheduler_settings
.use_external_begin_frame_source
=
86 use_external_begin_frame_source
;
87 scheduler_settings
.main_frame_before_activation_enabled
=
88 main_frame_before_activation_enabled
;
89 scheduler_settings
.impl_side_painting
= impl_side_painting
;
90 scheduler_settings
.timeout_and_draw_when_animation_checkerboards
=
91 timeout_and_draw_when_animation_checkerboards
;
92 scheduler_settings
.maximum_number_of_failed_draws_before_draw_is_forced_
=
93 maximum_number_of_failed_draws_before_draw_is_forced_
;
94 scheduler_settings
.using_synchronous_renderer_compositor
=
95 using_synchronous_renderer_compositor
;
96 scheduler_settings
.throttle_frame_production
=
97 !renderer_settings
.disable_gpu_vsync
;
98 scheduler_settings
.main_thread_should_always_be_low_latency
= false;
99 scheduler_settings
.background_frame_interval
=
100 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate
);
101 return scheduler_settings
;