OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
7 // | 7 // |
8 // OVERVIEW | 8 // OVERVIEW |
9 // | 9 // |
10 // A MetricsService instance is typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 #include "chrome/browser/ui/browser_list.h" | 171 #include "chrome/browser/ui/browser_list.h" |
172 #include "chrome/common/child_process_logging.h" | 172 #include "chrome/common/child_process_logging.h" |
173 #include "chrome/common/chrome_notification_types.h" | 173 #include "chrome/common/chrome_notification_types.h" |
174 #include "chrome/common/chrome_switches.h" | 174 #include "chrome/common/chrome_switches.h" |
175 #include "chrome/common/guid.h" | 175 #include "chrome/common/guid.h" |
176 #include "chrome/common/metrics_log_manager.h" | 176 #include "chrome/common/metrics_log_manager.h" |
177 #include "chrome/common/pref_names.h" | 177 #include "chrome/common/pref_names.h" |
178 #include "chrome/common/render_messages.h" | 178 #include "chrome/common/render_messages.h" |
179 #include "content/browser/load_notification_details.h" | 179 #include "content/browser/load_notification_details.h" |
180 #include "content/browser/plugin_service.h" | 180 #include "content/browser/plugin_service.h" |
181 #include "content/browser/renderer_host/render_process_host.h" | |
182 #include "content/public/browser/notification_service.h" | 181 #include "content/public/browser/notification_service.h" |
| 182 #include "content/public/browser/render_process_host.h" |
183 #include "content/public/common/url_fetcher.h" | 183 #include "content/public/common/url_fetcher.h" |
184 #include "webkit/plugins/webplugininfo.h" | 184 #include "webkit/plugins/webplugininfo.h" |
185 | 185 |
186 // TODO(port): port browser_distribution.h. | 186 // TODO(port): port browser_distribution.h. |
187 #if !defined(OS_POSIX) | 187 #if !defined(OS_POSIX) |
188 #include "chrome/installer/util/browser_distribution.h" | 188 #include "chrome/installer/util/browser_distribution.h" |
189 #endif | 189 #endif |
190 | 190 |
191 #if defined(OS_CHROMEOS) | 191 #if defined(OS_CHROMEOS) |
192 #include "chrome/browser/chromeos/cros/cros_library.h" | 192 #include "chrome/browser/chromeos/cros/cros_library.h" |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); | 1235 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); |
1236 IncrementPrefValue(prefs::kStabilityPageLoadCount); | 1236 IncrementPrefValue(prefs::kStabilityPageLoadCount); |
1237 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); | 1237 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); |
1238 // We need to save the prefs, as page load count is a critical stat, and it | 1238 // We need to save the prefs, as page load count is a critical stat, and it |
1239 // might be lost due to a crash :-(. | 1239 // might be lost due to a crash :-(. |
1240 } | 1240 } |
1241 | 1241 |
1242 void MetricsService::LogRendererCrash(RenderProcessHost* host, | 1242 void MetricsService::LogRendererCrash(RenderProcessHost* host, |
1243 base::TerminationStatus status, | 1243 base::TerminationStatus status, |
1244 bool was_alive) { | 1244 bool was_alive) { |
1245 Profile* profile = Profile::FromBrowserContext(host->browser_context()); | 1245 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
1246 ExtensionService* service = profile->GetExtensionService(); | 1246 ExtensionService* service = profile->GetExtensionService(); |
1247 bool was_extension_process = | 1247 bool was_extension_process = |
1248 service && service->process_map()->Contains(host->id()); | 1248 service && service->process_map()->Contains(host->GetID()); |
1249 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || | 1249 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || |
1250 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { | 1250 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { |
1251 if (was_extension_process) | 1251 if (was_extension_process) |
1252 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); | 1252 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); |
1253 else | 1253 else |
1254 IncrementPrefValue(prefs::kStabilityRendererCrashCount); | 1254 IncrementPrefValue(prefs::kStabilityRendererCrashCount); |
1255 | 1255 |
1256 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", | 1256 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", |
1257 was_extension_process ? 2 : 1); | 1257 was_extension_process ? 2 : 1); |
1258 if (was_alive) { | 1258 if (was_alive) { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 if (local_state) { | 1545 if (local_state) { |
1546 const PrefService::Preference* uma_pref = | 1546 const PrefService::Preference* uma_pref = |
1547 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1547 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1548 if (uma_pref) { | 1548 if (uma_pref) { |
1549 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1549 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1550 DCHECK(success); | 1550 DCHECK(success); |
1551 } | 1551 } |
1552 } | 1552 } |
1553 return result; | 1553 return result; |
1554 } | 1554 } |
OLD | NEW |