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