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

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

Issue 2434103003: Add Mac memory pressure statistic reporting and consolidate platform code (Closed)
Patch Set: Add radar ID Created 4 years, 1 month 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
« no previous file with comments | « base/BUILD.gn ('k') | base/memory/memory_pressure_monitor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 13 matching lines...) Expand all
24 class BASE_EXPORT MemoryPressureMonitor { 24 class BASE_EXPORT MemoryPressureMonitor {
25 public: 25 public:
26 using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel; 26 using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel;
27 using DispatchCallback = base::Callback<void(MemoryPressureLevel level)>; 27 using DispatchCallback = base::Callback<void(MemoryPressureLevel level)>;
28 28
29 virtual ~MemoryPressureMonitor(); 29 virtual ~MemoryPressureMonitor();
30 30
31 // Return the singleton MemoryPressureMonitor. 31 // Return the singleton MemoryPressureMonitor.
32 static MemoryPressureMonitor* Get(); 32 static MemoryPressureMonitor* Get();
33 33
34 // Record memory pressure UMA statistic. A tick is 5 seconds.
35 static void RecordMemoryPressure(MemoryPressureLevel level, int ticks);
36
34 // Returns the currently observed memory pressure. 37 // Returns the currently observed memory pressure.
35 virtual MemoryPressureLevel GetCurrentPressureLevel() const = 0; 38 virtual MemoryPressureLevel GetCurrentPressureLevel() const = 0;
36 39
37 // Sets a notification callback. The default callback invokes 40 // Sets a notification callback. The default callback invokes
38 // base::MemoryPressureListener::NotifyMemoryPressure. 41 // base::MemoryPressureListener::NotifyMemoryPressure.
39 virtual void SetDispatchCallback(const DispatchCallback& callback) = 0; 42 virtual void SetDispatchCallback(const DispatchCallback& callback) = 0;
40 43
41 protected: 44 protected:
42 MemoryPressureMonitor(); 45 MemoryPressureMonitor();
43 46
44 private: 47 private:
45 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); 48 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
46 }; 49 };
47 50
48 } // namespace base 51 } // namespace base
49 52
50 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_ 53 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/memory/memory_pressure_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698