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

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

Issue 2870733002: DevTools shows overlay scrollbar for enabled aura overlay scrollbar and mac (Closed)
Patch Set: add comment Created 3 years, 7 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 | no next file » | no next file with comments »
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 if (cmd.HasSwitch(cc::switches::kSlowDownRasterScaleFactor)) { 424 if (cmd.HasSwitch(cc::switches::kSlowDownRasterScaleFactor)) {
425 const int kMinSlowDownScaleFactor = 0; 425 const int kMinSlowDownScaleFactor = 0;
426 const int kMaxSlowDownScaleFactor = INT_MAX; 426 const int kMaxSlowDownScaleFactor = INT_MAX;
427 GetSwitchValueAsInt( 427 GetSwitchValueAsInt(
428 cmd, cc::switches::kSlowDownRasterScaleFactor, kMinSlowDownScaleFactor, 428 cmd, cc::switches::kSlowDownRasterScaleFactor, kMinSlowDownScaleFactor,
429 kMaxSlowDownScaleFactor, 429 kMaxSlowDownScaleFactor,
430 &settings.initial_debug_state.slow_down_raster_scale_factor); 430 &settings.initial_debug_state.slow_down_raster_scale_factor);
431 } 431 }
432 432
433 // This is default overlay scrollbar settings for DevTools mobile emulator.
434 // Android Overlay Scrollbar and Aura Overlay Scrollbar will override below.
435 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY;
436 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
437 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
aelias_OOO_until_Jul13 2017/05/09 19:20:23 Please set this to 300 for consistency with Androi
chaopeng 2017/05/09 19:30:34 Done.
438 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
439
433 #if defined(OS_ANDROID) 440 #if defined(OS_ANDROID)
434 bool using_synchronous_compositor = 441 bool using_synchronous_compositor =
435 GetContentClient()->UsingSynchronousCompositing(); 442 GetContentClient()->UsingSynchronousCompositing();
436 443
437 settings.use_stream_video_draw_quad = true; 444 settings.use_stream_video_draw_quad = true;
438 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; 445 settings.using_synchronous_renderer_compositor = using_synchronous_compositor;
439 if (using_synchronous_compositor) { 446 if (using_synchronous_compositor) {
440 // Android WebView uses system scrollbars, so make ours invisible. 447 // Android WebView uses system scrollbars, so make ours invisible.
441 // http://crbug.com/677348: This can't be done using hide_scrollbars 448 // http://crbug.com/677348: This can't be done using hide_scrollbars
442 // setting because supporting -webkit custom scrollbars is still desired 449 // setting because supporting -webkit custom scrollbars is still desired
443 // on sublayers. 450 // on sublayers.
444 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; 451 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR;
445 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; 452 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT;
446 } else { 453 } else {
aelias_OOO_until_Jul13 2017/05/09 19:20:23 Please delete the whole content of this else block
chaopeng 2017/05/09 19:30:34 Done.
447 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY; 454 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY;
448 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300); 455 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300);
449 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); 456 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
450 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
451 } 457 }
452 settings.renderer_settings.highp_threshold_min = 2048; 458 settings.renderer_settings.highp_threshold_min = 2048;
453 // Android WebView handles root layer flings itself. 459 // Android WebView handles root layer flings itself.
454 settings.ignore_root_layer_flings = using_synchronous_compositor; 460 settings.ignore_root_layer_flings = using_synchronous_compositor;
455 // Memory policy on Android WebView does not depend on whether device is 461 // Memory policy on Android WebView does not depend on whether device is
456 // low end, so always use default policy. 462 // low end, so always use default policy.
457 bool use_low_memory_policy = 463 bool use_low_memory_policy =
458 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; 464 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor;
459 if (use_low_memory_policy) { 465 if (use_low_memory_policy) {
460 // On low-end we want to be very carefull about killing other 466 // On low-end we want to be very carefull about killing other
(...skipping 19 matching lines...) Expand all
480 if (base::SysInfo::IsLowEndDevice()) { 486 if (base::SysInfo::IsLowEndDevice()) {
481 // When running on a low end device, we limit cached bytes to 2MB. 487 // When running on a low end device, we limit cached bytes to 2MB.
482 // This allows a typical page to fit its images in cache, but prevents 488 // This allows a typical page to fit its images in cache, but prevents
483 // most long-term caching. 489 // most long-term caching.
484 settings.decoded_image_cache_budget_bytes = 2 * 1024 * 1024; 490 settings.decoded_image_cache_budget_bytes = 2 * 1024 * 1024;
485 } 491 }
486 492
487 // TODO(danakj): Only do this on low end devices. 493 // TODO(danakj): Only do this on low end devices.
488 settings.create_low_res_tiling = true; 494 settings.create_low_res_tiling = true;
489 #else // defined(OS_ANDROID) 495 #else // defined(OS_ANDROID)
490 #if !defined(OS_MACOSX) 496 #if !defined(OS_MACOSX)
aelias_OOO_until_Jul13 2017/05/09 19:20:23 Please delete this #if !defined(OS_MACOSX). Looks
chaopeng 2017/05/09 19:30:34 Done.
491 if (ui::IsOverlayScrollbarEnabled()) { 497 if (ui::IsOverlayScrollbarEnabled()) {
492 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY; 498 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY;
493 settings.scrollbar_fade_delay = ui::kOverlayScrollbarFadeDelay; 499 settings.scrollbar_fade_delay = ui::kOverlayScrollbarFadeDelay;
494 settings.scrollbar_fade_duration = ui::kOverlayScrollbarFadeDuration; 500 settings.scrollbar_fade_duration = ui::kOverlayScrollbarFadeDuration;
495 settings.scrollbar_thinning_duration = 501 settings.scrollbar_thinning_duration =
496 ui::kOverlayScrollbarThinningDuration; 502 ui::kOverlayScrollbarThinningDuration;
497 } else {
498 // TODO(bokan): This section is probably unneeded? We don't use scrollbar
499 // animations for non overlay scrollbars.
500 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY;
501 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
502 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
503 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
504 } 503 }
505 #endif // !defined(OS_MACOSX) 504 #endif // !defined(OS_MACOSX)
506 505
507 // On desktop, if there's over 4GB of memory on the machine, increase the 506 // On desktop, if there's over 4GB of memory on the machine, increase the
508 // image decode budget to 256MB for both gpu and software. 507 // image decode budget to 256MB for both gpu and software.
509 const int kImageDecodeMemoryThresholdMB = 4 * 1024; 508 const int kImageDecodeMemoryThresholdMB = 4 * 1024;
510 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 509 if (base::SysInfo::AmountOfPhysicalMemoryMB() >=
511 kImageDecodeMemoryThresholdMB) { 510 kImageDecodeMemoryThresholdMB) {
512 settings.decoded_image_cache_budget_bytes = 256 * 1024 * 1024; 511 settings.decoded_image_cache_budget_bytes = 256 * 1024 * 1024;
513 settings.decoded_image_working_set_budget_bytes = 256 * 1024 * 1024; 512 settings.decoded_image_working_set_budget_bytes = 256 * 1024 * 1024;
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 const cc::LocalSurfaceId& local_surface_id) { 1212 const cc::LocalSurfaceId& local_surface_id) {
1214 layer_tree_host_->SetLocalSurfaceId(local_surface_id); 1213 layer_tree_host_->SetLocalSurfaceId(local_surface_id);
1215 } 1214 }
1216 1215
1217 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { 1216 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) {
1218 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( 1217 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>(
1219 std::move(callback), base::ThreadTaskRunnerHandle::Get())); 1218 std::move(callback), base::ThreadTaskRunnerHandle::Get()));
1220 } 1219 }
1221 1220
1222 } // namespace content 1221 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698