Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: cc/trees/layer_tree_settings.cc

Issue 2314933004: cc/blimp: Remove the LayerTreeSettings serialization. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_settings_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/proto/gfx_conversions.h" 7 #include "cc/proto/gfx_conversions.h"
8 #include "cc/proto/layer_tree_settings.pb.h"
9 #include "third_party/khronos/GLES2/gl2.h" 8 #include "third_party/khronos/GLES2/gl2.h"
10 9
11 namespace cc { 10 namespace cc {
12 11
13 namespace {
14
15 proto::LayerTreeSettings_ScrollbarAnimator
16 LayerTreeSettingsScrollbarAnimatorToProto(
17 const LayerTreeSettings::ScrollbarAnimator& animator) {
18 switch (animator) {
19 case LayerTreeSettings::ScrollbarAnimator::NO_ANIMATOR:
20 return proto::LayerTreeSettings_ScrollbarAnimator_NO_ANIMATOR;
21 case LayerTreeSettings::ScrollbarAnimator::LINEAR_FADE:
22 return proto::LayerTreeSettings_ScrollbarAnimator_LINEAR_FADE;
23 case LayerTreeSettings::ScrollbarAnimator::THINNING:
24 return proto::LayerTreeSettings_ScrollbarAnimator_THINNING;
25 }
26 NOTREACHED() << "proto::LayerTreeSettings_ScrollbarAnimator_UNKNOWN";
27 return proto::LayerTreeSettings_ScrollbarAnimator_UNKNOWN;
28 }
29
30 LayerTreeSettings::ScrollbarAnimator
31 LayerTreeSettingsScrollbarAnimatorFromProto(
32 const proto::LayerTreeSettings_ScrollbarAnimator& animator) {
33 switch (animator) {
34 case proto::LayerTreeSettings_ScrollbarAnimator_NO_ANIMATOR:
35 return LayerTreeSettings::ScrollbarAnimator::NO_ANIMATOR;
36 case proto::LayerTreeSettings_ScrollbarAnimator_LINEAR_FADE:
37 return LayerTreeSettings::ScrollbarAnimator::LINEAR_FADE;
38 case proto::LayerTreeSettings_ScrollbarAnimator_THINNING:
39 return LayerTreeSettings::ScrollbarAnimator::THINNING;
40 case proto::LayerTreeSettings_ScrollbarAnimator_UNKNOWN:
41 NOTREACHED() << "proto::LayerTreeSettings_ScrollbarAnimator_UNKNOWN";
42 return LayerTreeSettings::ScrollbarAnimator::NO_ANIMATOR;
43 }
44 return LayerTreeSettings::ScrollbarAnimator::NO_ANIMATOR;
45 }
46
47 } // namespace
48
49 LayerTreeSettings::LayerTreeSettings() 12 LayerTreeSettings::LayerTreeSettings()
50 : default_tile_size(gfx::Size(256, 256)), 13 : default_tile_size(gfx::Size(256, 256)),
51 max_untiled_layer_size(gfx::Size(512, 512)), 14 max_untiled_layer_size(gfx::Size(512, 512)),
52 minimum_occlusion_tracking_size(gfx::Size(160, 160)), 15 minimum_occlusion_tracking_size(gfx::Size(160, 160)),
53 memory_policy_(64 * 1024 * 1024, 16 memory_policy_(64 * 1024 * 1024,
54 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 17 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
55 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {} 18 ManagedMemoryPolicy::kDefaultNumResourcesLimit) {}
56 19
57 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default; 20 LayerTreeSettings::LayerTreeSettings(const LayerTreeSettings& other) = default;
58 LayerTreeSettings::~LayerTreeSettings() = default; 21 LayerTreeSettings::~LayerTreeSettings() = default;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 image_decode_tasks_enabled == other.image_decode_tasks_enabled && 78 image_decode_tasks_enabled == other.image_decode_tasks_enabled &&
116 wait_for_beginframe_interval == other.wait_for_beginframe_interval && 79 wait_for_beginframe_interval == other.wait_for_beginframe_interval &&
117 max_staging_buffer_usage_in_bytes == 80 max_staging_buffer_usage_in_bytes ==
118 other.max_staging_buffer_usage_in_bytes && 81 other.max_staging_buffer_usage_in_bytes &&
119 memory_policy_ == other.memory_policy_ && 82 memory_policy_ == other.memory_policy_ &&
120 LayerTreeDebugState::Equal(initial_debug_state, 83 LayerTreeDebugState::Equal(initial_debug_state,
121 other.initial_debug_state) && 84 other.initial_debug_state) &&
122 use_cached_picture_raster == other.use_cached_picture_raster; 85 use_cached_picture_raster == other.use_cached_picture_raster;
123 } 86 }
124 87
125 void LayerTreeSettings::ToProtobuf(proto::LayerTreeSettings* proto) const {
126 renderer_settings.ToProtobuf(proto->mutable_renderer_settings());
127 proto->set_single_thread_proxy_scheduler(single_thread_proxy_scheduler);
128 proto->set_use_external_begin_frame_source(use_external_begin_frame_source);
129 proto->set_main_frame_before_activation_enabled(
130 main_frame_before_activation_enabled);
131 proto->set_using_synchronous_renderer_compositor(
132 using_synchronous_renderer_compositor);
133 proto->set_can_use_lcd_text(can_use_lcd_text);
134 proto->set_use_distance_field_text(use_distance_field_text);
135 proto->set_gpu_rasterization_enabled(gpu_rasterization_enabled);
136 proto->set_gpu_rasterization_forced(gpu_rasterization_forced);
137 proto->set_async_worker_context_enabled(async_worker_context_enabled);
138 proto->set_gpu_rasterization_msaa_sample_count(
139 gpu_rasterization_msaa_sample_count);
140 proto->set_create_low_res_tiling(create_low_res_tiling);
141 proto->set_scrollbar_animator(
142 LayerTreeSettingsScrollbarAnimatorToProto(scrollbar_animator));
143 proto->set_scrollbar_fade_delay_ms(scrollbar_fade_delay_ms);
144 proto->set_scrollbar_fade_resize_delay_ms(scrollbar_fade_resize_delay_ms);
145 proto->set_scrollbar_fade_duration_ms(scrollbar_fade_duration_ms);
146 proto->set_solid_color_scrollbar_color(solid_color_scrollbar_color);
147 proto->set_timeout_and_draw_when_animation_checkerboards(
148 timeout_and_draw_when_animation_checkerboards);
149 proto->set_layer_transforms_should_scale_layer_contents(
150 layer_transforms_should_scale_layer_contents);
151 proto->set_layers_always_allowed_lcd_text(layers_always_allowed_lcd_text);
152 proto->set_minimum_contents_scale(minimum_contents_scale);
153 proto->set_low_res_contents_scale_factor(low_res_contents_scale_factor);
154 proto->set_top_controls_show_threshold(top_controls_show_threshold);
155 proto->set_top_controls_hide_threshold(top_controls_hide_threshold);
156 proto->set_background_animation_rate(background_animation_rate);
157 SizeToProto(default_tile_size, proto->mutable_default_tile_size());
158 SizeToProto(max_untiled_layer_size, proto->mutable_max_untiled_layer_size());
159 SizeToProto(minimum_occlusion_tracking_size,
160 proto->mutable_minimum_occlusion_tracking_size());
161 proto->set_tiling_interest_area_padding(tiling_interest_area_padding);
162 proto->set_skewport_target_time_in_seconds(skewport_target_time_in_seconds);
163 proto->set_skewport_extrapolation_limit_in_screen_pixels(
164 skewport_extrapolation_limit_in_screen_pixels);
165 proto->set_max_memory_for_prepaint_percentage(
166 max_memory_for_prepaint_percentage);
167 proto->set_use_zero_copy(use_zero_copy);
168 proto->set_use_partial_raster(use_partial_raster);
169 proto->set_enable_elastic_overscroll(enable_elastic_overscroll);
170 proto->set_ignore_root_layer_flings(ignore_root_layer_flings);
171 proto->set_scheduled_raster_task_limit(scheduled_raster_task_limit);
172 proto->set_use_occlusion_for_tile_prioritization(
173 use_occlusion_for_tile_prioritization);
174 proto->set_image_decode_tasks_enabled(image_decode_tasks_enabled);
175 proto->set_wait_for_beginframe_interval(wait_for_beginframe_interval);
176 proto->set_max_staging_buffer_usage_in_bytes(
177 max_staging_buffer_usage_in_bytes);
178 memory_policy_.ToProtobuf(proto->mutable_memory_policy());
179 initial_debug_state.ToProtobuf(proto->mutable_initial_debug_state());
180 proto->set_use_cached_picture_raster(use_cached_picture_raster);
181 }
182
183 void LayerTreeSettings::FromProtobuf(const proto::LayerTreeSettings& proto) {
184 renderer_settings.FromProtobuf(proto.renderer_settings());
185 single_thread_proxy_scheduler = proto.single_thread_proxy_scheduler();
186 use_external_begin_frame_source = proto.use_external_begin_frame_source();
187 main_frame_before_activation_enabled =
188 proto.main_frame_before_activation_enabled();
189 using_synchronous_renderer_compositor =
190 proto.using_synchronous_renderer_compositor();
191 can_use_lcd_text = proto.can_use_lcd_text();
192 use_distance_field_text = proto.use_distance_field_text();
193 gpu_rasterization_enabled = proto.gpu_rasterization_enabled();
194 gpu_rasterization_forced = proto.gpu_rasterization_forced();
195 async_worker_context_enabled = proto.async_worker_context_enabled();
196 gpu_rasterization_msaa_sample_count =
197 proto.gpu_rasterization_msaa_sample_count();
198 create_low_res_tiling = proto.create_low_res_tiling();
199 scrollbar_animator =
200 LayerTreeSettingsScrollbarAnimatorFromProto(proto.scrollbar_animator());
201 scrollbar_fade_delay_ms = proto.scrollbar_fade_delay_ms();
202 scrollbar_fade_resize_delay_ms = proto.scrollbar_fade_resize_delay_ms();
203 scrollbar_fade_duration_ms = proto.scrollbar_fade_duration_ms();
204 solid_color_scrollbar_color = proto.solid_color_scrollbar_color();
205 timeout_and_draw_when_animation_checkerboards =
206 proto.timeout_and_draw_when_animation_checkerboards();
207 layer_transforms_should_scale_layer_contents =
208 proto.layer_transforms_should_scale_layer_contents();
209 layers_always_allowed_lcd_text = proto.layers_always_allowed_lcd_text();
210 minimum_contents_scale = proto.minimum_contents_scale();
211 low_res_contents_scale_factor = proto.low_res_contents_scale_factor();
212 top_controls_show_threshold = proto.top_controls_show_threshold();
213 top_controls_hide_threshold = proto.top_controls_hide_threshold();
214 background_animation_rate = proto.background_animation_rate();
215 default_tile_size = ProtoToSize(proto.default_tile_size());
216 max_untiled_layer_size = ProtoToSize(proto.max_untiled_layer_size());
217 minimum_occlusion_tracking_size =
218 ProtoToSize(proto.minimum_occlusion_tracking_size());
219 tiling_interest_area_padding = proto.tiling_interest_area_padding();
220 skewport_target_time_in_seconds = proto.skewport_target_time_in_seconds();
221 skewport_extrapolation_limit_in_screen_pixels =
222 proto.skewport_extrapolation_limit_in_screen_pixels();
223 max_memory_for_prepaint_percentage =
224 proto.max_memory_for_prepaint_percentage();
225 use_zero_copy = proto.use_zero_copy();
226 use_partial_raster = proto.use_partial_raster();
227 enable_elastic_overscroll = proto.enable_elastic_overscroll();
228 ignore_root_layer_flings = proto.ignore_root_layer_flings();
229 scheduled_raster_task_limit = proto.scheduled_raster_task_limit();
230 use_occlusion_for_tile_prioritization =
231 proto.use_occlusion_for_tile_prioritization();
232 image_decode_tasks_enabled = proto.image_decode_tasks_enabled();
233 wait_for_beginframe_interval = proto.wait_for_beginframe_interval();
234 max_staging_buffer_usage_in_bytes = proto.max_staging_buffer_usage_in_bytes();
235 memory_policy_.FromProtobuf(proto.memory_policy());
236 initial_debug_state.FromProtobuf(proto.initial_debug_state());
237 use_cached_picture_raster = proto.use_cached_picture_raster();
238 }
239
240 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { 88 SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const {
241 SchedulerSettings scheduler_settings; 89 SchedulerSettings scheduler_settings;
242 scheduler_settings.use_external_begin_frame_source = 90 scheduler_settings.use_external_begin_frame_source =
243 use_external_begin_frame_source; 91 use_external_begin_frame_source;
244 scheduler_settings.main_frame_before_activation_enabled = 92 scheduler_settings.main_frame_before_activation_enabled =
245 main_frame_before_activation_enabled; 93 main_frame_before_activation_enabled;
246 scheduler_settings.timeout_and_draw_when_animation_checkerboards = 94 scheduler_settings.timeout_and_draw_when_animation_checkerboards =
247 timeout_and_draw_when_animation_checkerboards; 95 timeout_and_draw_when_animation_checkerboards;
248 scheduler_settings.using_synchronous_renderer_compositor = 96 scheduler_settings.using_synchronous_renderer_compositor =
249 using_synchronous_renderer_compositor; 97 using_synchronous_renderer_compositor;
250 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval; 98 scheduler_settings.throttle_frame_production = wait_for_beginframe_interval;
251 scheduler_settings.background_frame_interval = 99 scheduler_settings.background_frame_interval =
252 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate); 100 base::TimeDelta::FromSecondsD(1.0 / background_animation_rate);
253 scheduler_settings.abort_commit_before_output_surface_creation = 101 scheduler_settings.abort_commit_before_output_surface_creation =
254 abort_commit_before_output_surface_creation; 102 abort_commit_before_output_surface_creation;
255 return scheduler_settings; 103 return scheduler_settings;
256 } 104 }
257 105
258 } // namespace cc 106 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698