summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_purger.h
blob: 4b7c553d1f59c27827496b79fafffb170a06c850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// 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.
//
// This was implemented in an attempt to speed up suspend-to-disk by throwing
// away any cached data that can be recomputed.  Memory use will rapidly
// re-expand after this purge is run.

#ifndef CHROME_BROWSER_MEMORY_PURGER_H_
#define CHROME_BROWSER_MEMORY_PURGER_H_
#pragma once

#include "base/basictypes.h"

namespace content {
class RenderProcessHost;
}

class MemoryPurger {
 public:
  // 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(content::RenderProcessHost* host);

 private:
  DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryPurger);
};

#endif  // CHROME_BROWSER_MEMORY_PURGER_H_