| 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 BASE_MEMORY_MEMORY_PRESSURE_MONITOR_WIN_H_ | 5 #ifndef BASE_MEMORY_MEMORY_PRESSURE_MONITOR_WIN_H_ |
| 6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_WIN_H_ | 6 #define BASE_MEMORY_MEMORY_PRESSURE_MONITOR_WIN_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/memory_pressure_listener.h" | 10 #include "base/memory/memory_pressure_listener.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // free memory below which the applicable memory pressure state engages. | 55 // free memory below which the applicable memory pressure state engages. |
| 56 MemoryPressureMonitor(int moderate_threshold_mb, int critical_threshold_mb); | 56 MemoryPressureMonitor(int moderate_threshold_mb, int critical_threshold_mb); |
| 57 | 57 |
| 58 ~MemoryPressureMonitor() override; | 58 ~MemoryPressureMonitor() override; |
| 59 | 59 |
| 60 // Schedules a memory pressure check to run soon. This must be called on the | 60 // Schedules a memory pressure check to run soon. This must be called on the |
| 61 // same thread where the monitor was instantiated. | 61 // same thread where the monitor was instantiated. |
| 62 void CheckMemoryPressureSoon(); | 62 void CheckMemoryPressureSoon(); |
| 63 | 63 |
| 64 // Get the current memory pressure level. This can be called from any thread. | 64 // Get the current memory pressure level. This can be called from any thread. |
| 65 MemoryPressureLevel GetCurrentPressureLevel() const override; | 65 MemoryPressureLevel GetCurrentPressureLevel() override; |
| 66 void SetDispatchCallback(const DispatchCallback& callback) override; | 66 void SetDispatchCallback(const DispatchCallback& callback) override; |
| 67 | 67 |
| 68 // Returns the moderate pressure level free memory threshold, in MB. | 68 // Returns the moderate pressure level free memory threshold, in MB. |
| 69 int moderate_threshold_mb() const { return moderate_threshold_mb_; } | 69 int moderate_threshold_mb() const { return moderate_threshold_mb_; } |
| 70 | 70 |
| 71 // Returns the critical pressure level free memory threshold, in MB. | 71 // Returns the critical pressure level free memory threshold, in MB. |
| 72 int critical_threshold_mb() const { return critical_threshold_mb_; } | 72 int critical_threshold_mb() const { return critical_threshold_mb_; } |
| 73 | 73 |
| 74 protected: | 74 protected: |
| 75 // Internals are exposed for unittests. | 75 // Internals are exposed for unittests. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // CheckMemoryPressure/CheckMemoryPressureAndRecordStatistics via |timer_|. | 139 // CheckMemoryPressure/CheckMemoryPressureAndRecordStatistics via |timer_|. |
| 140 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_; | 140 base::WeakPtrFactory<MemoryPressureMonitor> weak_ptr_factory_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); | 142 DISALLOW_COPY_AND_ASSIGN(MemoryPressureMonitor); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace win | 145 } // namespace win |
| 146 } // namespace base | 146 } // namespace base |
| 147 | 147 |
| 148 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_WIN_H_ | 148 #endif // BASE_MEMORY_MEMORY_PRESSURE_MONITOR_WIN_H_ |
| OLD | NEW |