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

Unified Diff: components/memory_pressure/direct_memory_pressure_calculator_win.h

Issue 1573123003: Refactor direct_memory_pressure_calculator.h per platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GetSystemMemoryInfo. 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_win.h
diff --git a/components/memory_pressure/direct_memory_pressure_calculator.h b/components/memory_pressure/direct_memory_pressure_calculator_win.h
similarity index 96%
copy from components/memory_pressure/direct_memory_pressure_calculator.h
copy to components/memory_pressure/direct_memory_pressure_calculator_win.h
index a2bb60e46a98b470e9a5ecbbd0effebbf9a4cd2e..10e2d24e285758a1fc1343b596b8a3f122849ed8 100644
--- a/components/memory_pressure/direct_memory_pressure_calculator.h
+++ b/components/memory_pressure/direct_memory_pressure_calculator_win.h
@@ -2,8 +2,8 @@
// 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_H_
-#define COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_
+#ifndef COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_WIN_H_
+#define COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_WIN_H_
#include "components/memory_pressure/memory_pressure_calculator.h"
@@ -21,7 +21,6 @@ namespace memory_pressure {
// the appropriate subsystem (Android, Mac OS X).
class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
public:
-#if defined(OS_WIN)
// Exposed for unittesting. See .cc file for detailed discussion of these
// constants.
static const int kLargeMemoryThresholdMb;
@@ -29,7 +28,6 @@ class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
static const int kSmallMemoryDefaultCriticalThresholdMb;
static const int kLargeMemoryDefaultModerateThresholdMb;
static const int kLargeMemoryDefaultCriticalThresholdMb;
-#endif
// Default constructor. Will choose thresholds automatically based on the
// actual amount of system memory installed.
@@ -45,10 +43,8 @@ class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
// Calculates the current pressure level.
MemoryPressureLevel CalculateCurrentPressureLevel() override;
-#if defined(OS_WIN)
int moderate_threshold_mb() const { return moderate_threshold_mb_; }
int critical_threshold_mb() const { return critical_threshold_mb_; }
-#endif
private:
friend class TestDirectMemoryPressureCalculator;
@@ -57,7 +53,6 @@ class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
// default this invokes base::GetSystemMemoryInfo.
virtual bool GetSystemMemoryInfo(base::SystemMemoryInfoKB* mem_info) const;
-#if defined(OS_WIN)
// Uses GetSystemMemoryInfo to automatically infer appropriate values for
// moderate_threshold_mb_ and critical_threshold_mb_.
void InferThresholds();
@@ -67,7 +62,6 @@ class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
// these.
int moderate_threshold_mb_;
int critical_threshold_mb_;
-#endif
DISALLOW_COPY_AND_ASSIGN(DirectMemoryPressureCalculator);
};
@@ -76,4 +70,4 @@ class DirectMemoryPressureCalculator : public MemoryPressureCalculator {
} // namespace memory_pressure
-#endif // COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_
+#endif // COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698