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

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

Issue 2780843002: Split image decode cache limits into "working set" vs "cache" limits (Closed)
Patch Set: comments Created 3 years, 8 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 | « cc/trees/layer_tree_settings.h ('k') | 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } else { 420 } else {
421 // On other devices we have increased memory excessively to avoid 421 // On other devices we have increased memory excessively to avoid
422 // raster-on-demand already, so now we reserve 50% _only_ to avoid 422 // raster-on-demand already, so now we reserve 50% _only_ to avoid
423 // raster-on-demand, and use 50% of the memory otherwise. 423 // raster-on-demand, and use 50% of the memory otherwise.
424 settings.max_memory_for_prepaint_percentage = 50; 424 settings.max_memory_for_prepaint_percentage = 50;
425 } 425 }
426 // Webview does not own the surface so should not clear it. 426 // Webview does not own the surface so should not clear it.
427 settings.renderer_settings.should_clear_root_render_pass = 427 settings.renderer_settings.should_clear_root_render_pass =
428 !using_synchronous_compositor; 428 !using_synchronous_compositor;
429 429
430 if (base::SysInfo::IsLowEndDevice()) {
431 // When running on a low end device, we limit cached bytes to 2MB.
432 // This allows a typical page to fit its images in cache, but prevents
433 // most long-term caching.
434 settings.decoded_image_cache_budget_bytes = 2 * 1024 * 1024;
435 }
436
430 // TODO(danakj): Only do this on low end devices. 437 // TODO(danakj): Only do this on low end devices.
431 settings.create_low_res_tiling = true; 438 settings.create_low_res_tiling = true;
432 #else // defined(OS_ANDROID) 439 #else // defined(OS_ANDROID)
433 #if !defined(OS_MACOSX) 440 #if !defined(OS_MACOSX)
434 if (ui::IsOverlayScrollbarEnabled()) { 441 if (ui::IsOverlayScrollbarEnabled()) {
435 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY; 442 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY;
436 settings.scrollbar_show_delay = ui::kOverlayScrollbarShowDelay; 443 settings.scrollbar_show_delay = ui::kOverlayScrollbarShowDelay;
437 settings.scrollbar_fade_out_delay = ui::kOverlayScrollbarFadeOutDelay; 444 settings.scrollbar_fade_out_delay = ui::kOverlayScrollbarFadeOutDelay;
438 settings.scrollbar_fade_out_resize_delay = 445 settings.scrollbar_fade_out_resize_delay =
439 ui::kOverlayScrollbarFadeOutDelay; 446 ui::kOverlayScrollbarFadeOutDelay;
(...skipping 11 matching lines...) Expand all
451 settings.scrollbar_fade_out_duration = 458 settings.scrollbar_fade_out_duration =
452 base::TimeDelta::FromMilliseconds(300); 459 base::TimeDelta::FromMilliseconds(300);
453 } 460 }
454 #endif // !defined(OS_MACOSX) 461 #endif // !defined(OS_MACOSX)
455 462
456 // On desktop, if there's over 4GB of memory on the machine, increase the 463 // On desktop, if there's over 4GB of memory on the machine, increase the
457 // image decode budget to 256MB for both gpu and software. 464 // image decode budget to 256MB for both gpu and software.
458 const int kImageDecodeMemoryThresholdMB = 4 * 1024; 465 const int kImageDecodeMemoryThresholdMB = 4 * 1024;
459 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 466 if (base::SysInfo::AmountOfPhysicalMemoryMB() >=
460 kImageDecodeMemoryThresholdMB) { 467 kImageDecodeMemoryThresholdMB) {
461 settings.gpu_decoded_image_budget_bytes = 256 * 1024 * 1024; 468 settings.decoded_image_cache_budget_bytes = 256 * 1024 * 1024;
462 settings.software_decoded_image_budget_bytes = 256 * 1024 * 1024; 469 settings.decoded_image_working_set_budget_bytes = 256 * 1024 * 1024;
463 } else { 470 } else {
464 // These are the defaults, but recorded here as well. 471 // These are the defaults, but recorded here as well.
465 settings.gpu_decoded_image_budget_bytes = 96 * 1024 * 1024; 472 settings.decoded_image_cache_budget_bytes = 128 * 1024 * 1024;
466 settings.software_decoded_image_budget_bytes = 128 * 1024 * 1024; 473 settings.decoded_image_working_set_budget_bytes = 128 * 1024 * 1024;
467 } 474 }
468 475
469 #endif // defined(OS_ANDROID) 476 #endif // defined(OS_ANDROID)
470 477
471 if (cmd.HasSwitch(switches::kEnableLowResTiling)) 478 if (cmd.HasSwitch(switches::kEnableLowResTiling))
472 settings.create_low_res_tiling = true; 479 settings.create_low_res_tiling = true;
473 if (cmd.HasSwitch(switches::kDisableLowResTiling)) 480 if (cmd.HasSwitch(switches::kDisableLowResTiling))
474 settings.create_low_res_tiling = false; 481 settings.create_low_res_tiling = false;
475 482
476 if (cmd.HasSwitch(switches::kEnableRGBA4444Textures) && 483 if (cmd.HasSwitch(switches::kEnableRGBA4444Textures) &&
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { 1152 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) {
1146 layer_tree_host_->SetContentSourceId(id); 1153 layer_tree_host_->SetContentSourceId(id);
1147 } 1154 }
1148 1155
1149 void RenderWidgetCompositor::SetLocalSurfaceId( 1156 void RenderWidgetCompositor::SetLocalSurfaceId(
1150 const cc::LocalSurfaceId& local_surface_id) { 1157 const cc::LocalSurfaceId& local_surface_id) {
1151 layer_tree_host_->SetLocalSurfaceId(local_surface_id); 1158 layer_tree_host_->SetLocalSurfaceId(local_surface_id);
1152 } 1159 }
1153 1160
1154 } // namespace content 1161 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698