Re-size frame only for printing selection
[chromium-blink-merge.git] / base / memory / memory_pressure_monitor.h
blob9aeeaca3cdca26f0f1376af981000cfeced6aa5b
1 // Copyright 2015 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.
5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_
6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_
8 #include "base/base_export.h"
9 #include "base/memory/memory_pressure_listener.h"
11 namespace base {
13 // Declares the interface for a MemoryPressureMonitor. There are multiple
14 // OS specific implementations of this class. An instance of the memory
15 // pressure observer is created at the process level, tracks memory usage, and
16 // pushes memory state change notifications to the static function
17 // base::MemoryPressureListener::NotifyMemoryPressure. This is turn notifies
18 // all MemoryPressureListener instances via a callback.
19 class BASE_EXPORT MemoryPressureMonitor {
20 public:
21 using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel;
23 // Return the singleton MemoryPressureMonitor.
24 static MemoryPressureMonitor* Get();
26 // Returns the currently observed memory pressure.
27 virtual MemoryPressureLevel GetCurrentPressureLevel() const = 0;
29 protected:
30 MemoryPressureMonitor();
31 virtual ~MemoryPressureMonitor();
33 private:
34 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
37 } // namespace base
39 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_