| OLD | NEW |
| 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 "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 5 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 pref->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0); | 119 pref->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0); |
| 120 } | 120 } |
| 121 | 121 |
| 122 count = pref->GetInteger(prefs::kStabilityRendererHangCount); | 122 count = pref->GetInteger(prefs::kStabilityRendererHangCount); |
| 123 if (count) { | 123 if (count) { |
| 124 stability_proto->set_renderer_hang_count(count); | 124 stability_proto->set_renderer_hang_count(count); |
| 125 pref->SetInteger(prefs::kStabilityRendererHangCount, 0); | 125 pref->SetInteger(prefs::kStabilityRendererHangCount, 0); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ChromeStabilityMetricsProvider::ClearSavedStabilityMetrics() { |
| 130 PrefService* local_state = g_browser_process->local_state(); |
| 131 |
| 132 // Clear all the prefs used in this class in UMA reports (which doesn't |
| 133 // include |kUninstallMetricsPageLoadCount| as it's not sent up by UMA). |
| 134 local_state->SetInteger(prefs::kStabilityChildProcessCrashCount, 0); |
| 135 local_state->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0); |
| 136 local_state->SetInteger(prefs::kStabilityPageLoadCount, 0); |
| 137 local_state->SetInteger(prefs::kStabilityRendererCrashCount, 0); |
| 138 local_state->SetInteger(prefs::kStabilityRendererHangCount, 0); |
| 139 } |
| 140 |
| 129 // static | 141 // static |
| 130 void ChromeStabilityMetricsProvider::RegisterPrefs( | 142 void ChromeStabilityMetricsProvider::RegisterPrefs( |
| 131 PrefRegistrySimple* registry) { | 143 PrefRegistrySimple* registry) { |
| 144 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); |
| 145 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount, |
| 146 0); |
| 132 registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 147 registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
| 133 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 148 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
| 134 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount, | |
| 135 0); | |
| 136 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); | 149 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); |
| 137 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); | 150 |
| 138 registry->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0); | 151 registry->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0); |
| 139 } | 152 } |
| 140 | 153 |
| 141 void ChromeStabilityMetricsProvider::Observe( | 154 void ChromeStabilityMetricsProvider::Observe( |
| 142 int type, | 155 int type, |
| 143 const content::NotificationSource& source, | 156 const content::NotificationSource& source, |
| 144 const content::NotificationDetails& details) { | 157 const content::NotificationDetails& details) { |
| 145 switch (type) { | 158 switch (type) { |
| 146 case content::NOTIFICATION_LOAD_START: { | 159 case content::NOTIFICATION_LOAD_START: { |
| 147 content::NavigationController* controller = | 160 content::NavigationController* controller = |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 was_extension_process ? 2 : 1); | 239 was_extension_process ? 2 : 1); |
| 227 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { | 240 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { |
| 228 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", | 241 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", |
| 229 was_extension_process ? 2 : 1); | 242 was_extension_process ? 2 : 1); |
| 230 } | 243 } |
| 231 } | 244 } |
| 232 | 245 |
| 233 void ChromeStabilityMetricsProvider::LogRendererHang() { | 246 void ChromeStabilityMetricsProvider::LogRendererHang() { |
| 234 IncrementPrefValue(prefs::kStabilityRendererHangCount); | 247 IncrementPrefValue(prefs::kStabilityRendererHangCount); |
| 235 } | 248 } |
| OLD | NEW |