| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 171 #include "base/values.h" | 171 #include "base/values.h" | 
| 172 #include "chrome/browser/autocomplete/autocomplete_log.h" | 172 #include "chrome/browser/autocomplete/autocomplete_log.h" | 
| 173 #include "chrome/browser/browser_process.h" | 173 #include "chrome/browser/browser_process.h" | 
| 174 #include "chrome/browser/extensions/extension_service.h" | 174 #include "chrome/browser/extensions/extension_service.h" | 
| 175 #include "chrome/browser/extensions/process_map.h" | 175 #include "chrome/browser/extensions/process_map.h" | 
| 176 #include "chrome/browser/io_thread.h" | 176 #include "chrome/browser/io_thread.h" | 
| 177 #include "chrome/browser/memory_details.h" | 177 #include "chrome/browser/memory_details.h" | 
| 178 #include "chrome/browser/metrics/metrics_log.h" | 178 #include "chrome/browser/metrics/metrics_log.h" | 
| 179 #include "chrome/browser/metrics/metrics_log_serializer.h" | 179 #include "chrome/browser/metrics/metrics_log_serializer.h" | 
| 180 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 180 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 
|  | 181 #include "chrome/browser/metrics/time_ticks_field_trial_win.h" | 
| 181 #include "chrome/browser/metrics/tracking_synchronizer.h" | 182 #include "chrome/browser/metrics/tracking_synchronizer.h" | 
| 182 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 183 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 
| 183 #include "chrome/browser/net/network_stats.h" | 184 #include "chrome/browser/net/network_stats.h" | 
| 184 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 185 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 
| 185 #include "chrome/browser/profiles/profile.h" | 186 #include "chrome/browser/profiles/profile.h" | 
| 186 #include "chrome/browser/search_engines/template_url_service.h" | 187 #include "chrome/browser/search_engines/template_url_service.h" | 
| 187 #include "chrome/browser/ui/browser_list.h" | 188 #include "chrome/browser/ui/browser_list.h" | 
| 188 #include "chrome/browser/ui/browser_otr_state.h" | 189 #include "chrome/browser/ui/browser_otr_state.h" | 
| 189 #include "chrome/common/child_process_logging.h" | 190 #include "chrome/common/child_process_logging.h" | 
| 190 #include "chrome/common/chrome_process_type.h" | 191 #include "chrome/common/chrome_process_type.h" | 
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1544   // subsequent re-tries. Hence, we'll at most delay slowing the upload rate by | 1545   // subsequent re-tries. Hence, we'll at most delay slowing the upload rate by | 
| 1545   // one re-try, which is fine. | 1546   // one re-try, which is fine. | 
| 1546   scheduler_->UploadFinished(server_is_healthy, log_manager_.has_unsent_logs()); | 1547   scheduler_->UploadFinished(server_is_healthy, log_manager_.has_unsent_logs()); | 
| 1547 | 1548 | 
| 1548   // Collect network stats if UMA upload succeeded. | 1549   // Collect network stats if UMA upload succeeded. | 
| 1549   IOThread* io_thread = g_browser_process->io_thread(); | 1550   IOThread* io_thread = g_browser_process->io_thread(); | 
| 1550   if (server_is_healthy && io_thread) { | 1551   if (server_is_healthy && io_thread) { | 
| 1551     chrome_browser_net::CollectNetworkStats(network_stats_server_, io_thread); | 1552     chrome_browser_net::CollectNetworkStats(network_stats_server_, io_thread); | 
| 1552     chrome_browser_net::CollectPipeliningCapabilityStatsOnUIThread( | 1553     chrome_browser_net::CollectPipeliningCapabilityStatsOnUIThread( | 
| 1553         http_pipelining_test_server_, io_thread); | 1554         http_pipelining_test_server_, io_thread); | 
|  | 1555 #if defined(OS_WIN) | 
|  | 1556     chrome_browser_metrics::CollectTimeTicksStats(); | 
|  | 1557 #endif | 
| 1554   } | 1558   } | 
| 1555 } | 1559 } | 
| 1556 | 1560 | 
| 1557 void MetricsService::LogWindowOrTabChange(int type, uintptr_t window_or_tab) { | 1561 void MetricsService::LogWindowOrTabChange(int type, uintptr_t window_or_tab) { | 
| 1558   int controller_id = -1; | 1562   int controller_id = -1; | 
| 1559   MetricsLog::WindowEventType window_type; | 1563   MetricsLog::WindowEventType window_type; | 
| 1560 | 1564 | 
| 1561   // Note: since we stop all logging when a single OTR session is active, it is | 1565   // Note: since we stop all logging when a single OTR session is active, it is | 
| 1562   // possible that we start getting notifications about a window that we don't | 1566   // possible that we start getting notifications about a window that we don't | 
| 1563   // know about. | 1567   // know about. | 
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1870   if (local_state) { | 1874   if (local_state) { | 
| 1871     const PrefService::Preference* uma_pref = | 1875     const PrefService::Preference* uma_pref = | 
| 1872         local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1876         local_state->FindPreference(prefs::kMetricsReportingEnabled); | 
| 1873     if (uma_pref) { | 1877     if (uma_pref) { | 
| 1874       bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1878       bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 
| 1875       DCHECK(success); | 1879       DCHECK(success); | 
| 1876     } | 1880     } | 
| 1877   } | 1881   } | 
| 1878   return result; | 1882   return result; | 
| 1879 } | 1883 } | 
| OLD | NEW | 
|---|