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

Unified Diff: base/memory/memory_pressure_monitor_linux.h

Issue 1250093006: Added memory pressure monitor for linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-upload with less restrictive copy detection. 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
Index: base/memory/memory_pressure_monitor_linux.h
diff --git a/base/memory/memory_pressure_monitor_chromeos.h b/base/memory/memory_pressure_monitor_linux.h
similarity index 85%
copy from base/memory/memory_pressure_monitor_chromeos.h
copy to base/memory/memory_pressure_monitor_linux.h
index ff8992a56314ae33b29bac7dc4c40c20f6af42b6..bb6486d9ad44be91dbdc829947487ed2a822ac21 100644
--- a/base/memory/memory_pressure_monitor_chromeos.h
+++ b/base/memory/memory_pressure_monitor_linux.h
@@ -1,12 +1,11 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_
-#define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_
+#ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_LINUX_H_
+#define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_LINUX_H_
#include "base/base_export.h"
-#include "base/files/scoped_file.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/memory_pressure_listener.h"
@@ -15,7 +14,7 @@
#include "base/timer/timer.h"
namespace base {
-namespace chromeos {
+namespace nix {
chrisha 2015/07/24 13:25:46 This doesn't feel like the right namespace. In fa
proberge 2015/07/24 19:03:10 Done, but note that my C++ is very rusty and that
class TestMemoryPressureMonitor;
@@ -50,7 +49,7 @@ class BASE_EXPORT MemoryPressureMonitor : public base::MemoryPressureMonitor {
THRESHOLD_AGGRESSIVE = 4
};
chrisha 2015/07/24 13:25:46 This ends up copying a *lot* from the ChromeOS pre
proberge 2015/07/24 19:03:10 Removed some more logic. If we were to merge the t
- explicit MemoryPressureMonitor(MemoryPressureThresholds thresholds);
+ MemoryPressureMonitor();
~MemoryPressureMonitor() override;
// Redo the memory pressure calculation soon and call again if a critical
@@ -59,8 +58,8 @@ class BASE_EXPORT MemoryPressureMonitor : public base::MemoryPressureMonitor {
void ScheduleEarlyCheck();
// Get the current memory pressure level.
- MemoryPressureListener::MemoryPressureLevel GetCurrentPressureLevel() const
- override;
+ MemoryPressureListener::MemoryPressureLevel GetCurrentPressureLevel()
+ const override;
// Returns a type-casted version of the current memory pressure monitor. A
// simple wrapper to base::MemoryPressureMonitor::Get.
@@ -101,19 +100,12 @@ class BASE_EXPORT MemoryPressureMonitor : public base::MemoryPressureMonitor {
// gets used to count the number of events since the last event occured.
int moderate_pressure_repeat_count_;
- // The thresholds for moderate and critical pressure.
- const int moderate_pressure_threshold_percent_;
- const int critical_pressure_threshold_percent_;
-
- // File descriptor used to detect low memory condition.
- ScopedFD low_mem_file_;
-
base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor);
};
-} // namespace chromeos
+} // namespace nix
} // namespace base
-#endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_
+#endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_LINUX_H_

Powered by Google App Engine
This is Rietveld 408576698