Chromium Code Reviews| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 | 180 |
| 181 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) { | 181 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) { |
| 182 std::string top_threshold_str = | 182 std::string top_threshold_str = |
| 183 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); | 183 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); |
| 184 double hide_threshold; | 184 double hide_threshold; |
| 185 if (base::StringToDouble(top_threshold_str, &hide_threshold) && | 185 if (base::StringToDouble(top_threshold_str, &hide_threshold) && |
| 186 hide_threshold >= 0.f && hide_threshold <= 1.f) | 186 hide_threshold >= 0.f && hide_threshold <= 1.f) |
| 187 settings.top_controls_hide_threshold = hide_threshold; | 187 settings.top_controls_hide_threshold = hide_threshold; |
| 188 } | 188 } |
| 189 | 189 |
| 190 #if defined(OS_CHROMEOS) | |
| 191 settings.use_pinch_virtual_viewport = true; | |
| 192 #else | |
| 190 settings.use_pinch_virtual_viewport = | 193 settings.use_pinch_virtual_viewport = |
| 191 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); | 194 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); |
| 195 #endif | |
|
piman
2014/04/25 20:53:05
I would prefer if this kind of per-platform decisi
| |
| 192 settings.allow_antialiasing &= | 196 settings.allow_antialiasing &= |
| 193 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); | 197 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); |
| 194 | 198 |
| 195 // These flags should be mirrored by UI versions in ui/compositor/. | 199 // These flags should be mirrored by UI versions in ui/compositor/. |
| 196 settings.initial_debug_state.show_debug_borders = | 200 settings.initial_debug_state.show_debug_borders = |
| 197 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); | 201 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); |
| 198 settings.initial_debug_state.show_fps_counter = | 202 settings.initial_debug_state.show_fps_counter = |
| 199 cmd->HasSwitch(cc::switches::kShowFPSCounter); | 203 cmd->HasSwitch(cc::switches::kShowFPSCounter); |
| 200 settings.initial_debug_state.show_layer_animation_bounds_rects = | 204 settings.initial_debug_state.show_layer_animation_bounds_rects = |
| 201 cmd->HasSwitch(cc::switches::kShowLayerAnimationBounds); | 205 cmd->HasSwitch(cc::switches::kShowLayerAnimationBounds); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 settings.max_memory_for_prepaint_percentage = 50; | 286 settings.max_memory_for_prepaint_percentage = 50; |
| 283 } | 287 } |
| 284 // Webview does not own the surface so should not clear it. | 288 // Webview does not own the surface so should not clear it. |
| 285 settings.should_clear_root_render_pass = | 289 settings.should_clear_root_render_pass = |
| 286 !widget->UsingSynchronousRendererCompositor(); | 290 !widget->UsingSynchronousRendererCompositor(); |
| 287 | 291 |
| 288 #elif !defined(OS_MACOSX) | 292 #elif !defined(OS_MACOSX) |
| 289 if (ui::IsOverlayScrollbarEnabled()) { | 293 if (ui::IsOverlayScrollbarEnabled()) { |
| 290 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; | 294 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; |
| 291 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 295 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 292 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { | 296 } else if (settings.use_pinch_virtual_viewport) { |
| 293 // use_pinch_zoom_scrollbars is only true on desktop when non-overlay | 297 // use_pinch_zoom_scrollbars is only true on desktop when non-overlay |
| 294 // scrollbars are in use. | 298 // scrollbars are in use. |
| 295 settings.use_pinch_zoom_scrollbars = true; | 299 settings.use_pinch_zoom_scrollbars = true; |
| 296 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; | 300 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; |
| 297 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 301 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 298 } | 302 } |
| 299 #endif | 303 #endif |
| 300 | 304 |
| 301 compositor->Initialize(settings); | 305 compositor->Initialize(settings); |
| 302 | 306 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 widget_->OnSwapBuffersAborted(); | 655 widget_->OnSwapBuffersAborted(); |
| 652 } | 656 } |
| 653 | 657 |
| 654 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 658 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 655 cc::ContextProvider* provider = | 659 cc::ContextProvider* provider = |
| 656 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 660 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 657 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 661 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 658 } | 662 } |
| 659 | 663 |
| 660 } // namespace content | 664 } // namespace content |
| OLD | NEW |