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

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 win Created 4 years, 5 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_chromeos.h » ('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..a4adba4f3ad8d79913e1d2030568eead002d18b4 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"
@@ -23,6 +24,7 @@ namespace base {
class BASE_EXPORT MemoryPressureMonitor {
public:
using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel;
+ using DispatchCallback = base::Callback<void(MemoryPressureLevel level)>;
virtual ~MemoryPressureMonitor();
@@ -32,6 +34,10 @@ class BASE_EXPORT MemoryPressureMonitor {
// Returns the currently observed memory pressure.
virtual MemoryPressureLevel GetCurrentPressureLevel() const = 0;
+ // Sets a notification callback. The default callback invokes
+ // base::MemoryPressureListener::NotifyMemoryPressure.
+ virtual void SetDispatchCallback(const DispatchCallback& callback) = 0;
+
protected:
MemoryPressureMonitor();
« no previous file with comments | « no previous file | base/memory/memory_pressure_monitor_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698