OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ | 5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ |
6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ | 6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // Get the memory pressure in percent (virtual for testing). | 89 // Get the memory pressure in percent (virtual for testing). |
90 virtual int GetUsedMemoryInPercent(); | 90 virtual int GetUsedMemoryInPercent(); |
91 | 91 |
92 // The current memory pressure. | 92 // The current memory pressure. |
93 base::MemoryPressureListener::MemoryPressureLevel | 93 base::MemoryPressureListener::MemoryPressureLevel |
94 current_memory_pressure_level_; | 94 current_memory_pressure_level_; |
95 | 95 |
96 // A periodic timer to check for resource pressure changes. This will get | 96 // A periodic timer to check for resource pressure changes. This will get |
97 // replaced by a kernel triggered event system (see crbug.com/381196). | 97 // replaced by a kernel triggered event system (see crbug.com/381196). |
98 base::RepeatingTimer<MemoryPressureMonitor> timer_; | 98 base::RepeatingTimer timer_; |
99 | 99 |
100 // To slow down the amount of moderate pressure event calls, this counter | 100 // To slow down the amount of moderate pressure event calls, this counter |
101 // gets used to count the number of events since the last event occured. | 101 // gets used to count the number of events since the last event occured. |
102 int moderate_pressure_repeat_count_; | 102 int moderate_pressure_repeat_count_; |
103 | 103 |
104 // The thresholds for moderate and critical pressure. | 104 // The thresholds for moderate and critical pressure. |
105 const int moderate_pressure_threshold_percent_; | 105 const int moderate_pressure_threshold_percent_; |
106 const int critical_pressure_threshold_percent_; | 106 const int critical_pressure_threshold_percent_; |
107 | 107 |
108 // File descriptor used to detect low memory condition. | 108 // File descriptor used to detect low memory condition. |
109 ScopedFD low_mem_file_; | 109 ScopedFD low_mem_file_; |
110 | 110 |
111 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_; | 111 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); | 113 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace chromeos | 116 } // namespace chromeos |
117 } // namespace base | 117 } // namespace base |
118 | 118 |
119 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ | 119 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_CHROMEOS_H_ |
OLD | NEW |