| 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) | |
| 11 #include "base/android/sys_utils.h" | |
| 12 #endif | |
| 13 | |
| 14 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 15 #include "base/logging.h" | 11 #include "base/logging.h" |
| 16 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/sys_info.h" |
| 18 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 19 #include "base/values.h" | 16 #include "base/values.h" |
| 20 #include "cc/base/latency_info_swap_promise.h" | 17 #include "cc/base/latency_info_swap_promise.h" |
| 21 #include "cc/base/latency_info_swap_promise_monitor.h" | 18 #include "cc/base/latency_info_swap_promise_monitor.h" |
| 22 #include "cc/base/switches.h" | 19 #include "cc/base/switches.h" |
| 23 #include "cc/debug/layer_tree_debug_state.h" | 20 #include "cc/debug/layer_tree_debug_state.h" |
| 24 #include "cc/debug/micro_benchmark.h" | 21 #include "cc/debug/micro_benchmark.h" |
| 25 #include "cc/layers/layer.h" | 22 #include "cc/layers/layer.h" |
| 26 #include "cc/output/copy_output_request.h" | 23 #include "cc/output/copy_output_request.h" |
| 27 #include "cc/output/copy_output_result.h" | 24 #include "cc/output/copy_output_result.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 settings.scrollbar_fade_duration_ms = 300; | 271 settings.scrollbar_fade_duration_ms = 300; |
| 275 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 272 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 276 } | 273 } |
| 277 settings.highp_threshold_min = 2048; | 274 settings.highp_threshold_min = 2048; |
| 278 // Android WebView handles root layer flings itself. | 275 // Android WebView handles root layer flings itself. |
| 279 settings.ignore_root_layer_flings = | 276 settings.ignore_root_layer_flings = |
| 280 widget->UsingSynchronousRendererCompositor(); | 277 widget->UsingSynchronousRendererCompositor(); |
| 281 // RGBA_4444 textures are only enabled for low end devices | 278 // RGBA_4444 textures are only enabled for low end devices |
| 282 // and are disabled for Android WebView as it doesn't support the format. | 279 // and are disabled for Android WebView as it doesn't support the format. |
| 283 settings.use_rgba_4444_textures = | 280 settings.use_rgba_4444_textures = |
| 284 base::android::SysUtils::IsLowEndDevice() && | 281 base::SysInfo::IsLowEndDevice() && |
| 285 !widget->UsingSynchronousRendererCompositor(); | 282 !widget->UsingSynchronousRendererCompositor(); |
| 286 if (widget->UsingSynchronousRendererCompositor()) { | 283 if (widget->UsingSynchronousRendererCompositor()) { |
| 287 // TODO(boliu): Set this ratio for Webview. | 284 // TODO(boliu): Set this ratio for Webview. |
| 288 } else if (base::android::SysUtils::IsLowEndDevice()) { | 285 } else if (base::SysInfo::IsLowEndDevice()) { |
| 289 // On low-end we want to be very carefull about killing other | 286 // On low-end we want to be very carefull about killing other |
| 290 // apps. So initially we use 50% more memory to avoid flickering | 287 // apps. So initially we use 50% more memory to avoid flickering |
| 291 // or raster-on-demand. | 288 // or raster-on-demand. |
| 292 settings.max_memory_for_prepaint_percentage = 67; | 289 settings.max_memory_for_prepaint_percentage = 67; |
| 293 } else { | 290 } else { |
| 294 // On other devices we have increased memory excessively to avoid | 291 // On other devices we have increased memory excessively to avoid |
| 295 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 292 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
| 296 // raster-on-demand, and use 50% of the memory otherwise. | 293 // raster-on-demand, and use 50% of the memory otherwise. |
| 297 settings.max_memory_for_prepaint_percentage = 50; | 294 settings.max_memory_for_prepaint_percentage = 50; |
| 298 } | 295 } |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 cc::ContextProvider* provider = | 705 cc::ContextProvider* provider = |
| 709 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 706 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 710 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 707 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 711 } | 708 } |
| 712 | 709 |
| 713 bool RenderWidgetCompositor::usesGpuRasterization() { | 710 bool RenderWidgetCompositor::usesGpuRasterization() { |
| 714 return layer_tree_host_->UseGpuRasterization(); | 711 return layer_tree_host_->UseGpuRasterization(); |
| 715 } | 712 } |
| 716 | 713 |
| 717 } // namespace content | 714 } // namespace content |
| OLD | NEW |