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