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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 settings.highp_threshold_min = 2048; | 255 settings.highp_threshold_min = 2048; |
256 // Android WebView handles root layer flings itself. | 256 // Android WebView handles root layer flings itself. |
257 settings.ignore_root_layer_flings = | 257 settings.ignore_root_layer_flings = |
258 widget->UsingSynchronousRendererCompositor(); | 258 widget->UsingSynchronousRendererCompositor(); |
259 // RGBA_4444 textures are only enabled for low end devices | 259 // RGBA_4444 textures are only enabled for low end devices |
260 // and are disabled for Android WebView as it doesn't support the format. | 260 // and are disabled for Android WebView as it doesn't support the format. |
261 settings.use_rgba_4444_textures = | 261 settings.use_rgba_4444_textures = |
262 base::android::SysUtils::IsLowEndDevice() && | 262 base::android::SysUtils::IsLowEndDevice() && |
263 !widget->UsingSynchronousRendererCompositor() && | 263 !widget->UsingSynchronousRendererCompositor() && |
264 !cmd->HasSwitch(cc::switches::kDisable4444Textures); | 264 !cmd->HasSwitch(cc::switches::kDisable4444Textures); |
265 if (widget->UsingSynchronousRendererCompositor()) { | |
266 // TODO(boliu): Set this ratio for Webview. | |
267 } else if (base::android::SysUtils::IsLowEndDevice()) { | |
268 // On low-end we want to be very carefull about killing other | |
269 // apps. So initially we use 50% more memory to avoid flickering | |
klobag.chromium
2014/02/15 07:27:20
comment 50% is not matching code 67%.
epenner
2014/02/17 05:43:23
Oh, yes this comment is very confusing. We do actu
| |
270 // or raster-on-demand. | |
271 settings.max_memory_for_prepaint_percentage = 67; | |
272 } else { | |
273 // On other devices we have increased memory excessively to avoid | |
274 // raster-on-demand already, so now we reserve 50% _only_ to avoid | |
275 // raster-on-demand, and use 50% of the memory otherwise. | |
276 settings.max_memory_for_prepaint_percentage = 50; | |
277 } | |
278 | |
265 #elif !defined(OS_MACOSX) | 279 #elif !defined(OS_MACOSX) |
266 if (IsOverlayScrollbarEnabled()) { | 280 if (IsOverlayScrollbarEnabled()) { |
267 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; | 281 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; |
268 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 282 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
269 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { | 283 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { |
270 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; | 284 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; |
271 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 285 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
272 } | 286 } |
273 #endif | 287 #endif |
274 | 288 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 widget_->OnSwapBuffersAborted(); | 639 widget_->OnSwapBuffersAborted(); |
626 } | 640 } |
627 | 641 |
628 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 642 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
629 cc::ContextProvider* provider = | 643 cc::ContextProvider* provider = |
630 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 644 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
631 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 645 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
632 } | 646 } |
633 | 647 |
634 } // namespace content | 648 } // namespace content |
OLD | NEW |