Chromium Code Reviews| 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_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ | 5 #ifndef BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ |
| 6 #define BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ | 6 #define BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 THRESHOLD_AGGRESSIVE_CACHE_DISCARD = 2, | 43 THRESHOLD_AGGRESSIVE_CACHE_DISCARD = 2, |
| 44 // Discard tabs earlier, allowing the system to get faster. | 44 // Discard tabs earlier, allowing the system to get faster. |
| 45 THRESHOLD_AGGRESSIVE_TAB_DISCARD = 3, | 45 THRESHOLD_AGGRESSIVE_TAB_DISCARD = 3, |
| 46 // Discard caches and tabs earlier to allow the system to be faster. | 46 // Discard caches and tabs earlier to allow the system to be faster. |
| 47 THRESHOLD_AGGRESSIVE = 4 | 47 THRESHOLD_AGGRESSIVE = 4 |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 explicit MemoryPressureObserverChromeOS(MemoryPressureThresholds thresholds); | 50 explicit MemoryPressureObserverChromeOS(MemoryPressureThresholds thresholds); |
| 51 virtual ~MemoryPressureObserverChromeOS(); | 51 virtual ~MemoryPressureObserverChromeOS(); |
| 52 | 52 |
| 53 // Return the memory pressure management threshold. Controlled by a flag and | |
| 54 // FieldTrial. | |
|
Mr4D (OOO till 08-26)
2015/02/06 03:56:35
Not here.
| |
| 55 static MemoryPressureThresholds GetMemoryPressureThresholds(); | |
| 56 | |
| 53 // Redo the memory pressure calculation soon and call again if a critical | 57 // Redo the memory pressure calculation soon and call again if a critical |
| 54 // memory pressure prevails. Note that this call will trigger an asynchronous | 58 // memory pressure prevails. Note that this call will trigger an asynchronous |
| 55 // action which gives the system time to release memory back into the pool. | 59 // action which gives the system time to release memory back into the pool. |
| 56 void ScheduleEarlyCheck(); | 60 void ScheduleEarlyCheck(); |
| 57 | 61 |
| 58 // Get the current memory pressure level. | 62 // Get the current memory pressure level. |
| 59 base::MemoryPressureListener::MemoryPressureLevel GetCurrentPressureLevel() { | 63 base::MemoryPressureListener::MemoryPressureLevel GetCurrentPressureLevel() { |
| 60 return current_memory_pressure_level_; | 64 return current_memory_pressure_level_; |
| 61 } | 65 } |
| 62 | 66 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 const int critical_pressure_threshold_percent_; | 104 const int critical_pressure_threshold_percent_; |
| 101 | 105 |
| 102 base::WeakPtrFactory<MemoryPressureObserverChromeOS> weak_ptr_factory_; | 106 base::WeakPtrFactory<MemoryPressureObserverChromeOS> weak_ptr_factory_; |
| 103 | 107 |
| 104 DISALLOW_COPY_AND_ASSIGN(MemoryPressureObserverChromeOS); | 108 DISALLOW_COPY_AND_ASSIGN(MemoryPressureObserverChromeOS); |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 } // namespace base | 111 } // namespace base |
| 108 | 112 |
| 109 #endif // BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ | 113 #endif // BASE_CHROMEOS_MEMORY_PRESSURE_OBSERVER_CHROMEOS_H_ |
| OLD | NEW |