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 #include "chrome/browser/android/metrics/uma_session_stats.h" | 5 #include "chrome/browser/android/metrics/uma_session_stats.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 base::Bind( | 107 base::Bind( |
108 base::IgnoreResult(GoogleUpdateSettings::SetCollectStatsConsent), | 108 base::IgnoreResult(GoogleUpdateSettings::SetCollectStatsConsent), |
109 may_record)); | 109 may_record)); |
110 } | 110 } |
111 | 111 |
112 g_browser_process->GetMetricsServicesManager()->UpdatePermissions( | 112 g_browser_process->GetMetricsServicesManager()->UpdatePermissions( |
113 may_record, may_upload); | 113 may_record, may_upload); |
114 } | 114 } |
115 | 115 |
116 // Renderer process crashed in the foreground. | 116 // Renderer process crashed in the foreground. |
117 static void LogRendererCrash(JNIEnv* env, | 117 static void LogRendererCrash(JNIEnv*, const JavaParamRef<jclass>&) { |
118 const JavaParamRef<jclass>& clazz, | |
119 jboolean is_paused) { | |
120 DCHECK(g_browser_process); | 118 DCHECK(g_browser_process); |
121 | 119 // Increment the renderer crash count in stability metrics. |
122 if (!is_paused) { | 120 PrefService* pref = g_browser_process->local_state(); |
123 // Increment the renderer crash count in stability metrics. | 121 DCHECK(pref); |
124 PrefService* pref = g_browser_process->local_state(); | 122 int value = pref->GetInteger(prefs::kStabilityRendererCrashCount); |
125 DCHECK(pref); | 123 pref->SetInteger(prefs::kStabilityRendererCrashCount, value + 1); |
126 int value = pref->GetInteger(prefs::kStabilityRendererCrashCount); | |
127 pref->SetInteger(prefs::kStabilityRendererCrashCount, value + 1); | |
128 } | |
129 | |
130 // Note: When we are paused, any UI metric we increment may not make it to | |
131 // the disk before we are killed. Treat the count below as a lower bound. | |
132 content::RecordAction(base::UserMetricsAction("MobileRendererCrashed")); | |
133 } | 124 } |
134 | 125 |
135 static void RegisterExternalExperiment(JNIEnv* env, | 126 static void RegisterExternalExperiment(JNIEnv* env, |
136 const JavaParamRef<jclass>& clazz, | 127 const JavaParamRef<jclass>& clazz, |
137 jint study_id, | 128 jint study_id, |
138 jint experiment_id) { | 129 jint experiment_id) { |
139 const std::string group_name_utf8 = base::IntToString(experiment_id); | 130 const std::string group_name_utf8 = base::IntToString(experiment_id); |
140 | 131 |
141 variations::ActiveGroupId active_group; | 132 variations::ActiveGroupId active_group; |
142 active_group.name = static_cast<uint32>(study_id); | 133 active_group.name = static_cast<uint32>(study_id); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // We should have only one UmaSessionStats instance. | 191 // We should have only one UmaSessionStats instance. |
201 DCHECK(!g_uma_session_stats); | 192 DCHECK(!g_uma_session_stats); |
202 g_uma_session_stats = new UmaSessionStats(); | 193 g_uma_session_stats = new UmaSessionStats(); |
203 return reinterpret_cast<intptr_t>(g_uma_session_stats); | 194 return reinterpret_cast<intptr_t>(g_uma_session_stats); |
204 } | 195 } |
205 | 196 |
206 // Register native methods | 197 // Register native methods |
207 bool RegisterUmaSessionStats(JNIEnv* env) { | 198 bool RegisterUmaSessionStats(JNIEnv* env) { |
208 return RegisterNativesImpl(env); | 199 return RegisterNativesImpl(env); |
209 } | 200 } |
OLD | NEW |