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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 registrar_.Add(this, | 72 registrar_.Add(this, |
73 content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, | 73 content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, |
74 content::NotificationService::AllSources()); | 74 content::NotificationService::AllSources()); |
75 } | 75 } |
76 | 76 |
77 void ChromeStabilityMetricsProvider::OnRecordingDisabled() { | 77 void ChromeStabilityMetricsProvider::OnRecordingDisabled() { |
78 registrar_.RemoveAll(); | 78 registrar_.RemoveAll(); |
79 } | 79 } |
80 | 80 |
81 void ChromeStabilityMetricsProvider::ProvideStabilityMetrics( | 81 void ChromeStabilityMetricsProvider::ProvideStabilityMetrics( |
82 metrics::SystemProfileProto_Stability* stability_proto) { | 82 metrics::SystemProfileProto* system_profile_proto) { |
83 PrefService* pref = g_browser_process->local_state(); | 83 PrefService* pref = g_browser_process->local_state(); |
| 84 metrics::SystemProfileProto_Stability* stability_proto = |
| 85 system_profile_proto->mutable_stability(); |
84 | 86 |
85 int count = pref->GetInteger(prefs::kStabilityPageLoadCount); | 87 int count = pref->GetInteger(prefs::kStabilityPageLoadCount); |
86 if (count) { | 88 if (count) { |
87 stability_proto->set_page_load_count(count); | 89 stability_proto->set_page_load_count(count); |
88 pref->SetInteger(prefs::kStabilityPageLoadCount, 0); | 90 pref->SetInteger(prefs::kStabilityPageLoadCount, 0); |
89 } | 91 } |
90 | 92 |
91 count = pref->GetInteger(prefs::kStabilityRendererCrashCount); | 93 count = pref->GetInteger(prefs::kStabilityRendererCrashCount); |
92 if (count) { | 94 if (count) { |
93 stability_proto->set_renderer_crash_count(count); | 95 stability_proto->set_renderer_crash_count(count); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 was_extension_process ? 2 : 1); | 181 was_extension_process ? 2 : 1); |
180 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { | 182 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { |
181 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", | 183 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", |
182 was_extension_process ? 2 : 1); | 184 was_extension_process ? 2 : 1); |
183 } | 185 } |
184 } | 186 } |
185 | 187 |
186 void ChromeStabilityMetricsProvider::LogRendererHang() { | 188 void ChromeStabilityMetricsProvider::LogRendererHang() { |
187 IncrementPrefValue(prefs::kStabilityRendererHangCount); | 189 IncrementPrefValue(prefs::kStabilityRendererHangCount); |
188 } | 190 } |
OLD | NEW |