OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_ | 5 #ifndef COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_ |
6 #define COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_ | 6 #define COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_ |
7 | 7 |
8 #include "components/memory_pressure/memory_pressure_calculator.h" | 8 #include "components/memory_pressure/memory_pressure_calculator.h" |
9 | 9 |
10 #include "base/process/process_metrics.h" | 10 #include "base/process/process_metrics.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // Default constructor. Will choose thresholds automatically based on the | 32 // Default constructor. Will choose thresholds automatically based on the |
33 // actual amount of system memory installed. | 33 // actual amount of system memory installed. |
34 DirectMemoryPressureCalculator(); | 34 DirectMemoryPressureCalculator(); |
35 | 35 |
36 // Constructor with explicit memory thresholds. These represent the amount of | 36 // Constructor with explicit memory thresholds. These represent the amount of |
37 // free memory below which the applicable memory pressure state applies. | 37 // free memory below which the applicable memory pressure state applies. |
38 DirectMemoryPressureCalculator(int moderate_threshold_mb, | 38 DirectMemoryPressureCalculator(int moderate_threshold_mb, |
39 int critical_threshold_mb); | 39 int critical_threshold_mb); |
40 | 40 |
41 virtual ~DirectMemoryPressureCalculator() override {} | 41 ~DirectMemoryPressureCalculator() override {} |
42 | 42 |
43 // Calculates the current pressure level. | 43 // Calculates the current pressure level. |
44 MemoryPressureLevel CalculateCurrentPressureLevel() override; | 44 MemoryPressureLevel CalculateCurrentPressureLevel() override; |
45 | 45 |
46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
47 int moderate_threshold_mb() const { return moderate_threshold_mb_; } | 47 int moderate_threshold_mb() const { return moderate_threshold_mb_; } |
48 int critical_threshold_mb() const { return critical_threshold_mb_; } | 48 int critical_threshold_mb() const { return critical_threshold_mb_; } |
49 #endif | 49 #endif |
50 | 50 |
51 private: | 51 private: |
(...skipping 16 matching lines...) Expand all Loading... |
68 #endif | 68 #endif |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(DirectMemoryPressureCalculator); | 70 DISALLOW_COPY_AND_ASSIGN(DirectMemoryPressureCalculator); |
71 }; | 71 }; |
72 | 72 |
73 #endif // defined(MEMORY_PRESSURE_IS_POLLING) | 73 #endif // defined(MEMORY_PRESSURE_IS_POLLING) |
74 | 74 |
75 } // namespace memory_pressure | 75 } // namespace memory_pressure |
76 | 76 |
77 #endif // COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_ | 77 #endif // COMPONENTS_MEMORY_PRESSURE_DIRECT_MEMORY_PRESSURE_CALCULATOR_H_ |
OLD | NEW |