summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_purger.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 19:32:58 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 19:32:58 +0000
commit3148c5d6e03492bf0f0310981e3b87e281c22f89 (patch)
tree93fbf3989c3f582d6fca48199741312cbdcdbffb /chrome/browser/memory_purger.h
parent269a4ccc9ac806f5cf95603e4bd93c1d63bfb415 (diff)
downloadchromium_src-3148c5d6e03492bf0f0310981e3b87e281c22f89.zip
chromium_src-3148c5d6e03492bf0f0310981e3b87e281c22f89.tar.gz
chromium_src-3148c5d6e03492bf0f0310981e3b87e281c22f89.tar.bz2
Hook up the memory purger to all the relevant locations.
This removes the two-state purge/reset code (no longer necessary), and the hooks to the power monitor (not ready to turn those on without more work and testing). BUG=23400 TEST=Run Chrome with --purge-memory-button, use it for awhile, open the Task Manager, and click "Purge Memory". You should still be able to use the program normally, and hopefully we dumped some memory out too (varies by usage). Review URL: http://codereview.chromium.org/399028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_purger.h')
-rw-r--r--chrome/browser/memory_purger.h33
1 files changed, 13 insertions, 20 deletions
diff --git a/chrome/browser/memory_purger.h b/chrome/browser/memory_purger.h
index 12cb821..2da3917 100644
--- a/chrome/browser/memory_purger.h
+++ b/chrome/browser/memory_purger.h
@@ -2,35 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// MemoryPurger is designed to be used a singleton which listens for
-// suspend/resume notifications and purges as much memory as possible before
-// suspend. The hope is that it will be faster to recalculate or manually
-// reload this data on resume than to let the OS page everything out and then
-// fault it back in.
+// MemoryPurger provides static APIs to purge as much memory as possible from
+// all processes. These can be hooked to various signals to try and balance
+// memory consumption, speed, page swapping, etc.
#ifndef CHROME_BROWSER_MEMORY_PURGER_H_
#define CHROME_BROWSER_MEMORY_PURGER_H_
-#include "base/system_monitor.h"
+#include "base/basictypes.h"
-template<typename Type>
-struct DefaultSingletonTraits;
+class RenderProcessHost;
+class SafeBrowsingService;
-class MemoryPurger : public base::SystemMonitor::PowerObserver {
+class MemoryPurger {
public:
- static MemoryPurger* GetSingleton();
-
- // PowerObserver
- virtual void OnSuspend();
- virtual void OnResume();
+ // Call any of these on the UI thread to purge memory from the named places.
+ static void PurgeAll();
+ static void PurgeBrowser();
+ static void PurgeRenderers();
+ static void PurgeRendererForHost(RenderProcessHost* host);
private:
- MemoryPurger();
- virtual ~MemoryPurger();
-
- friend struct DefaultSingletonTraits<MemoryPurger>;
-
- DISALLOW_COPY_AND_ASSIGN(MemoryPurger);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryPurger);
};
#endif // CHROME_BROWSER_MEMORY_PURGER_H_