Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Side by Side Diff: base/memory/memory_pressure_monitor.h

Issue 1122863005: Create base::win::MemoryPressureMonitor class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thakis@ and brucedawson@ comments. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_ 5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_
6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_ 6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/memory/memory_pressure_listener.h" 9 #include "base/memory/memory_pressure_listener.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 // Declares the interface for a MemoryPressureMonitor. There are multiple 13 // Declares the interface for a MemoryPressureMonitor. There are multiple
14 // OS specific implementations of this class. An instance of the memory 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 15 // pressure observer is created at the process level, tracks memory usage, and
16 // pushes memory state change notifications to the static function 16 // pushes memory state change notifications to the static function
17 // base::MemoryPressureListener::NotifyMemoryPressure. This is turn notifies 17 // base::MemoryPressureListener::NotifyMemoryPressure. This is turn notifies
18 // all MemoryPressureListener instances via a callback. 18 // all MemoryPressureListener instances via a callback.
19 class BASE_EXPORT MemoryPressureMonitor { 19 class BASE_EXPORT MemoryPressureMonitor {
20 public: 20 public:
21 using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel; 21 using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel;
22 22
23 // Exposed for use with scoped_ptr.
grt (UTC plus 2) 2015/05/06 13:26:36 the fact that you need this for scoped_ptr at the
chrisha 2015/05/06 15:09:57 Done.
24 virtual ~MemoryPressureMonitor();
25
23 // Return the singleton MemoryPressureMonitor. 26 // Return the singleton MemoryPressureMonitor.
24 static MemoryPressureMonitor* Get(); 27 static MemoryPressureMonitor* Get();
25 28
26 // Returns the currently observed memory pressure. 29 // Returns the currently observed memory pressure.
27 virtual MemoryPressureLevel GetCurrentPressureLevel() const = 0; 30 virtual MemoryPressureLevel GetCurrentPressureLevel() const = 0;
28 31
29 protected: 32 protected:
30 MemoryPressureMonitor(); 33 MemoryPressureMonitor();
31 virtual ~MemoryPressureMonitor();
32 34
33 private: 35 private:
34 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); 36 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
35 }; 37 };
36 38
37 } // namespace base 39 } // namespace base
38 40
39 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_ 41 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698