| 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 #include "base/memory/memory_pressure_monitor_chromeos.h" | 5 #include "base/memory/memory_pressure_monitor_chromeos.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/select.h> | 8 #include <sys/select.h> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 StopObserving(); | 127 StopObserving(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void MemoryPressureMonitor::ScheduleEarlyCheck() { | 130 void MemoryPressureMonitor::ScheduleEarlyCheck() { |
| 131 ThreadTaskRunnerHandle::Get()->PostTask( | 131 ThreadTaskRunnerHandle::Get()->PostTask( |
| 132 FROM_HERE, Bind(&MemoryPressureMonitor::CheckMemoryPressure, | 132 FROM_HERE, Bind(&MemoryPressureMonitor::CheckMemoryPressure, |
| 133 weak_ptr_factory_.GetWeakPtr())); | 133 weak_ptr_factory_.GetWeakPtr())); |
| 134 } | 134 } |
| 135 | 135 |
| 136 MemoryPressureListener::MemoryPressureLevel | 136 MemoryPressureListener::MemoryPressureLevel |
| 137 MemoryPressureMonitor::GetCurrentPressureLevel() const { | 137 MemoryPressureMonitor::GetCurrentPressureLevel() { |
| 138 return current_memory_pressure_level_; | 138 return current_memory_pressure_level_; |
| 139 } | 139 } |
| 140 | 140 |
| 141 // static | 141 // static |
| 142 MemoryPressureMonitor* MemoryPressureMonitor::Get() { | 142 MemoryPressureMonitor* MemoryPressureMonitor::Get() { |
| 143 return static_cast<MemoryPressureMonitor*>( | 143 return static_cast<MemoryPressureMonitor*>( |
| 144 base::MemoryPressureMonitor::Get()); | 144 base::MemoryPressureMonitor::Get()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void MemoryPressureMonitor::StartObserving() { | 147 void MemoryPressureMonitor::StartObserving() { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 return percentage; | 279 return percentage; |
| 280 } | 280 } |
| 281 | 281 |
| 282 void MemoryPressureMonitor::SetDispatchCallback( | 282 void MemoryPressureMonitor::SetDispatchCallback( |
| 283 const DispatchCallback& callback) { | 283 const DispatchCallback& callback) { |
| 284 dispatch_callback_ = callback; | 284 dispatch_callback_ = callback; |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace chromeos | 287 } // namespace chromeos |
| 288 } // namespace base | 288 } // namespace base |
| OLD | NEW |