| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 #include "base/rand_util.h" | 179 #include "base/rand_util.h" |
| 180 #include "base/strings/string_number_conversions.h" | 180 #include "base/strings/string_number_conversions.h" |
| 181 #include "base/strings/utf_string_conversions.h" | 181 #include "base/strings/utf_string_conversions.h" |
| 182 #include "base/threading/platform_thread.h" | 182 #include "base/threading/platform_thread.h" |
| 183 #include "base/threading/thread.h" | 183 #include "base/threading/thread.h" |
| 184 #include "base/threading/thread_restrictions.h" | 184 #include "base/threading/thread_restrictions.h" |
| 185 #include "base/tracked_objects.h" | 185 #include "base/tracked_objects.h" |
| 186 #include "base/values.h" | 186 #include "base/values.h" |
| 187 #include "chrome/browser/browser_process.h" | 187 #include "chrome/browser/browser_process.h" |
| 188 #include "chrome/browser/chrome_notification_types.h" | 188 #include "chrome/browser/chrome_notification_types.h" |
| 189 #include "chrome/browser/extensions/extension_service.h" | |
| 190 #include "chrome/browser/io_thread.h" | 189 #include "chrome/browser/io_thread.h" |
| 191 #include "chrome/browser/memory_details.h" | 190 #include "chrome/browser/memory_details.h" |
| 192 #include "chrome/browser/metrics/compression_utils.h" | 191 #include "chrome/browser/metrics/compression_utils.h" |
| 193 #include "chrome/browser/metrics/metrics_log.h" | 192 #include "chrome/browser/metrics/metrics_log.h" |
| 194 #include "chrome/browser/metrics/metrics_log_serializer.h" | 193 #include "chrome/browser/metrics/metrics_log_serializer.h" |
| 195 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 194 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" |
| 196 #include "chrome/browser/metrics/time_ticks_experiment_win.h" | 195 #include "chrome/browser/metrics/time_ticks_experiment_win.h" |
| 197 #include "chrome/browser/metrics/tracking_synchronizer.h" | 196 #include "chrome/browser/metrics/tracking_synchronizer.h" |
| 198 #include "chrome/common/metrics/variations/variations_util.h" | 197 #include "chrome/common/metrics/variations/variations_util.h" |
| 199 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 198 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
| 200 #include "chrome/browser/net/network_stats.h" | 199 #include "chrome/browser/net/network_stats.h" |
| 201 #include "chrome/browser/omnibox/omnibox_log.h" | 200 #include "chrome/browser/omnibox/omnibox_log.h" |
| 202 #include "chrome/browser/profiles/profile.h" | |
| 203 #include "chrome/browser/ui/browser_list.h" | 201 #include "chrome/browser/ui/browser_list.h" |
| 204 #include "chrome/browser/ui/browser_otr_state.h" | 202 #include "chrome/browser/ui/browser_otr_state.h" |
| 205 #include "chrome/browser/ui/search/search_tab_helper.h" | 203 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 206 #include "chrome/common/chrome_constants.h" | 204 #include "chrome/common/chrome_constants.h" |
| 207 #include "chrome/common/chrome_result_codes.h" | 205 #include "chrome/common/chrome_result_codes.h" |
| 208 #include "chrome/common/chrome_switches.h" | 206 #include "chrome/common/chrome_switches.h" |
| 209 #include "chrome/common/crash_keys.h" | 207 #include "chrome/common/crash_keys.h" |
| 210 #include "chrome/common/metrics/caching_permuted_entropy_provider.h" | 208 #include "chrome/common/metrics/caching_permuted_entropy_provider.h" |
| 211 #include "chrome/common/metrics/metrics_log_manager.h" | 209 #include "chrome/common/metrics/metrics_log_manager.h" |
| 212 #include "chrome/common/net/test_server_locations.h" | 210 #include "chrome/common/net/test_server_locations.h" |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); | 1751 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); |
| 1754 IncrementPrefValue(prefs::kStabilityPageLoadCount); | 1752 IncrementPrefValue(prefs::kStabilityPageLoadCount); |
| 1755 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); | 1753 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); |
| 1756 // We need to save the prefs, as page load count is a critical stat, and it | 1754 // We need to save the prefs, as page load count is a critical stat, and it |
| 1757 // might be lost due to a crash :-(. | 1755 // might be lost due to a crash :-(. |
| 1758 } | 1756 } |
| 1759 | 1757 |
| 1760 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, | 1758 void MetricsService::LogRendererCrash(content::RenderProcessHost* host, |
| 1761 base::TerminationStatus status, | 1759 base::TerminationStatus status, |
| 1762 int exit_code) { | 1760 int exit_code) { |
| 1763 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | |
| 1764 ExtensionService* service = profile->GetExtensionService(); | |
| 1765 bool was_extension_process = | 1761 bool was_extension_process = |
| 1766 service && service->process_map()->Contains(host->GetID()); | 1762 extensions::ProcessMap::Get(host->GetBrowserContext()) |
| 1763 ->Contains(host->GetID()); |
| 1767 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || | 1764 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || |
| 1768 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { | 1765 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { |
| 1769 if (was_extension_process) { | 1766 if (was_extension_process) { |
| 1770 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); | 1767 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); |
| 1771 | 1768 |
| 1772 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Extension", | 1769 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Extension", |
| 1773 MapCrashExitCodeForHistogram(exit_code)); | 1770 MapCrashExitCodeForHistogram(exit_code)); |
| 1774 } else { | 1771 } else { |
| 1775 IncrementPrefValue(prefs::kStabilityRendererCrashCount); | 1772 IncrementPrefValue(prefs::kStabilityRendererCrashCount); |
| 1776 | 1773 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 if (local_state) { | 2016 if (local_state) { |
| 2020 const PrefService::Preference* uma_pref = | 2017 const PrefService::Preference* uma_pref = |
| 2021 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 2018 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 2022 if (uma_pref) { | 2019 if (uma_pref) { |
| 2023 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 2020 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 2024 DCHECK(success); | 2021 DCHECK(success); |
| 2025 } | 2022 } |
| 2026 } | 2023 } |
| 2027 return result; | 2024 return result; |
| 2028 } | 2025 } |
| OLD | NEW |