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

Unified Diff: base/memory/memory_pressure_monitor_win.h

Issue 2097753002: Make memory pressure notifier configurable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment 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
Index: base/memory/memory_pressure_monitor_win.h
diff --git a/base/memory/memory_pressure_monitor_win.h b/base/memory/memory_pressure_monitor_win.h
index 5689ac6ac74a2befa9f2fac5d749948562953437..1fc4781a0b2f705a76e5bb804300da3dc7485caf 100644
--- a/base/memory/memory_pressure_monitor_win.h
+++ b/base/memory/memory_pressure_monitor_win.h
@@ -70,6 +70,8 @@ class BASE_EXPORT MemoryPressureMonitor : public base::MemoryPressureMonitor {
// Returns the critical pressure level free memory threshold, in MB.
int critical_threshold_mb() const { return critical_threshold_mb_; }
+ void SetObserver(MemoryPressureMonitorObserver* observer) override;
+
protected:
// Internals are exposed for unittests.
@@ -112,6 +114,8 @@ class BASE_EXPORT MemoryPressureMonitor : public base::MemoryPressureMonitor {
virtual bool GetSystemMemoryStatus(MEMORYSTATUSEX* mem_status);
private:
+ void Notify(MemoryPressureLevel level);
+
// Threshold amounts of available memory that trigger pressure levels. See
// memory_pressure_monitor.cc for a discussion of reasonable values for these.
int moderate_threshold_mb_;
@@ -132,6 +136,8 @@ class BASE_EXPORT MemoryPressureMonitor : public base::MemoryPressureMonitor {
// Ensures that this object is used from a single thread.
base::ThreadChecker thread_checker_;
+ MemoryPressureMonitorObserver* observer_ = nullptr;
+
// Weak pointer factory to ourself used for scheduling calls to
// CheckMemoryPressure/CheckMemoryPressureAndRecordStatistics via |timer_|.
base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698