Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 168053002: GPU: Adjust memory and use the soft-limit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gl/gl_context_android.cc » ('j') | ui/gl/gl_context_android.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
aelias_OOO_until_Jul13 2014/02/15 00:55:17 How about just using the same policy for WebView u
epenner 2014/02/15 01:02:27 I think their limits are not as excessive as ours.
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/gl/gl_context_android.cc » ('j') | ui/gl/gl_context_android.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698