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

Unified Diff: base/memory/memory_pressure_monitor.h

Issue 2097753002: Make memory pressure notifier configurable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/memory/memory_pressure_monitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_pressure_monitor.h
diff --git a/base/memory/memory_pressure_monitor.h b/base/memory/memory_pressure_monitor.h
index 6073bd3f44ca8f26b953a31967406c747e35bb58..70542f5ebc24fb3ec02eb57b64b03eb15e91edeb 100644
--- a/base/memory/memory_pressure_monitor.h
+++ b/base/memory/memory_pressure_monitor.h
@@ -6,6 +6,7 @@
#define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_H_
#include "base/base_export.h"
+#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/memory_pressure_listener.h"
@@ -32,10 +33,20 @@ class BASE_EXPORT MemoryPressureMonitor {
// Returns the currently observed memory pressure.
virtual MemoryPressureLevel GetCurrentPressureLevel() const = 0;
+ // Sets a notification callback. Once a callback is set,
danakj 2016/06/30 18:48:05 I tried to get this from the doc, but I think mayb
bashi 2016/06/30 23:33:10 We are implementing MemoryCoordinator which will r
danakj 2016/07/01 20:49:28 A virtual interface would do the same, where Memor
bashi 2016/07/03 23:54:47 That makes sense. Done.
+ // MemoryPressureMonitor pushes memory pressure notifications to the callback
+ // instead of base::MemoryPressureListener::NotifyMemoryPressure.
+ using Notifier = base::Callback<void(MemoryPressureLevel level)>;
danakj 2016/06/30 18:48:05 "Notifier" is the wrong direction here. The notifi
bashi 2016/06/30 23:33:10 The callback replaces MemoryPressureListener::Noti
danakj 2016/07/01 20:49:28 Yes, and the monitor notifies it by that, so it *i
+ void SetNotifier(const Notifier& notifier) { notifier_ = notifier; }
danakj 2016/07/01 20:49:28 Can we DCHECK that this is only set once? Or only
bashi 2016/07/03 23:54:47 Added DCHECK.
+
+ void Notify(MemoryPressureLevel level);
bashi 2016/06/27 03:47:54 public because this is called by a static method (
+
protected:
MemoryPressureMonitor();
private:
+ Notifier notifier_;
+
DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
};
« no previous file with comments | « no previous file | base/memory/memory_pressure_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698