| 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_utils.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/trees/layer_tree_host.h" | 23 #include "cc/trees/layer_tree_host.h" |
| 27 #include "content/child/child_shared_bitmap_manager.h" | 24 #include "content/child/child_shared_bitmap_manager.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 (widget->UsingSynchronousRendererCompositor()) // It is Android Webview. | 255 (widget->UsingSynchronousRendererCompositor()) // It is Android Webview. |
| 259 ? SK_ColorTRANSPARENT | 256 ? SK_ColorTRANSPARENT |
| 260 : SkColorSetARGB(128, 128, 128, 128); | 257 : SkColorSetARGB(128, 128, 128, 128); |
| 261 settings.highp_threshold_min = 2048; | 258 settings.highp_threshold_min = 2048; |
| 262 // Android WebView handles root layer flings itself. | 259 // Android WebView handles root layer flings itself. |
| 263 settings.ignore_root_layer_flings = | 260 settings.ignore_root_layer_flings = |
| 264 widget->UsingSynchronousRendererCompositor(); | 261 widget->UsingSynchronousRendererCompositor(); |
| 265 // RGBA_4444 textures are only enabled for low end devices | 262 // RGBA_4444 textures are only enabled for low end devices |
| 266 // and are disabled for Android WebView as it doesn't support the format. | 263 // and are disabled for Android WebView as it doesn't support the format. |
| 267 settings.use_rgba_4444_textures = | 264 settings.use_rgba_4444_textures = |
| 268 base::android::SysUtils::IsLowEndDevice() && | 265 base::SysUtils::IsLowEndDevice() && |
| 269 !widget->UsingSynchronousRendererCompositor(); | 266 !widget->UsingSynchronousRendererCompositor(); |
| 270 if (widget->UsingSynchronousRendererCompositor()) { | 267 if (widget->UsingSynchronousRendererCompositor()) { |
| 271 // TODO(boliu): Set this ratio for Webview. | 268 // TODO(boliu): Set this ratio for Webview. |
| 272 } else if (base::android::SysUtils::IsLowEndDevice()) { | 269 } else if (base::SysUtils::IsLowEndDevice()) { |
| 273 // On low-end we want to be very carefull about killing other | 270 // On low-end we want to be very carefull about killing other |
| 274 // apps. So initially we use 50% more memory to avoid flickering | 271 // apps. So initially we use 50% more memory to avoid flickering |
| 275 // or raster-on-demand. | 272 // or raster-on-demand. |
| 276 settings.max_memory_for_prepaint_percentage = 67; | 273 settings.max_memory_for_prepaint_percentage = 67; |
| 277 } else { | 274 } else { |
| 278 // On other devices we have increased memory excessively to avoid | 275 // On other devices we have increased memory excessively to avoid |
| 279 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 276 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
| 280 // raster-on-demand, and use 50% of the memory otherwise. | 277 // raster-on-demand, and use 50% of the memory otherwise. |
| 281 settings.max_memory_for_prepaint_percentage = 50; | 278 settings.max_memory_for_prepaint_percentage = 50; |
| 282 } | 279 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 widget_->OnSwapBuffersAborted(); | 647 widget_->OnSwapBuffersAborted(); |
| 651 } | 648 } |
| 652 | 649 |
| 653 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 650 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 654 cc::ContextProvider* provider = | 651 cc::ContextProvider* provider = |
| 655 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 652 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 656 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 653 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 657 } | 654 } |
| 658 | 655 |
| 659 } // namespace content | 656 } // namespace content |
| OLD | NEW |