| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 DCHECK(pref); | 121 DCHECK(pref); |
| 122 int value = pref->GetInteger(prefs::kStabilityRendererCrashCount); | 122 int value = pref->GetInteger(prefs::kStabilityRendererCrashCount); |
| 123 pref->SetInteger(prefs::kStabilityRendererCrashCount, value + 1); | 123 pref->SetInteger(prefs::kStabilityRendererCrashCount, value + 1); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Note: When we are paused, any UI metric we increment may not make it to | 126 // Note: When we are paused, any UI metric we increment may not make it to |
| 127 // the disk before we are killed. Treat the count below as a lower bound. | 127 // the disk before we are killed. Treat the count below as a lower bound. |
| 128 content::RecordAction(base::UserMetricsAction("MobileRendererCrashed")); | 128 content::RecordAction(base::UserMetricsAction("MobileRendererCrashed")); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Renderer process crashed in the background. |
| 132 static void LogBackgroundRendererCrashOnForegroundApp(JNIEnv* env, |
| 133 jclass clazz) { |
| 134 DCHECK(g_browser_process); |
| 135 |
| 136 content::RecordAction(base::UserMetricsAction( |
| 137 "MobileBackgroundRendererCrashedOnForegroundApp")); |
| 138 } |
| 139 |
| 131 static void RegisterExternalExperiment(JNIEnv* env, | 140 static void RegisterExternalExperiment(JNIEnv* env, |
| 132 jclass clazz, | 141 jclass clazz, |
| 133 jint study_id, | 142 jint study_id, |
| 134 jint experiment_id) { | 143 jint experiment_id) { |
| 135 const std::string group_name_utf8 = base::IntToString(experiment_id); | 144 const std::string group_name_utf8 = base::IntToString(experiment_id); |
| 136 | 145 |
| 137 variations::ActiveGroupId active_group; | 146 variations::ActiveGroupId active_group; |
| 138 active_group.name = static_cast<uint32>(study_id); | 147 active_group.name = static_cast<uint32>(study_id); |
| 139 active_group.group = metrics::HashName(group_name_utf8); | 148 active_group.group = metrics::HashName(group_name_utf8); |
| 140 variations::AssociateGoogleVariationIDForceHashes( | 149 variations::AssociateGoogleVariationIDForceHashes( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // We should have only one UmaSessionStats instance. | 199 // We should have only one UmaSessionStats instance. |
| 191 DCHECK(!g_uma_session_stats); | 200 DCHECK(!g_uma_session_stats); |
| 192 g_uma_session_stats = new UmaSessionStats(); | 201 g_uma_session_stats = new UmaSessionStats(); |
| 193 return reinterpret_cast<intptr_t>(g_uma_session_stats); | 202 return reinterpret_cast<intptr_t>(g_uma_session_stats); |
| 194 } | 203 } |
| 195 | 204 |
| 196 // Register native methods | 205 // Register native methods |
| 197 bool RegisterUmaSessionStats(JNIEnv* env) { | 206 bool RegisterUmaSessionStats(JNIEnv* env) { |
| 198 return RegisterNativesImpl(env); | 207 return RegisterNativesImpl(env); |
| 199 } | 208 } |
| OLD | NEW |