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

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

Issue 1408123005: Android Webview IPC-based sync compositing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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
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 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 cc::switches::kSlowDownRasterScaleFactor, 363 cc::switches::kSlowDownRasterScaleFactor,
364 kMinSlowDownScaleFactor, 364 kMinSlowDownScaleFactor,
365 kMaxSlowDownScaleFactor, 365 kMaxSlowDownScaleFactor,
366 &settings.initial_debug_state.slow_down_raster_scale_factor); 366 &settings.initial_debug_state.slow_down_raster_scale_factor);
367 } 367 }
368 368
369 settings.strict_layer_property_change_checking = 369 settings.strict_layer_property_change_checking =
370 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); 370 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking);
371 371
372 #if defined(OS_ANDROID) 372 #if defined(OS_ANDROID)
373 SynchronousCompositorFactory* synchronous_compositor_factory = 373 bool using_synchronous_compositor =
no sievers 2015/10/29 01:37:01 DCHECK(!SynchronousCompositorFactory::GetInstance(
boliu 2015/10/29 04:24:44 Done.
374 SynchronousCompositorFactory::GetInstance(); 374 SynchronousCompositorFactory::GetInstance() ||
375 cmd->HasSwitch(switches::kIPCSyncCompositing);
375 376
376 // We can't use GPU rasterization on low-end devices, because the Ganesh 377 // We can't use GPU rasterization on low-end devices, because the Ganesh
377 // cache would consume too much memory. 378 // cache would consume too much memory.
378 if (base::SysInfo::IsLowEndDevice()) 379 if (base::SysInfo::IsLowEndDevice())
379 settings.gpu_rasterization_enabled = false; 380 settings.gpu_rasterization_enabled = false;
380 settings.using_synchronous_renderer_compositor = 381 settings.using_synchronous_renderer_compositor = using_synchronous_compositor;
381 synchronous_compositor_factory;
382 settings.record_full_layer = widget_->DoesRecordFullLayer(); 382 settings.record_full_layer = widget_->DoesRecordFullLayer();
383 if (synchronous_compositor_factory) { 383 if (using_synchronous_compositor) {
384 // Android WebView uses system scrollbars, so make ours invisible. 384 // Android WebView uses system scrollbars, so make ours invisible.
385 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; 385 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR;
386 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; 386 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT;
387 } else { 387 } else {
388 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; 388 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
389 settings.scrollbar_fade_delay_ms = 300; 389 settings.scrollbar_fade_delay_ms = 300;
390 settings.scrollbar_fade_resize_delay_ms = 2000; 390 settings.scrollbar_fade_resize_delay_ms = 2000;
391 settings.scrollbar_fade_duration_ms = 300; 391 settings.scrollbar_fade_duration_ms = 300;
392 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 392 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
393 } 393 }
394 settings.renderer_settings.highp_threshold_min = 2048; 394 settings.renderer_settings.highp_threshold_min = 2048;
395 // Android WebView handles root layer flings itself. 395 // Android WebView handles root layer flings itself.
396 settings.ignore_root_layer_flings = 396 settings.ignore_root_layer_flings = using_synchronous_compositor;
397 synchronous_compositor_factory;
398 // Memory policy on Android WebView does not depend on whether device is 397 // Memory policy on Android WebView does not depend on whether device is
399 // low end, so always use default policy. 398 // low end, so always use default policy.
400 bool use_low_memory_policy = 399 bool use_low_memory_policy =
401 base::SysInfo::IsLowEndDevice() && !synchronous_compositor_factory; 400 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor;
402 // RGBA_4444 textures are only enabled by default for low end devices 401 // RGBA_4444 textures are only enabled by default for low end devices
403 // and are disabled for Android WebView as it doesn't support the format. 402 // and are disabled for Android WebView as it doesn't support the format.
404 settings.renderer_settings.use_rgba_4444_textures = use_low_memory_policy; 403 settings.renderer_settings.use_rgba_4444_textures = use_low_memory_policy;
405 if (use_low_memory_policy) { 404 if (use_low_memory_policy) {
406 // On low-end we want to be very carefull about killing other 405 // On low-end we want to be very carefull about killing other
407 // apps. So initially we use 50% more memory to avoid flickering 406 // apps. So initially we use 50% more memory to avoid flickering
408 // or raster-on-demand. 407 // or raster-on-demand.
409 settings.max_memory_for_prepaint_percentage = 67; 408 settings.max_memory_for_prepaint_percentage = 67;
410 } else { 409 } else {
411 // On other devices we have increased memory excessively to avoid 410 // On other devices we have increased memory excessively to avoid
412 // raster-on-demand already, so now we reserve 50% _only_ to avoid 411 // raster-on-demand already, so now we reserve 50% _only_ to avoid
413 // raster-on-demand, and use 50% of the memory otherwise. 412 // raster-on-demand, and use 50% of the memory otherwise.
414 settings.max_memory_for_prepaint_percentage = 50; 413 settings.max_memory_for_prepaint_percentage = 50;
415 } 414 }
416 // Webview does not own the surface so should not clear it. 415 // Webview does not own the surface so should not clear it.
417 settings.renderer_settings.should_clear_root_render_pass = 416 settings.renderer_settings.should_clear_root_render_pass =
418 !synchronous_compositor_factory; 417 !using_synchronous_compositor;
419 418
420 // TODO(danakj): Only do this on low end devices. 419 // TODO(danakj): Only do this on low end devices.
421 settings.create_low_res_tiling = true; 420 settings.create_low_res_tiling = true;
422 421
423 settings.use_external_begin_frame_source = true; 422 settings.use_external_begin_frame_source = true;
424 423
425 #elif !defined(OS_MACOSX) 424 #elif !defined(OS_MACOSX)
426 if (ui::IsOverlayScrollbarEnabled()) { 425 if (ui::IsOverlayScrollbarEnabled()) {
427 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; 426 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING;
428 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 427 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 // Ignore what the system said and give all clients the same maximum 1079 // Ignore what the system said and give all clients the same maximum
1081 // allocation on desktop platforms. 1080 // allocation on desktop platforms.
1082 actual.bytes_limit_when_visible = 512 * 1024 * 1024; 1081 actual.bytes_limit_when_visible = 512 * 1024 * 1024;
1083 actual.priority_cutoff_when_visible = 1082 actual.priority_cutoff_when_visible =
1084 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 1083 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
1085 #endif 1084 #endif
1086 return actual; 1085 return actual;
1087 } 1086 }
1088 1087
1089 } // namespace content 1088 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698