summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 20:42:27 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 20:42:27 +0000
commit57a336aa8b9a591e42fadcae359b20d596af7526 (patch)
tree74c2068e69aaa70c2040e62d8d14dc3583246c2b /chrome
parent0003f509cd63c23518dd20e62e871807ae973065 (diff)
downloadchromium_src-57a336aa8b9a591e42fadcae359b20d596af7526.zip
chromium_src-57a336aa8b9a591e42fadcae359b20d596af7526.tar.gz
chromium_src-57a336aa8b9a591e42fadcae359b20d596af7526.tar.bz2
Remove all MemoryModel-related code, since we're unlikely to use it again. Also changes some sample code to use a random generic name ("PruningAlgorithm") instead of MemoryModel in hopes that no one will be confused.
This does not remove IdleTimer, even though it now has no users. I do plan to remove it, but I want to do that in a separate commit so it's easy to reference and revert if at some later point we want this functionality. BUG=none TEST=none Review URL: http://codereview.chromium.org/242079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27652 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc59
-rw-r--r--chrome/browser/browser.h4
-rw-r--r--chrome/browser/browser_process.h17
-rw-r--r--chrome/browser/browser_process_impl.cc13
-rw-r--r--chrome/browser/browser_process_impl.h7
-rw-r--r--chrome/browser/browser_trial.cc5
-rw-r--r--chrome/browser/browser_trial.h2
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc15
-rw-r--r--chrome/common/child_process_info.h1
-rw-r--r--chrome/common/chrome_switches.cc6
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/test/testing_browser_process.h2
12 files changed, 5 insertions, 127 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index d340b0e..a4052bd 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -102,58 +102,6 @@ using base::TimeDelta;
// How long we wait before updating the browser chrome while loading a page.
static const int kUIUpdateCoalescingTimeMS = 200;
-// Idle time before helping prune memory consumption.
-static const int kBrowserReleaseMemoryInterval = 30; // In seconds.
-
-///////////////////////////////////////////////////////////////////////////////
-
-// A task to reduce the working set of the child processes that live on the IO
-// thread (i.e. plugins, workers).
-class ReduceChildProcessesWorkingSetTask : public Task {
- public:
- virtual void Run() {
-#if defined(OS_WIN)
- for (ChildProcessHost::Iterator iter; !iter.Done(); ++iter)
- iter->ReduceWorkingSet();
-#endif
- }
-};
-
-// A browser task to run when the user is not using the browser.
-// In our case, we're trying to be nice to the operating system and release
-// memory not in use.
-class BrowserIdleTimer : public base::IdleTimer {
- public:
- BrowserIdleTimer()
- : base::IdleTimer(TimeDelta::FromSeconds(kBrowserReleaseMemoryInterval),
- false) {
- }
-
- virtual void OnIdle() {
-#if defined(OS_WIN)
- // We're idle. Release browser and renderer unused pages.
-
- // Handle the Browser.
- base::Process process(GetCurrentProcess());
- process.ReduceWorkingSet();
-
- // Handle the Renderer(s).
- RenderProcessHost::iterator renderer_iter(
- RenderProcessHost::AllHostsIterator());
- while (!renderer_iter.IsAtEnd()) {
- base::Process process = renderer_iter.GetCurrentValue()->process();
- process.ReduceWorkingSet();
- renderer_iter.Advance();
- }
-
- // Handle the child processe. We need to iterate through them on the IO
- // thread because that thread manages the child process collection.
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- new ReduceChildProcessesWorkingSetTask());
-#endif
- }
-};
-
///////////////////////////////////////////////////////////////////////////////
namespace {
@@ -181,8 +129,7 @@ Browser::Browser(Type type, Profile* profile)
is_attempting_to_close_browser_(false),
cancel_download_confirmation_state_(NOT_PROMPTED),
maximized_state_(MAXIMIZED_STATE_DEFAULT),
- method_factory_(this),
- idle_task_(new BrowserIdleTimer) {
+ method_factory_(this) {
tabstrip_model_.AddObserver(this);
registrar_.Add(this, NotificationType::SSL_VISIBLE_STATE_CHANGED,
@@ -209,10 +156,6 @@ Browser::Browser(Type type, Profile* profile)
encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
profile_->GetPrefs(), NULL);
-
- // Trim browser memory on idle for low & medium memory models.
- if (g_browser_process->memory_model() < BrowserProcess::HIGH_MEMORY_MODEL)
- idle_task_->Start();
}
Browser::~Browser() {
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 8e42694..d881059 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -25,7 +25,6 @@
#include "chrome/common/pref_member.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
-class BrowserIdleTimer;
class BrowserWindow;
class DebuggerWindow;
class FindBarController;
@@ -795,9 +794,6 @@ class Browser : public TabStripModelDelegate,
// Dialog box used for opening and saving files.
scoped_refptr<SelectFileDialog> select_file_dialog_;
- // The browser idle task helps cleanup unused memory resources when idle.
- scoped_ptr<BrowserIdleTimer> idle_task_;
-
// Keep track of the encoding auto detect pref.
BooleanPrefMember encoding_auto_detect_;
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
index ff41250..7c1c5b3 100644
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -53,21 +53,6 @@ class BrowserProcess {
BrowserProcess() {}
virtual ~BrowserProcess() {}
- // The browser has 3 memory model configurations. These models have to
- // do with how aggressively we release Renderer memory to the OS.
- // Low memory releases memory the fastest, High memory releases it the
- // slowest. Geek out!
- enum MemoryModel {
- // Will release as much memory as it can after each tab switch, and also
- // after user idle.
- LOW_MEMORY_MODEL,
- // Will release a little memory after each tab switch and also after
- // user idle.
- MEDIUM_MEMORY_MODEL,
- // Hangs onto every last byte.
- HIGH_MEMORY_MODEL
- };
-
// Invoked when the user is logging out/shutting down. When logging off we may
// not have enough time to do a normal shutdown. This method is invoked prior
// to normal shutdown and saves any state that must be saved before we are
@@ -133,8 +118,6 @@ class BrowserProcess {
// Returns the locale used by the application.
virtual const std::string& GetApplicationLocale() = 0;
- virtual MemoryModel memory_model() = 0;
-
DownloadRequestManager* download_request_manager();
// Returns an event that is signaled when the browser shutdown.
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 1509c68..f381b65 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -146,7 +146,6 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
created_debugger_wrapper_(false),
created_devtools_manager_(false),
module_ref_count_(0),
- memory_model_(HIGH_MEMORY_MODEL),
checked_for_new_frames_(false),
using_new_frames_(false),
have_inspector_files_(true) {
@@ -157,18 +156,6 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
// Must be created after the NotificationService.
print_job_manager_.reset(new printing::PrintJobManager);
- // Configure the browser memory model.
- if (command_line.HasSwitch(switches::kMemoryModel)) {
- std::wstring model = command_line.GetSwitchValue(switches::kMemoryModel);
- if (!model.empty()) {
- if (model == L"high")
- memory_model_ = HIGH_MEMORY_MODEL;
- else if (model == L"low")
- memory_model_ = LOW_MEMORY_MODEL;
- else if (model == L"medium")
- memory_model_ = MEDIUM_MEMORY_MODEL;
- }
- }
shutdown_event_.reset(new base::WaitableEvent(true, false));
}
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index 4f094dd..a949ae4 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -183,11 +183,6 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
virtual const std::string& GetApplicationLocale();
- virtual MemoryModel memory_model() {
- DCHECK(CalledOnValidThread());
- return memory_model_;
- }
-
virtual base::WaitableEvent* shutdown_event() {
return shutdown_event_.get();
}
@@ -285,8 +280,6 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
std::string locale_;
- MemoryModel memory_model_;
-
bool checked_for_new_frames_;
bool using_new_frames_;
diff --git a/chrome/browser/browser_trial.cc b/chrome/browser/browser_trial.cc
index 31a2ea0..10ffcda 100644
--- a/chrome/browser/browser_trial.cc
+++ b/chrome/browser/browser_trial.cc
@@ -6,5 +6,6 @@
// The following is a sample of the lines that should be listed here.
-// // A test to determine the impact of using HIGH vs MEDIUM memory models.
-// const wchar_t* BrowserTrial::kMemoryModelFieldTrial = L"memory_model";
+// // A test to determine the impact of kCase1 vs kCase2 pruning algorithms.
+// const wchar_t* BrowserTrial::kPruningAlgorithmFieldTrial =
+// L"pruning_algorithm";
diff --git a/chrome/browser/browser_trial.h b/chrome/browser/browser_trial.h
index cae4dfa..f878a14 100644
--- a/chrome/browser/browser_trial.h
+++ b/chrome/browser/browser_trial.h
@@ -16,7 +16,7 @@ class BrowserTrial {
public:
// The following is a sample line for what should be listed in this file.
- // static const wchar_t* kMemoryModelFieldTrial;
+ // static const wchar_t* kPruningAlgorithmFieldTrial;
private:
DISALLOW_COPY_AND_ASSIGN(BrowserTrial);
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index b0ec310..899b3ff 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -923,21 +923,6 @@ void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) {
return;
}
}
-
- // Now tune the memory footprint of the renderer.
- // If the OS needs to page, we'd rather it page idle renderers.
- BrowserProcess::MemoryModel model = g_browser_process->memory_model();
- if (model < BrowserProcess::HIGH_MEMORY_MODEL) {
- if (backgrounded) {
- if (model == BrowserProcess::LOW_MEMORY_MODEL)
- process_.EmptyWorkingSet();
- else if (model == BrowserProcess::MEDIUM_MEMORY_MODEL)
- process_.ReduceWorkingSet();
- } else {
- if (model == BrowserProcess::MEDIUM_MEMORY_MODEL)
- process_.UnReduceWorkingSet();
- }
- }
}
// Note: we always set the backgrounded_ value. If the process is NULL
diff --git a/chrome/common/child_process_info.h b/chrome/common/child_process_info.h
index c99b2c0..31b1cb84 100644
--- a/chrome/common/child_process_info.h
+++ b/chrome/common/child_process_info.h
@@ -46,7 +46,6 @@ class ChildProcessInfo {
int id() const { return id_; }
void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); }
- void ReduceWorkingSet() const { process_.ReduceWorkingSet(); }
// Returns an English name of the process type, should only be used for non
// user-visible strings, or debugging pages like about:memory.
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index b619517..176eb57 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -292,12 +292,6 @@ const wchar_t kTabCountToLoadOnSessionRestore[] =
// all memory allocations during the run.
const wchar_t kMemoryProfiling[] = L"memory-profile";
-// Configure Chrome's memory model.
-// Does chrome really need multiple memory models? No. But we get a lot
-// of concerns from individuals about how the changes work on *their*
-// system, and we need to be able to experiment with a few choices.
-const wchar_t kMemoryModel[] = L"memory-model";
-
// By default, cookies are not allowed on file://. They are needed in for
// testing, for example page cycler and layout tests. See bug 1157243.
const wchar_t kEnableFileCookies[] = L"enable-file-cookies";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index f6cb10d..8774a0f 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -100,7 +100,6 @@ extern const wchar_t kEnableExtensionTimelineApi[];
extern const wchar_t kTabCountToLoadOnSessionRestore[];
extern const wchar_t kMemoryProfiling[];
-extern const wchar_t kMemoryModel[];
extern const wchar_t kEnableFileCookies[];
diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h
index 22e106b..d105fda 100644
--- a/chrome/test/testing_browser_process.h
+++ b/chrome/test/testing_browser_process.h
@@ -136,8 +136,6 @@ class TestingBrowserProcess : public BrowserProcess {
return *value;
}
- virtual MemoryModel memory_model() { return HIGH_MEMORY_MODEL; }
-
virtual base::WaitableEvent* shutdown_event() {
return shutdown_event_.get();
}