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 is | 10 // A MetricsService instance is typically created at application startup. It is |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 #include "chrome/browser/metrics/metrics_log.h" | 181 #include "chrome/browser/metrics/metrics_log.h" |
182 #include "chrome/browser/metrics/metrics_log_serializer.h" | 182 #include "chrome/browser/metrics/metrics_log_serializer.h" |
183 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 183 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" |
184 #include "chrome/browser/metrics/time_ticks_experiment_win.h" | 184 #include "chrome/browser/metrics/time_ticks_experiment_win.h" |
185 #include "chrome/browser/metrics/tracking_synchronizer.h" | 185 #include "chrome/browser/metrics/tracking_synchronizer.h" |
186 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 186 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
187 #include "chrome/browser/net/network_stats.h" | 187 #include "chrome/browser/net/network_stats.h" |
188 #include "chrome/browser/omnibox/omnibox_log.h" | 188 #include "chrome/browser/omnibox/omnibox_log.h" |
189 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 189 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
190 #include "chrome/browser/profiles/profile.h" | 190 #include "chrome/browser/profiles/profile.h" |
191 #include "chrome/browser/search_engines/template_url_service.h" | |
192 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
191 #include "chrome/browser/ui/browser_list.h" | 193 #include "chrome/browser/ui/browser_list.h" |
192 #include "chrome/browser/ui/browser_otr_state.h" | 194 #include "chrome/browser/ui/browser_otr_state.h" |
193 #include "chrome/browser/ui/search/search_tab_helper.h" | 195 #include "chrome/browser/ui/search/search_tab_helper.h" |
194 #include "chrome/common/child_process_logging.h" | 196 #include "chrome/common/child_process_logging.h" |
195 #include "chrome/common/chrome_result_codes.h" | 197 #include "chrome/common/chrome_result_codes.h" |
196 #include "chrome/common/chrome_switches.h" | 198 #include "chrome/common/chrome_switches.h" |
197 #include "chrome/common/metrics/entropy_provider.h" | 199 #include "chrome/common/metrics/entropy_provider.h" |
198 #include "chrome/common/metrics/metrics_log_manager.h" | 200 #include "chrome/common/metrics/metrics_log_manager.h" |
199 #include "chrome/common/net/test_server_locations.h" | 201 #include "chrome/common/net/test_server_locations.h" |
200 #include "chrome/common/pref_names.h" | 202 #include "chrome/common/pref_names.h" |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1509 void MetricsService::LogLoadStarted(content::WebContents* web_contents) { | 1511 void MetricsService::LogLoadStarted(content::WebContents* web_contents) { |
1510 content::RecordAction(content::UserMetricsAction("PageLoad")); | 1512 content::RecordAction(content::UserMetricsAction("PageLoad")); |
1511 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); | 1513 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); |
1512 IncrementPrefValue(prefs::kStabilityPageLoadCount); | 1514 IncrementPrefValue(prefs::kStabilityPageLoadCount); |
1513 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); | 1515 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); |
1514 // We need to save the prefs, as page load count is a critical stat, and it | 1516 // We need to save the prefs, as page load count is a critical stat, and it |
1515 // might be lost due to a crash :-(. | 1517 // might be lost due to a crash :-(. |
1516 | 1518 |
1517 // Track whether the page loaded is a search results page. | 1519 // Track whether the page loaded is a search results page. |
1518 if (web_contents) { | 1520 if (web_contents) { |
1519 SearchTabHelper* search_tab_helper = | 1521 Profile* profile = |
1520 SearchTabHelper::FromWebContents(web_contents); | 1522 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
1521 if (search_tab_helper) { | 1523 bool is_search_results = |
1522 if (search_tab_helper->model()->mode().is_search_results()) | 1524 TemplateURLServiceFactory::GetForProfile(profile)-> |
1523 content::RecordAction(content::UserMetricsAction("PageLoadSRP")); | 1525 IsSearchResultsPageFromDefaultSearchProvider( |
1524 } | 1526 web_contents->GetLastCommittedURL()); |
rpetterson
2013/07/31 22:49:21
My biggest dilemma is here. I have available the L
Mark P
2013/07/31 23:16:49
What do you mean by this?
I know we emit PageLoad
Peter Kasting
2013/07/31 23:56:51
What you want depends on what this metric means an
| |
1527 if (is_search_results) | |
1528 content::RecordAction( | |
1529 content::UserMetricsAction("PageLoadSRPonDefaultSearchProvider")); | |
1525 } | 1530 } |
1526 } | 1531 } |
1527 | 1532 |
1528 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, | 1533 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, |
1529 base::TerminationStatus status, | 1534 base::TerminationStatus status, |
1530 int exit_code) { | 1535 int exit_code) { |
1531 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1536 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
1532 ExtensionService* service = profile->GetExtensionService(); | 1537 ExtensionService* service = profile->GetExtensionService(); |
1533 bool was_extension_process = | 1538 bool was_extension_process = |
1534 service && service->process_map()->Contains(host->GetID()); | 1539 service && service->process_map()->Contains(host->GetID()); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1754 if (local_state) { | 1759 if (local_state) { |
1755 const PrefService::Preference* uma_pref = | 1760 const PrefService::Preference* uma_pref = |
1756 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1761 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1757 if (uma_pref) { | 1762 if (uma_pref) { |
1758 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1763 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1759 DCHECK(success); | 1764 DCHECK(success); |
1760 } | 1765 } |
1761 } | 1766 } |
1762 return result; | 1767 return result; |
1763 } | 1768 } |
OLD | NEW |