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

Unified Diff: base/memory/memory_pressure_monitor_win.cc

Issue 1250093006: Added memory pressure monitor for linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uncomment ::Get functionality Created 5 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 | « base/memory/memory_pressure_monitor_win.h ('k') | base/memory/memory_pressure_monitor_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_pressure_monitor_win.cc
diff --git a/base/memory/memory_pressure_monitor_win.cc b/base/memory/memory_pressure_monitor_win.cc
index 4349d035806c3efe6689c0846b7d787a11e467ce..9e50444a62f52bc64f68e83a0befe12ccbd3bbf3 100644
--- a/base/memory/memory_pressure_monitor_win.cc
+++ b/base/memory/memory_pressure_monitor_win.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/memory_pressure_monitor_win.h"
+#include "base/memory/memory_pressure_monitor.h"
#include <windows.h>
@@ -12,7 +12,6 @@
#include "base/time/time.h"
namespace base {
-namespace win {
namespace {
@@ -95,12 +94,18 @@ MemoryPressureMonitor::MemoryPressureMonitor(int moderate_threshold_mb,
MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE),
moderate_pressure_repeat_count_(0),
weak_ptr_factory_(this) {
+ DCHECK(!g_monitor);
+ g_monitor = this;
+
DCHECK_GE(moderate_threshold_mb_, critical_threshold_mb_);
DCHECK_LE(0, critical_threshold_mb_);
StartObserving();
}
MemoryPressureMonitor::~MemoryPressureMonitor() {
+ DCHECK(g_monitor);
+ g_monitor = nullptr;
+
StopObserving();
}
@@ -250,5 +255,4 @@ bool MemoryPressureMonitor::GetSystemMemoryStatus(
return true;
}
-} // namespace win
} // namespace base
« no previous file with comments | « base/memory/memory_pressure_monitor_win.h ('k') | base/memory/memory_pressure_monitor_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698