• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // MemoryPurger provides static APIs to purge as much memory as possible from
6 // all processes.  These can be hooked to various signals to try and balance
7 // memory consumption, speed, page swapping, etc.
8 //
9 // This was implemented in an attempt to speed up suspend-to-disk by throwing
10 // away any cached data that can be recomputed.  Memory use will rapidly
11 // re-expand after this purge is run.
12 
13 #ifndef CHROME_BROWSER_MEMORY_PURGER_H_
14 #define CHROME_BROWSER_MEMORY_PURGER_H_
15 
16 #include "base/basictypes.h"
17 
18 namespace content {
19 class RenderProcessHost;
20 }
21 
22 class MemoryPurger {
23  public:
24   // Call any of these on the UI thread to purge memory from the named places.
25   static void PurgeAll();
26   static void PurgeBrowser();
27   static void PurgeRenderers();
28   static void PurgeRendererForHost(content::RenderProcessHost* host);
29 
30  private:
31   DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryPurger);
32 };
33 
34 #endif  // CHROME_BROWSER_MEMORY_PURGER_H_
35