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

Unified Diff: components/memory_pressure/direct_memory_pressure_calculator_linux.h

Issue 1603413003: Add memory pressure monitor for Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: components/memory_pressure/direct_memory_pressure_calculator_linux.h
diff --git a/components/memory_pressure/direct_memory_pressure_calculator_win.h b/components/memory_pressure/direct_memory_pressure_calculator_linux.h
similarity index 82%
copy from components/memory_pressure/direct_memory_pressure_calculator_win.h
copy to components/memory_pressure/direct_memory_pressure_calculator_linux.h
index 10e2d24e285758a1fc1343b596b8a3f122849ed8..4fee7651b6dede8ba4a79fb01a8438a1a4af55cb 100644
--- a/components/memory_pressure/direct_memory_pressure_calculator_win.h
+++ b/components/memory_pressure/direct_memory_pressure_calculator_linux.h
@@ -1,20 +1,20 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 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 COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_WIN_H_
-#define COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_WIN_H_
+#ifndef COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_LINUX_H_
+#define COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_LINUX_H_
#include "components/memory_pressure/memory_pressure_calculator.h"
+#include "base/files/scoped_file.h"
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/process/process_metrics.h"
-#include "build/build_config.h"
+#include "base/timer/timer.h"
namespace memory_pressure {
-#if defined(MEMORY_PRESSURE_IS_POLLING)
chrisha 2016/01/20 20:55:43 The linux calculator is also polling, so this keep
Georges Khalil 2016/01/21 14:47:44 That ifdef is useless, it will always be true, sin
-
// OS-specific implementation of MemoryPressureCalculator. This is only defined
// and used on platforms that do not have native memory pressure signals
// (ChromeOS, Linux, Windows). OSes that do have native signals simply hook into
@@ -23,11 +23,8 @@ class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
public:
// Exposed for unittesting. See .cc file for detailed discussion of these
// constants.
- static const int kLargeMemoryThresholdMb;
- static const int kSmallMemoryDefaultModerateThresholdMb;
- static const int kSmallMemoryDefaultCriticalThresholdMb;
- static const int kLargeMemoryDefaultModerateThresholdMb;
- static const int kLargeMemoryDefaultCriticalThresholdMb;
+ static const int kDefaultModerateThresholdPc;
+ static const int kDefaultCriticalThresholdPc;
// Default constructor. Will choose thresholds automatically based on the
// actual amount of system memory installed.
@@ -66,8 +63,6 @@ class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
DISALLOW_COPY_AND_ASSIGN(DirectMemoryPressureCalculator);
};
-#endif // defined(MEMORY_PRESSURE_IS_POLLING)
-
} // namespace memory_pressure
-#endif // COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_WIN_H_
+#endif // COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_LINUX_H_

Powered by Google App Engine
This is Rietveld 408576698