| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 #include "chrome/common/metrics/metrics_log_manager.h" | 189 #include "chrome/common/metrics/metrics_log_manager.h" |
| 190 #include "chrome/common/net/test_server_locations.h" | 190 #include "chrome/common/net/test_server_locations.h" |
| 191 #include "chrome/common/pref_names.h" | 191 #include "chrome/common/pref_names.h" |
| 192 #include "chrome/common/render_messages.h" | 192 #include "chrome/common/render_messages.h" |
| 193 #include "content/public/browser/child_process_data.h" | 193 #include "content/public/browser/child_process_data.h" |
| 194 #include "content/public/browser/histogram_fetcher.h" | 194 #include "content/public/browser/histogram_fetcher.h" |
| 195 #include "content/public/browser/load_notification_details.h" | 195 #include "content/public/browser/load_notification_details.h" |
| 196 #include "content/public/browser/notification_service.h" | 196 #include "content/public/browser/notification_service.h" |
| 197 #include "content/public/browser/plugin_service.h" | 197 #include "content/public/browser/plugin_service.h" |
| 198 #include "content/public/browser/render_process_host.h" | 198 #include "content/public/browser/render_process_host.h" |
| 199 #include "content/public/browser/user_metrics.h" |
| 199 #include "net/base/load_flags.h" | 200 #include "net/base/load_flags.h" |
| 200 #include "net/url_request/url_fetcher.h" | 201 #include "net/url_request/url_fetcher.h" |
| 201 #include "webkit/plugins/webplugininfo.h" | 202 #include "webkit/plugins/webplugininfo.h" |
| 202 | 203 |
| 203 // TODO(port): port browser_distribution.h. | 204 // TODO(port): port browser_distribution.h. |
| 204 #if !defined(OS_POSIX) | 205 #if !defined(OS_POSIX) |
| 205 #include "chrome/installer/util/browser_distribution.h" | 206 #include "chrome/installer/util/browser_distribution.h" |
| 206 #endif | 207 #endif |
| 207 | 208 |
| 208 #if defined(OS_CHROMEOS) | 209 #if defined(OS_CHROMEOS) |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 } | 1576 } |
| 1576 | 1577 |
| 1577 void MetricsService::IncrementLongPrefsValue(const char* path) { | 1578 void MetricsService::IncrementLongPrefsValue(const char* path) { |
| 1578 PrefService* pref = g_browser_process->local_state(); | 1579 PrefService* pref = g_browser_process->local_state(); |
| 1579 DCHECK(pref); | 1580 DCHECK(pref); |
| 1580 int64 value = pref->GetInt64(path); | 1581 int64 value = pref->GetInt64(path); |
| 1581 pref->SetInt64(path, value + 1); | 1582 pref->SetInt64(path, value + 1); |
| 1582 } | 1583 } |
| 1583 | 1584 |
| 1584 void MetricsService::LogLoadStarted() { | 1585 void MetricsService::LogLoadStarted() { |
| 1586 content::RecordAction(content::UserMetricsAction("PageLoad")); |
| 1585 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); | 1587 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); |
| 1586 IncrementPrefValue(prefs::kStabilityPageLoadCount); | 1588 IncrementPrefValue(prefs::kStabilityPageLoadCount); |
| 1587 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); | 1589 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); |
| 1588 // We need to save the prefs, as page load count is a critical stat, and it | 1590 // We need to save the prefs, as page load count is a critical stat, and it |
| 1589 // might be lost due to a crash :-(. | 1591 // might be lost due to a crash :-(. |
| 1590 } | 1592 } |
| 1591 | 1593 |
| 1592 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, | 1594 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, |
| 1593 base::TerminationStatus status, | 1595 base::TerminationStatus status, |
| 1594 int exit_code) { | 1596 int exit_code) { |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1920 if (local_state) { | 1922 if (local_state) { |
| 1921 const PrefService::Preference* uma_pref = | 1923 const PrefService::Preference* uma_pref = |
| 1922 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1924 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1923 if (uma_pref) { | 1925 if (uma_pref) { |
| 1924 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1926 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1925 DCHECK(success); | 1927 DCHECK(success); |
| 1926 } | 1928 } |
| 1927 } | 1929 } |
| 1928 return result; | 1930 return result; |
| 1929 } | 1931 } |
| OLD | NEW |