Chromium Code Reviews| Index: content/browser/memory/memory_coordinator.cc |
| diff --git a/content/browser/memory/memory_coordinator.cc b/content/browser/memory/memory_coordinator.cc |
| index 517aaedc34a1a13f696d9e0532c5c4c9117458a1..513d9177d5971911a0241cee364cf9942520370f 100644 |
| --- a/content/browser/memory/memory_coordinator.cc |
| +++ b/content/browser/memory/memory_coordinator.cc |
| @@ -5,6 +5,7 @@ |
| #include "content/browser/memory/memory_coordinator.h" |
| #include "base/memory/memory_coordinator_client_registry.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "content/public/browser/content_browser_client.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/common/content_client.h" |
| @@ -120,6 +121,27 @@ mojom::MemoryState MemoryCoordinator::GetMemoryState( |
| return iter->second.memory_state; |
| } |
| +void MemoryCoordinator::RecordMemoryPressure( |
| + base::MemoryPressureMonitor::MemoryPressureLevel level) { |
| + int state = static_cast<int>(GetCurrentMemoryState()); |
| + switch (level) { |
| + case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: |
| + UMA_HISTOGRAM_ENUMERATION( |
| + "Memory.Coordinator.StateOnModerateNotificationReceived", |
| + state, base::kMemoryStateMax); |
| + break; |
| + case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: |
| + UMA_HISTOGRAM_ENUMERATION( |
| + "Memory.Coordinator.StateOnCriticalNotificationReceived", |
| + state, base::kMemoryStateMax); |
| + break; |
| + case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: |
| + // Fall through |
| + default: |
|
Ilya Sherman
2016/11/07 19:28:52
nit: It's generally best to omit the default case,
bashi
2016/11/08 00:33:35
Done.
|
| + NOTREACHED(); |
| + } |
| +} |
| + |
| void MemoryCoordinator::EnableFeaturesForTesting() { |
| base::FeatureList::ClearInstanceForTesting(); |
| std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |