| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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. | |
| 4 | |
| 5 #include "blimp/client/compositor/blimp_layer_tree_settings.h" | |
| 6 | |
| 7 #include "base/command_line.h" | |
| 8 #include "base/logging.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/strings/string_number_conversions.h" | |
| 11 #include "base/strings/string_split.h" | |
| 12 #include "base/sys_info.h" | |
| 13 #include "cc/base/switches.h" | |
| 14 #include "cc/trees/layer_tree_settings.h" | |
| 15 #include "third_party/skia/include/core/SkColor.h" | |
| 16 #include "ui/gfx/buffer_types.h" | |
| 17 #include "ui/gl/gl_switches.h" | |
| 18 | |
| 19 namespace blimp { | |
| 20 namespace client { | |
| 21 | |
| 22 // TODO(dtrainor): This is temporary to get the compositor up and running. | |
| 23 // Much of this will either have to be pulled from the server or refactored to | |
| 24 // share the settings from render_widget_compositor.cc. | |
| 25 void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) { | |
| 26 // For web contents, layer transforms should scale up the contents of layers | |
| 27 // to keep content always crisp when possible. | |
| 28 settings->layer_transforms_should_scale_layer_contents = true; | |
| 29 | |
| 30 settings->main_frame_before_activation_enabled = false; | |
| 31 settings->accelerated_animation_enabled = true; | |
| 32 settings->default_tile_size = gfx::Size(256, 256); | |
| 33 settings->gpu_rasterization_msaa_sample_count = 0; | |
| 34 settings->gpu_rasterization_forced = false; | |
| 35 settings->gpu_rasterization_enabled = false; | |
| 36 settings->can_use_lcd_text = false; | |
| 37 settings->use_distance_field_text = false; | |
| 38 #if defined(OS_MACOSX) | |
| 39 settings->use_zero_copy = true; | |
| 40 #else | |
| 41 settings->use_zero_copy = false; | |
| 42 #endif | |
| 43 settings->enable_elastic_overscroll = false; | |
| 44 settings->image_decode_tasks_enabled = false; | |
| 45 settings->verify_property_trees = false; | |
| 46 settings->single_thread_proxy_scheduler = false; | |
| 47 settings->initial_debug_state.show_debug_borders = false; | |
| 48 settings->initial_debug_state.show_fps_counter = false; | |
| 49 settings->initial_debug_state.show_layer_animation_bounds_rects = false; | |
| 50 settings->initial_debug_state.show_paint_rects = false; | |
| 51 settings->initial_debug_state.show_property_changed_rects = false; | |
| 52 settings->initial_debug_state.show_surface_damage_rects = false; | |
| 53 settings->initial_debug_state.show_screen_space_rects = false; | |
| 54 settings->initial_debug_state.show_replica_screen_space_rects = false; | |
| 55 settings->initial_debug_state.SetRecordRenderingStats(false); | |
| 56 settings->strict_layer_property_change_checking = false; | |
| 57 | |
| 58 #if defined(OS_ANDROID) | |
| 59 if (base::SysInfo::IsLowEndDevice()) | |
| 60 settings->gpu_rasterization_enabled = false; | |
| 61 settings->using_synchronous_renderer_compositor = false; | |
| 62 settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | |
| 63 settings->scrollbar_fade_delay_ms = 300; | |
| 64 settings->scrollbar_fade_resize_delay_ms = 2000; | |
| 65 settings->scrollbar_fade_duration_ms = 300; | |
| 66 settings->solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | |
| 67 settings->renderer_settings.highp_threshold_min = 2048; | |
| 68 settings->ignore_root_layer_flings = false; | |
| 69 bool use_low_memory_policy = base::SysInfo::IsLowEndDevice(); | |
| 70 settings->renderer_settings.use_rgba_4444_textures = use_low_memory_policy; | |
| 71 if (use_low_memory_policy) { | |
| 72 // On low-end we want to be very carefull about killing other | |
| 73 // apps. So initially we use 50% more memory to avoid flickering | |
| 74 // or raster-on-demand. | |
| 75 settings->max_memory_for_prepaint_percentage = 67; | |
| 76 } else { | |
| 77 // On other devices we have increased memory excessively to avoid | |
| 78 // raster-on-demand already, so now we reserve 50% _only_ to avoid | |
| 79 // raster-on-demand, and use 50% of the memory otherwise. | |
| 80 settings->max_memory_for_prepaint_percentage = 50; | |
| 81 } | |
| 82 settings->renderer_settings.should_clear_root_render_pass = true; | |
| 83 | |
| 84 // TODO(danakj): Only do this on low end devices. | |
| 85 settings->create_low_res_tiling = true; | |
| 86 | |
| 87 // TODO(dtrainor): Investigate whether or not we want to use an external | |
| 88 // source here. | |
| 89 // settings->use_external_begin_frame_source = true; | |
| 90 | |
| 91 #elif !defined(OS_MACOSX) | |
| 92 settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | |
| 93 settings->solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | |
| 94 settings->scrollbar_fade_delay_ms = 500; | |
| 95 settings->scrollbar_fade_resize_delay_ms = 500; | |
| 96 settings->scrollbar_fade_duration_ms = 300; | |
| 97 | |
| 98 // When pinching in, only show the pinch-viewport overlay scrollbars if the | |
| 99 // page scale is at least some threshold away from the minimum. i.e. don't | |
| 100 // show the pinch scrollbars when at minimum scale. | |
| 101 // TODO(dtrainor): Update this since https://crrev.com/1267603004 landed. | |
| 102 // settings->scrollbar_show_scale_threshold = 1.05f; | |
| 103 #endif | |
| 104 | |
| 105 // Blimp always uses new cc::AnimationHost system. | |
| 106 settings->use_compositor_animation_timelines = true; | |
| 107 } | |
| 108 | |
| 109 } // namespace client | |
| 110 } // namespace blimp | |
| OLD | NEW |