| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 #if defined(OS_ANDROID) | 397 #if defined(OS_ANDROID) |
| 398 bool using_synchronous_compositor = | 398 bool using_synchronous_compositor = |
| 399 GetContentClient()->UsingSynchronousCompositing(); | 399 GetContentClient()->UsingSynchronousCompositing(); |
| 400 | 400 |
| 401 // We can't use GPU rasterization on low-end devices, because the Ganesh | 401 // We can't use GPU rasterization on low-end devices, because the Ganesh |
| 402 // cache would consume too much memory. | 402 // cache would consume too much memory. |
| 403 if (base::SysInfo::IsLowEndDevice()) | 403 if (base::SysInfo::IsLowEndDevice()) |
| 404 settings.gpu_rasterization_enabled = false; | 404 settings.gpu_rasterization_enabled = false; |
| 405 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; | 405 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; |
| 406 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 406 if (using_synchronous_compositor) { |
| 407 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300); | 407 // Android WebView uses system scrollbars, so make ours invisible. |
| 408 settings.scrollbar_fade_resize_delay = | 408 // http://crbug.com/677348: This can't be done using hide_scrollbars |
| 409 base::TimeDelta::FromMilliseconds(2000); | 409 // setting because supporting -webkit custom scrollbars is still desired |
| 410 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); | 410 // on sublayers. |
| 411 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 411 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; |
| 412 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; |
| 413 } else { |
| 414 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
| 415 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300); |
| 416 settings.scrollbar_fade_resize_delay = |
| 417 base::TimeDelta::FromMilliseconds(2000); |
| 418 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); |
| 419 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 420 } |
| 412 settings.renderer_settings.highp_threshold_min = 2048; | 421 settings.renderer_settings.highp_threshold_min = 2048; |
| 413 // Android WebView handles root layer flings itself. | 422 // Android WebView handles root layer flings itself. |
| 414 settings.ignore_root_layer_flings = using_synchronous_compositor; | 423 settings.ignore_root_layer_flings = using_synchronous_compositor; |
| 415 // Memory policy on Android WebView does not depend on whether device is | 424 // Memory policy on Android WebView does not depend on whether device is |
| 416 // low end, so always use default policy. | 425 // low end, so always use default policy. |
| 417 bool use_low_memory_policy = | 426 bool use_low_memory_policy = |
| 418 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; | 427 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; |
| 419 if (use_low_memory_policy) { | 428 if (use_low_memory_policy) { |
| 420 // On low-end we want to be very carefull about killing other | 429 // On low-end we want to be very carefull about killing other |
| 421 // apps. So initially we use 50% more memory to avoid flickering | 430 // apps. So initially we use 50% more memory to avoid flickering |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 float device_scale) { | 1143 float device_scale) { |
| 1135 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1144 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
| 1136 } | 1145 } |
| 1137 | 1146 |
| 1138 void RenderWidgetCompositor::SetDeviceColorSpace( | 1147 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1139 const gfx::ColorSpace& color_space) { | 1148 const gfx::ColorSpace& color_space) { |
| 1140 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1149 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
| 1141 } | 1150 } |
| 1142 | 1151 |
| 1143 } // namespace content | 1152 } // namespace content |
| OLD | NEW |