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

Unified Diff: base/memory/memory_pressure_monitor_mac.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_mac.h ('k') | base/memory/memory_pressure_monitor_mac_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_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
« no previous file with comments | « base/memory/memory_pressure_monitor_mac.h ('k') | base/memory/memory_pressure_monitor_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698