From 4c630bb277d36826cd4c654ab93b8a44dfd88842 Mon Sep 17 00:00:00 2001 From: "slightlyoff@chromium.org" Date: Mon, 1 Mar 2010 23:33:56 +0000 Subject: Adds a command line flag to suppress flashing blinking for those who really, REALLY want it to stop. BUG=None TEST=load tons of tabs after starting with --disable-backing-store-limit and observe no blinking and HUGE memory usage. Review URL: http://codereview.chromium.org/660224 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40317 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/renderer_host/backing_store_manager.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'chrome/browser/renderer_host') diff --git a/chrome/browser/renderer_host/backing_store_manager.cc b/chrome/browser/renderer_host/backing_store_manager.cc index 39149f2..4325f31 100644 --- a/chrome/browser/renderer_host/backing_store_manager.cc +++ b/chrome/browser/renderer_host/backing_store_manager.cc @@ -5,6 +5,8 @@ #include "chrome/browser/renderer_host/backing_store_manager.h" #include "base/sys_info.h" +#include "base/command_line.h" +#include "chrome/common/chrome_switches.h" #include "chrome/browser/renderer_host/backing_store.h" #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/browser/renderer_host/render_widget_host_painting_observer.h" @@ -40,9 +42,22 @@ const size_t kMemoryMultiplier = 4 * 1920 * 1200; // ~9MB // Use a minimum of 2, and add one for each 256MB of physical memory you have. // Cap at 5, the thinking being that even if you have a gigantic amount of // RAM, there's a limit to how much caching helps beyond a certain number -// of tabs. +// of tabs. If users *really* want unlimited stores, allow it via the +// --disable-backing-store-limit flag. static size_t MaxNumberOfBackingStores() { - return std::min(5, 2 + (base::SysInfo::AmountOfPhysicalMemoryMB() / 256)); + static bool unlimited = false; + const CommandLine& command = *CommandLine::ForCurrentProcess(); + unlimited = command.HasSwitch(switches::kDisableBackingStoreLimit); + + + if (unlimited) { + // 100 isn't truly unlimited, but given that backing stores count against + // GDI memory, it's well past any reasonable number. Many systems will + // begin to fail in strange ways well before they hit 100 stores. + return 100; + } else { + return std::min(5, 2 + (base::SysInfo::AmountOfPhysicalMemoryMB() / 256)); + } } // The maximum about of memory to use for all BackingStoreCache object combined. -- cgit v1.1