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

Unified Diff: content/browser/memory/memory_monitor_linux.cc

Issue 2321313002: Move components/memory_coordinator -> content/ (Closed)
Patch Set: rebase etc Created 4 years, 3 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: content/browser/memory/memory_monitor_linux.cc
diff --git a/components/memory_coordinator/browser/memory_monitor_linux.cc b/content/browser/memory/memory_monitor_linux.cc
similarity index 81%
rename from components/memory_coordinator/browser/memory_monitor_linux.cc
rename to content/browser/memory/memory_monitor_linux.cc
index bd1cf500dae38fe9b9b3c490cdaef5bdff130379..08cf8027b0313811292ff36abc27be4ddf24c75b 100644
--- a/components/memory_coordinator/browser/memory_monitor_linux.cc
+++ b/content/browser/memory/memory_monitor_linux.cc
@@ -2,19 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/memory_coordinator/browser/memory_monitor_linux.h"
+#include "content/browser/memory/memory_monitor_linux.h"
#include "base/memory/ptr_util.h"
#include "base/process/process_metrics.h"
-namespace memory_coordinator {
+namespace content {
namespace {
-// A global static instance of the default delegate. Used by default by
-// MemoryMonitorLinux.
-MemoryMonitorDelegate g_memory_monitor_delegate;
-
// The number of bits to shift to convert KiB to MiB.
const int kShiftKiBtoMiB = 10;
@@ -23,6 +19,8 @@ const int kShiftKiBtoMiB = 10;
MemoryMonitorLinux::MemoryMonitorLinux(MemoryMonitorDelegate* delegate)
: delegate_(delegate) {}
+MemoryMonitorLinux::~MemoryMonitorLinux() {}
+
int MemoryMonitorLinux::GetFreeMemoryUntilCriticalMB() {
base::SystemMemoryInfoKB mem_info = {};
delegate_->GetSystemMemoryInfo(&mem_info);
@@ -48,7 +46,7 @@ std::unique_ptr<MemoryMonitorLinux> MemoryMonitorLinux::Create(
// Implementation of factory function defined in memory_monitor.h.
std::unique_ptr<MemoryMonitor> CreateMemoryMonitor() {
- return MemoryMonitorLinux::Create(&g_memory_monitor_delegate);
+ return MemoryMonitorLinux::Create(MemoryMonitorDelegate::GetInstance());
}
-} // namespace memory_coordinator
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698