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

Side by Side Diff: content/browser/memory/memory_monitor_android.cc

Issue 2550623002: Add MemoryCoordinator::GetGlobalMemoryState() (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/browser/memory/memory_monitor_android.h" 5 #include "content/browser/memory/memory_monitor_android.h"
6 6
7 #include "base/android/context_utils.h" 7 #include "base/android/context_utils.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 // The maximum level of onTrimMemory (TRIM_MEMORY_COMPLETE). 67 // The maximum level of onTrimMemory (TRIM_MEMORY_COMPLETE).
68 const int kTrimMemoryLevelMax = 0x80; 68 const int kTrimMemoryLevelMax = 0x80;
69 69
70 // Called by JNI. 70 // Called by JNI.
71 static void OnTrimMemory(JNIEnv* env, 71 static void OnTrimMemory(JNIEnv* env,
72 const base::android::JavaParamRef<jclass>& jcaller, 72 const base::android::JavaParamRef<jclass>& jcaller,
73 jint level) { 73 jint level) {
74 DCHECK(level >= 0 && level <= kTrimMemoryLevelMax); 74 DCHECK(level >= 0 && level <= kTrimMemoryLevelMax);
75 auto state = MemoryCoordinator::GetInstance()->GetCurrentMemoryState(); 75 auto state = MemoryCoordinator::GetInstance()->GetGlobalMemoryState();
76 switch (state) { 76 switch (state) {
77 case base::MemoryState::NORMAL: 77 case base::MemoryState::NORMAL:
78 UMA_HISTOGRAM_ENUMERATION("Memory.Coordinator.TrimMemoryLevel.Normal", 78 UMA_HISTOGRAM_ENUMERATION("Memory.Coordinator.TrimMemoryLevel.Normal",
79 level, kTrimMemoryLevelMax); 79 level, kTrimMemoryLevelMax);
80 break; 80 break;
81 case base::MemoryState::THROTTLED: 81 case base::MemoryState::THROTTLED:
82 UMA_HISTOGRAM_ENUMERATION("Memory.Coordinator.TrimMemoryLevel.Throttled", 82 UMA_HISTOGRAM_ENUMERATION("Memory.Coordinator.TrimMemoryLevel.Throttled",
83 level, kTrimMemoryLevelMax); 83 level, kTrimMemoryLevelMax);
84 break; 84 break;
85 case base::MemoryState::SUSPENDED: 85 case base::MemoryState::SUSPENDED:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void MemoryMonitorAndroid::GetMemoryInfo(MemoryInfo* out) { 120 void MemoryMonitorAndroid::GetMemoryInfo(MemoryInfo* out) {
121 delegate_->GetMemoryInfo(out); 121 delegate_->GetMemoryInfo(out);
122 } 122 }
123 123
124 // Implementation of a factory function defined in memory_monitor.h. 124 // Implementation of a factory function defined in memory_monitor.h.
125 std::unique_ptr<MemoryMonitor> CreateMemoryMonitor() { 125 std::unique_ptr<MemoryMonitor> CreateMemoryMonitor() {
126 return MemoryMonitorAndroid::Create(); 126 return MemoryMonitorAndroid::Create();
127 } 127 }
128 128
129 } // namespace content 129 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698