Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: base/memory/memory_pressure_monitor_chromeos.cc

Issue 2434103003: Add Mac memory pressure statistic reporting and consolidate platform code (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 void MemoryPressureMonitor::StopObserving() { 154 void MemoryPressureMonitor::StopObserving() {
155 // If StartObserving failed, StopObserving will still get called. 155 // If StartObserving failed, StopObserving will still get called.
156 timer_.Stop(); 156 timer_.Stop();
157 } 157 }
158 158
159 void MemoryPressureMonitor::CheckMemoryPressureAndRecordStatistics() { 159 void MemoryPressureMonitor::CheckMemoryPressureAndRecordStatistics() {
160 CheckMemoryPressure(); 160 CheckMemoryPressure();
161 161
162 RecordMemoryPressure(current_memory_pressure_level_);
162 // Record UMA histogram statistics for the current memory pressure level. 163 // Record UMA histogram statistics for the current memory pressure level.
164 // TODO(lgrey): Remove this once there's a usable history for the
165 // "Memory.PressureLevel" statistic
163 MemoryPressureLevelUMA memory_pressure_level_uma(MEMORY_PRESSURE_LEVEL_NONE); 166 MemoryPressureLevelUMA memory_pressure_level_uma(MEMORY_PRESSURE_LEVEL_NONE);
164 switch (current_memory_pressure_level_) { 167 switch (current_memory_pressure_level_) {
165 case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: 168 case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
166 memory_pressure_level_uma = MEMORY_PRESSURE_LEVEL_NONE; 169 memory_pressure_level_uma = MEMORY_PRESSURE_LEVEL_NONE;
167 break; 170 break;
168 case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: 171 case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
169 memory_pressure_level_uma = MEMORY_PRESSURE_LEVEL_MODERATE; 172 memory_pressure_level_uma = MEMORY_PRESSURE_LEVEL_MODERATE;
170 break; 173 break;
171 case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: 174 case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
172 memory_pressure_level_uma = MEMORY_PRESSURE_LEVEL_CRITICAL; 175 memory_pressure_level_uma = MEMORY_PRESSURE_LEVEL_CRITICAL;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return percentage; 276 return percentage;
274 } 277 }
275 278
276 void MemoryPressureMonitor::SetDispatchCallback( 279 void MemoryPressureMonitor::SetDispatchCallback(
277 const DispatchCallback& callback) { 280 const DispatchCallback& callback) {
278 dispatch_callback_ = callback; 281 dispatch_callback_ = callback;
279 } 282 }
280 283
281 } // namespace chromeos 284 } // namespace chromeos
282 } // namespace base 285 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698