| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 int max_untiled_layer_height = settings.max_untiled_layer_size.height(); | 119 int max_untiled_layer_height = settings.max_untiled_layer_size.height(); |
| 120 if (cmd->HasSwitch(switches::kMaxUntiledLayerHeight)) { | 120 if (cmd->HasSwitch(switches::kMaxUntiledLayerHeight)) { |
| 121 GetSwitchValueAsInt(*cmd, switches::kMaxUntiledLayerHeight, 1, | 121 GetSwitchValueAsInt(*cmd, switches::kMaxUntiledLayerHeight, 1, |
| 122 std::numeric_limits<int>::max(), | 122 std::numeric_limits<int>::max(), |
| 123 &max_untiled_layer_height); | 123 &max_untiled_layer_height); |
| 124 } | 124 } |
| 125 | 125 |
| 126 settings.max_untiled_layer_size = gfx::Size(max_untiled_layer_width, | 126 settings.max_untiled_layer_size = gfx::Size(max_untiled_layer_width, |
| 127 max_untiled_layer_height); | 127 max_untiled_layer_height); |
| 128 | 128 |
| 129 settings.impl_side_painting = cc::switches::IsImplSidePaintingEnabled(); | 129 settings.impl_side_painting = |
| 130 settings.gpu_rasterization = | 130 RenderThreadImpl::current()->is_impl_side_painting_enabled(); |
| 131 cc::switches::IsGpuRasterizationEnabled() || | 131 if (RenderThreadImpl::current()->is_gpu_rasterization_forced()) { |
| 132 cmd->HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths); | 132 settings.gpu_rasterization_state = |
| 133 cc::LayerTreeSettings::GpuRasterizationForced; |
| 134 } |
| 135 else if (RenderThreadImpl::current()->is_gpu_rasterization_enabled()) { |
| 136 settings.gpu_rasterization_state = |
| 137 cc::LayerTreeSettings::GpuRasterizationEnabled; |
| 138 } else { |
| 139 settings.gpu_rasterization_state = |
| 140 cc::LayerTreeSettings::GpuRasterizationDisabled; |
| 141 } |
| 133 | 142 |
| 134 settings.calculate_top_controls_position = | 143 settings.calculate_top_controls_position = |
| 135 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); | 144 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); |
| 136 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { | 145 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { |
| 137 std::string controls_height_str = | 146 std::string controls_height_str = |
| 138 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); | 147 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); |
| 139 double controls_height; | 148 double controls_height; |
| 140 if (base::StringToDouble(controls_height_str, &controls_height) && | 149 if (base::StringToDouble(controls_height_str, &controls_height) && |
| 141 controls_height > 0) | 150 controls_height > 0) |
| 142 settings.top_controls_height = controls_height; | 151 settings.top_controls_height = controls_height; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 164 double hide_threshold; | 173 double hide_threshold; |
| 165 if (base::StringToDouble(top_threshold_str, &hide_threshold) && | 174 if (base::StringToDouble(top_threshold_str, &hide_threshold) && |
| 166 hide_threshold >= 0.f && hide_threshold <= 1.f) | 175 hide_threshold >= 0.f && hide_threshold <= 1.f) |
| 167 settings.top_controls_hide_threshold = hide_threshold; | 176 settings.top_controls_hide_threshold = hide_threshold; |
| 168 } | 177 } |
| 169 | 178 |
| 170 settings.background_color_instead_of_checkerboard = | 179 settings.background_color_instead_of_checkerboard = |
| 171 cmd->HasSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); | 180 cmd->HasSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); |
| 172 settings.show_overdraw_in_tracing = | 181 settings.show_overdraw_in_tracing = |
| 173 cmd->HasSwitch(cc::switches::kTraceOverdraw); | 182 cmd->HasSwitch(cc::switches::kTraceOverdraw); |
| 174 settings.can_use_lcd_text = cc::switches::IsLCDTextEnabled(); | 183 settings.can_use_lcd_text = |
| 184 RenderThreadImpl::current()->is_lcd_text_enabled(); |
| 175 settings.use_pinch_virtual_viewport = | 185 settings.use_pinch_virtual_viewport = |
| 176 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); | 186 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); |
| 177 settings.allow_antialiasing &= | 187 settings.allow_antialiasing &= |
| 178 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); | 188 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); |
| 179 | 189 |
| 180 // These flags should be mirrored by UI versions in ui/compositor/. | 190 // These flags should be mirrored by UI versions in ui/compositor/. |
| 181 settings.initial_debug_state.show_debug_borders = | 191 settings.initial_debug_state.show_debug_borders = |
| 182 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); | 192 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); |
| 183 settings.initial_debug_state.show_fps_counter = | 193 settings.initial_debug_state.show_fps_counter = |
| 184 cmd->HasSwitch(cc::switches::kShowFPSCounter); | 194 cmd->HasSwitch(cc::switches::kShowFPSCounter); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 0, 100, | 240 0, 100, |
| 231 &max_unused_resource_memory_percentage)) { | 241 &max_unused_resource_memory_percentage)) { |
| 232 settings.max_unused_resource_memory_percentage = | 242 settings.max_unused_resource_memory_percentage = |
| 233 max_unused_resource_memory_percentage; | 243 max_unused_resource_memory_percentage; |
| 234 } | 244 } |
| 235 } | 245 } |
| 236 | 246 |
| 237 settings.strict_layer_property_change_checking = | 247 settings.strict_layer_property_change_checking = |
| 238 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); | 248 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); |
| 239 | 249 |
| 240 settings.use_map_image = cc::switches::IsMapImageEnabled(); | 250 settings.use_map_image = RenderThreadImpl::current()->is_map_image_enabled(); |
| 241 | 251 |
| 242 #if defined(OS_ANDROID) | 252 #if defined(OS_ANDROID) |
| 243 // TODO(danakj): Move these to the android code. | 253 // TODO(danakj): Move these to the android code. |
| 244 settings.max_partial_texture_updates = 0; | 254 settings.max_partial_texture_updates = 0; |
| 245 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; | 255 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; |
| 246 settings.solid_color_scrollbar_color = | 256 settings.solid_color_scrollbar_color = |
| 247 cmd->HasSwitch(switches::kHideScrollbars) | 257 cmd->HasSwitch(switches::kHideScrollbars) |
| 248 ? SK_ColorTRANSPARENT | 258 ? SK_ColorTRANSPARENT |
| 249 : SkColorSetARGB(128, 128, 128, 128); | 259 : SkColorSetARGB(128, 128, 128, 128); |
| 250 settings.highp_threshold_min = 2048; | 260 settings.highp_threshold_min = 2048; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 widget_->OnSwapBuffersAborted(); | 644 widget_->OnSwapBuffersAborted(); |
| 635 } | 645 } |
| 636 | 646 |
| 637 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 647 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 638 cc::ContextProvider* provider = | 648 cc::ContextProvider* provider = |
| 639 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 649 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 640 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 650 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 641 } | 651 } |
| 642 | 652 |
| 643 } // namespace content | 653 } // namespace content |
| OLD | NEW |