Index: base/memory/memory_pressure_monitor_mac.cc |
diff --git a/base/memory/memory_pressure_monitor_mac.cc b/base/memory/memory_pressure_monitor_mac.cc |
index f394935acb99ffe2738816dd722c415ab2e875d5..17cd455e77d03b37f33a3d836df10170cfe67963 100644 |
--- a/base/memory/memory_pressure_monitor_mac.cc |
+++ b/base/memory/memory_pressure_monitor_mac.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_mac.h" |
+#include "base/memory/memory_pressure_monitor.h" |
#include <dlfcn.h> |
#include <sys/sysctl.h> |
@@ -10,7 +10,6 @@ |
#include "base/mac/mac_util.h" |
namespace base { |
-namespace mac { |
MemoryPressureListener::MemoryPressureLevel |
MemoryPressureMonitor::MemoryPressureLevelForMacMemoryPressure( |
@@ -36,6 +35,9 @@ void MemoryPressureMonitor::NotifyMemoryPressureChanged( |
MemoryPressureMonitor::MemoryPressureMonitor() |
: memory_level_event_source_(nullptr) { |
+ DCHECK(!g_monitor); |
+ g_monitor = this; |
+ |
// _dispatch_source_type_memorypressure is not available prior to 10.9. |
dispatch_source_type_t dispatch_source_memorypressure = |
static_cast<dispatch_source_type_t> |
@@ -60,6 +62,8 @@ MemoryPressureMonitor::MemoryPressureMonitor() |
} |
MemoryPressureMonitor::~MemoryPressureMonitor() { |
+ DCHECK(g_monitor); |
+ g_monitor = nullptr; |
} |
MemoryPressureListener::MemoryPressureLevel |
@@ -74,5 +78,4 @@ MemoryPressureMonitor::GetCurrentPressureLevel() const { |
return MemoryPressureLevelForMacMemoryPressure(mac_memory_pressure); |
} |
-} // namespace mac |
} // namespace base |