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

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

Issue 389973005: Merge 280970 "Add switch to disable recording whole document" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 24 matching lines...) Expand all
35 #include "content/renderer/input/input_handler_manager.h" 35 #include "content/renderer/input/input_handler_manager.h"
36 #include "content/renderer/render_thread_impl.h" 36 #include "content/renderer/render_thread_impl.h"
37 #include "gpu/command_buffer/client/gles2_interface.h" 37 #include "gpu/command_buffer/client/gles2_interface.h"
38 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h" 38 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h"
39 #include "third_party/WebKit/public/platform/WebSize.h" 39 #include "third_party/WebKit/public/platform/WebSize.h"
40 #include "third_party/WebKit/public/web/WebWidget.h" 40 #include "third_party/WebKit/public/web/WebWidget.h"
41 #include "ui/gfx/frame_time.h" 41 #include "ui/gfx/frame_time.h"
42 #include "ui/gl/gl_switches.h" 42 #include "ui/gl/gl_switches.h"
43 #include "ui/native_theme/native_theme_switches.h" 43 #include "ui/native_theme/native_theme_switches.h"
44 44
45 #if defined(OS_ANDROID)
46 #include "content/renderer/android/synchronous_compositor_factory.h"
47 #endif
48
45 namespace base { 49 namespace base {
46 class Value; 50 class Value;
47 } 51 }
48 52
49 namespace cc { 53 namespace cc {
50 class Layer; 54 class Layer;
51 } 55 }
52 56
53 using blink::WebFloatPoint; 57 using blink::WebFloatPoint;
54 using blink::WebSize; 58 using blink::WebSize;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 99
96 settings.throttle_frame_production = 100 settings.throttle_frame_production =
97 !cmd->HasSwitch(switches::kDisableGpuVsync); 101 !cmd->HasSwitch(switches::kDisableGpuVsync);
98 settings.begin_frame_scheduling_enabled = 102 settings.begin_frame_scheduling_enabled =
99 cmd->HasSwitch(switches::kEnableBeginFrameScheduling); 103 cmd->HasSwitch(switches::kEnableBeginFrameScheduling);
100 settings.main_frame_before_activation_enabled = 104 settings.main_frame_before_activation_enabled =
101 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) && 105 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) &&
102 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation); 106 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation);
103 settings.main_frame_before_draw_enabled = 107 settings.main_frame_before_draw_enabled =
104 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeDraw); 108 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeDraw);
105 settings.using_synchronous_renderer_compositor = 109 settings.report_overscroll_only_for_scrollable_axes = true;
106 widget->UsingSynchronousRendererCompositor();
107 settings.report_overscroll_only_for_scrollable_axes =
108 !widget->UsingSynchronousRendererCompositor();
109 settings.accelerated_animation_enabled = 110 settings.accelerated_animation_enabled =
110 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); 111 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation);
111 settings.touch_hit_testing = 112 settings.touch_hit_testing =
112 !cmd->HasSwitch(cc::switches::kDisableCompositorTouchHitTesting); 113 !cmd->HasSwitch(cc::switches::kDisableCompositorTouchHitTesting);
113 114
114 int default_tile_width = settings.default_tile_size.width(); 115 int default_tile_width = settings.default_tile_size.width();
115 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { 116 if (cmd->HasSwitch(switches::kDefaultTileWidth)) {
116 GetSwitchValueAsInt(*cmd, switches::kDefaultTileWidth, 1, 117 GetSwitchValueAsInt(*cmd, switches::kDefaultTileWidth, 1,
117 std::numeric_limits<int>::max(), &default_tile_width); 118 std::numeric_limits<int>::max(), &default_tile_width);
118 } 119 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 &max_unused_resource_memory_percentage)) { 257 &max_unused_resource_memory_percentage)) {
257 settings.max_unused_resource_memory_percentage = 258 settings.max_unused_resource_memory_percentage =
258 max_unused_resource_memory_percentage; 259 max_unused_resource_memory_percentage;
259 } 260 }
260 } 261 }
261 262
262 settings.strict_layer_property_change_checking = 263 settings.strict_layer_property_change_checking =
263 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); 264 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking);
264 265
265 #if defined(OS_ANDROID) 266 #if defined(OS_ANDROID)
267 SynchronousCompositorFactory* synchronous_compositor_factory =
268 SynchronousCompositorFactory::GetInstance();
269
270 settings.using_synchronous_renderer_compositor =
271 synchronous_compositor_factory;
272 settings.record_full_layer =
273 synchronous_compositor_factory &&
274 synchronous_compositor_factory->RecordFullLayer();
275 settings.report_overscroll_only_for_scrollable_axes =
276 !synchronous_compositor_factory;
266 settings.max_partial_texture_updates = 0; 277 settings.max_partial_texture_updates = 0;
267 if (widget->UsingSynchronousRendererCompositor()) { 278 if (synchronous_compositor_factory) {
268 // Android WebView uses system scrollbars, so make ours invisible. 279 // Android WebView uses system scrollbars, so make ours invisible.
269 settings.scrollbar_animator = cc::LayerTreeSettings::NoAnimator; 280 settings.scrollbar_animator = cc::LayerTreeSettings::NoAnimator;
270 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; 281 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT;
271 } else { 282 } else {
272 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; 283 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade;
273 settings.scrollbar_fade_delay_ms = 300; 284 settings.scrollbar_fade_delay_ms = 300;
274 settings.scrollbar_fade_duration_ms = 300; 285 settings.scrollbar_fade_duration_ms = 300;
275 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 286 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
276 } 287 }
277 settings.highp_threshold_min = 2048; 288 settings.highp_threshold_min = 2048;
278 // Android WebView handles root layer flings itself. 289 // Android WebView handles root layer flings itself.
279 settings.ignore_root_layer_flings = 290 settings.ignore_root_layer_flings =
280 widget->UsingSynchronousRendererCompositor(); 291 synchronous_compositor_factory;
281 // RGBA_4444 textures are only enabled for low end devices 292 // RGBA_4444 textures are only enabled for low end devices
282 // and are disabled for Android WebView as it doesn't support the format. 293 // and are disabled for Android WebView as it doesn't support the format.
283 settings.use_rgba_4444_textures = 294 settings.use_rgba_4444_textures =
284 base::android::SysUtils::IsLowEndDevice() && 295 base::android::SysUtils::IsLowEndDevice() &&
285 !widget->UsingSynchronousRendererCompositor(); 296 !synchronous_compositor_factory;
286 if (widget->UsingSynchronousRendererCompositor()) { 297 if (synchronous_compositor_factory) {
287 // TODO(boliu): Set this ratio for Webview. 298 // TODO(boliu): Set this ratio for Webview.
288 } else if (base::android::SysUtils::IsLowEndDevice()) { 299 } else if (base::android::SysUtils::IsLowEndDevice()) {
289 // On low-end we want to be very carefull about killing other 300 // On low-end we want to be very carefull about killing other
290 // apps. So initially we use 50% more memory to avoid flickering 301 // apps. So initially we use 50% more memory to avoid flickering
291 // or raster-on-demand. 302 // or raster-on-demand.
292 settings.max_memory_for_prepaint_percentage = 67; 303 settings.max_memory_for_prepaint_percentage = 67;
293 } else { 304 } else {
294 // On other devices we have increased memory excessively to avoid 305 // On other devices we have increased memory excessively to avoid
295 // raster-on-demand already, so now we reserve 50% _only_ to avoid 306 // raster-on-demand already, so now we reserve 50% _only_ to avoid
296 // raster-on-demand, and use 50% of the memory otherwise. 307 // raster-on-demand, and use 50% of the memory otherwise.
297 settings.max_memory_for_prepaint_percentage = 50; 308 settings.max_memory_for_prepaint_percentage = 50;
298 } 309 }
299 // Webview does not own the surface so should not clear it. 310 // Webview does not own the surface so should not clear it.
300 settings.should_clear_root_render_pass = 311 settings.should_clear_root_render_pass =
301 !widget->UsingSynchronousRendererCompositor(); 312 !synchronous_compositor_factory;
302 313
303 #elif !defined(OS_MACOSX) 314 #elif !defined(OS_MACOSX)
304 if (ui::IsOverlayScrollbarEnabled()) { 315 if (ui::IsOverlayScrollbarEnabled()) {
305 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; 316 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning;
306 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 317 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
307 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { 318 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) {
308 // use_pinch_zoom_scrollbars is only true on desktop when non-overlay 319 // use_pinch_zoom_scrollbars is only true on desktop when non-overlay
309 // scrollbars are in use. 320 // scrollbars are in use.
310 settings.use_pinch_zoom_scrollbars = true; 321 settings.use_pinch_zoom_scrollbars = true;
311 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; 322 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 widget_->OnSwapBuffersAborted(); 714 widget_->OnSwapBuffersAborted();
704 } 715 }
705 716
706 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { 717 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() {
707 cc::ContextProvider* provider = 718 cc::ContextProvider* provider =
708 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 719 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
709 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); 720 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM();
710 } 721 }
711 722
712 } // namespace content 723 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_factory.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698