| 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.rasterization_site = cc::LayerTreeSettings::GpuRasterization; |
| 133 else if (RenderThreadImpl::current()->is_gpu_rasterization_enabled()) |
| 134 settings.rasterization_site = cc::LayerTreeSettings::HybridRasterization; |
| 135 else |
| 136 settings.rasterization_site = cc::LayerTreeSettings::CpuRasterization; |
| 133 | 137 |
| 134 settings.calculate_top_controls_position = | 138 settings.calculate_top_controls_position = |
| 135 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); | 139 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); |
| 136 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { | 140 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { |
| 137 std::string controls_height_str = | 141 std::string controls_height_str = |
| 138 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); | 142 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); |
| 139 double controls_height; | 143 double controls_height; |
| 140 if (base::StringToDouble(controls_height_str, &controls_height) && | 144 if (base::StringToDouble(controls_height_str, &controls_height) && |
| 141 controls_height > 0) | 145 controls_height > 0) |
| 142 settings.top_controls_height = controls_height; | 146 settings.top_controls_height = controls_height; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 162 std::string top_threshold_str = | 166 std::string top_threshold_str = |
| 163 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); | 167 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); |
| 164 double hide_threshold; | 168 double hide_threshold; |
| 165 if (base::StringToDouble(top_threshold_str, &hide_threshold) && | 169 if (base::StringToDouble(top_threshold_str, &hide_threshold) && |
| 166 hide_threshold >= 0.f && hide_threshold <= 1.f) | 170 hide_threshold >= 0.f && hide_threshold <= 1.f) |
| 167 settings.top_controls_hide_threshold = hide_threshold; | 171 settings.top_controls_hide_threshold = hide_threshold; |
| 168 } | 172 } |
| 169 | 173 |
| 170 settings.show_overdraw_in_tracing = | 174 settings.show_overdraw_in_tracing = |
| 171 cmd->HasSwitch(cc::switches::kTraceOverdraw); | 175 cmd->HasSwitch(cc::switches::kTraceOverdraw); |
| 172 settings.can_use_lcd_text = cc::switches::IsLCDTextEnabled(); | 176 settings.can_use_lcd_text = |
| 177 RenderThreadImpl::current()->is_lcd_text_enabled(); |
| 173 settings.use_pinch_virtual_viewport = | 178 settings.use_pinch_virtual_viewport = |
| 174 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); | 179 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); |
| 175 settings.allow_antialiasing &= | 180 settings.allow_antialiasing &= |
| 176 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); | 181 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); |
| 177 | 182 |
| 178 // These flags should be mirrored by UI versions in ui/compositor/. | 183 // These flags should be mirrored by UI versions in ui/compositor/. |
| 179 settings.initial_debug_state.show_debug_borders = | 184 settings.initial_debug_state.show_debug_borders = |
| 180 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); | 185 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); |
| 181 settings.initial_debug_state.show_fps_counter = | 186 settings.initial_debug_state.show_fps_counter = |
| 182 cmd->HasSwitch(cc::switches::kShowFPSCounter); | 187 cmd->HasSwitch(cc::switches::kShowFPSCounter); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 0, 100, | 233 0, 100, |
| 229 &max_unused_resource_memory_percentage)) { | 234 &max_unused_resource_memory_percentage)) { |
| 230 settings.max_unused_resource_memory_percentage = | 235 settings.max_unused_resource_memory_percentage = |
| 231 max_unused_resource_memory_percentage; | 236 max_unused_resource_memory_percentage; |
| 232 } | 237 } |
| 233 } | 238 } |
| 234 | 239 |
| 235 settings.strict_layer_property_change_checking = | 240 settings.strict_layer_property_change_checking = |
| 236 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); | 241 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); |
| 237 | 242 |
| 238 settings.use_map_image = cc::switches::IsMapImageEnabled(); | 243 settings.use_map_image = RenderThreadImpl::current()->is_map_image_enabled(); |
| 239 | 244 |
| 240 #if defined(OS_ANDROID) | 245 #if defined(OS_ANDROID) |
| 241 settings.max_partial_texture_updates = 0; | 246 settings.max_partial_texture_updates = 0; |
| 242 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; | 247 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; |
| 243 settings.solid_color_scrollbar_color = | 248 settings.solid_color_scrollbar_color = |
| 244 cmd->HasSwitch(switches::kHideScrollbars) | 249 cmd->HasSwitch(switches::kHideScrollbars) |
| 245 ? SK_ColorTRANSPARENT | 250 ? SK_ColorTRANSPARENT |
| 246 : SkColorSetARGB(128, 128, 128, 128); | 251 : SkColorSetARGB(128, 128, 128, 128); |
| 247 settings.highp_threshold_min = 2048; | 252 settings.highp_threshold_min = 2048; |
| 248 // Android WebView handles root layer flings itself. | 253 // Android WebView handles root layer flings itself. |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 widget_->OnSwapBuffersAborted(); | 636 widget_->OnSwapBuffersAborted(); |
| 632 } | 637 } |
| 633 | 638 |
| 634 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 639 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 635 cc::ContextProvider* provider = | 640 cc::ContextProvider* provider = |
| 636 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 641 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 637 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 642 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 638 } | 643 } |
| 639 | 644 |
| 640 } // namespace content | 645 } // namespace content |
| OLD | NEW |