| 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 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 pref->SetInt64(path, value + 1); | 1507 pref->SetInt64(path, value + 1); |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 void MetricsService::LogLoadStarted(content::WebContents* web_contents) { | 1510 void MetricsService::LogLoadStarted(content::WebContents* web_contents) { |
| 1511 content::RecordAction(content::UserMetricsAction("PageLoad")); | 1511 content::RecordAction(content::UserMetricsAction("PageLoad")); |
| 1512 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); | 1512 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); |
| 1513 IncrementPrefValue(prefs::kStabilityPageLoadCount); | 1513 IncrementPrefValue(prefs::kStabilityPageLoadCount); |
| 1514 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); | 1514 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); |
| 1515 // We need to save the prefs, as page load count is a critical stat, and it | 1515 // We need to save the prefs, as page load count is a critical stat, and it |
| 1516 // might be lost due to a crash :-(. | 1516 // might be lost due to a crash :-(. |
| 1517 | |
| 1518 // Track whether the page loaded is a search results page. | |
| 1519 if (web_contents) { | |
| 1520 SearchTabHelper* search_tab_helper = | |
| 1521 SearchTabHelper::FromWebContents(web_contents); | |
| 1522 if (search_tab_helper) { | |
| 1523 if (search_tab_helper->model()->mode().is_search_results()) | |
| 1524 content::RecordAction(content::UserMetricsAction("PageLoadSRP")); | |
| 1525 } | |
| 1526 } | |
| 1527 } | 1517 } |
| 1528 | 1518 |
| 1529 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, | 1519 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, |
| 1530 base::TerminationStatus status, | 1520 base::TerminationStatus status, |
| 1531 int exit_code) { | 1521 int exit_code) { |
| 1532 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1522 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 1533 ExtensionService* service = profile->GetExtensionService(); | 1523 ExtensionService* service = profile->GetExtensionService(); |
| 1534 bool was_extension_process = | 1524 bool was_extension_process = |
| 1535 service && service->process_map()->Contains(host->GetID()); | 1525 service && service->process_map()->Contains(host->GetID()); |
| 1536 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || | 1526 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 if (local_state) { | 1745 if (local_state) { |
| 1756 const PrefService::Preference* uma_pref = | 1746 const PrefService::Preference* uma_pref = |
| 1757 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1747 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1758 if (uma_pref) { | 1748 if (uma_pref) { |
| 1759 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1749 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1760 DCHECK(success); | 1750 DCHECK(success); |
| 1761 } | 1751 } |
| 1762 } | 1752 } |
| 1763 return result; | 1753 return result; |
| 1764 } | 1754 } |
| OLD | NEW |