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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 #include "base/threading/thread_restrictions.h" | 156 #include "base/threading/thread_restrictions.h" |
157 #include "base/tracked_objects.h" | 157 #include "base/tracked_objects.h" |
158 #include "base/utf_string_conversions.h" | 158 #include "base/utf_string_conversions.h" |
159 #include "base/values.h" | 159 #include "base/values.h" |
160 #include "chrome/browser/bookmarks/bookmark_model.h" | 160 #include "chrome/browser/bookmarks/bookmark_model.h" |
161 #include "chrome/browser/browser_process.h" | 161 #include "chrome/browser/browser_process.h" |
162 #include "chrome/browser/extensions/extension_service.h" | 162 #include "chrome/browser/extensions/extension_service.h" |
163 #include "chrome/browser/extensions/process_map.h" | 163 #include "chrome/browser/extensions/process_map.h" |
164 #include "chrome/browser/io_thread.h" | 164 #include "chrome/browser/io_thread.h" |
165 #include "chrome/browser/memory_details.h" | 165 #include "chrome/browser/memory_details.h" |
166 #include "chrome/browser/metrics/histogram_synchronizer.h" | |
167 #include "chrome/browser/metrics/metrics_log.h" | 166 #include "chrome/browser/metrics/metrics_log.h" |
168 #include "chrome/browser/metrics/metrics_log_serializer.h" | 167 #include "chrome/browser/metrics/metrics_log_serializer.h" |
169 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 168 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" |
170 #include "chrome/browser/metrics/tracking_synchronizer.h" | 169 #include "chrome/browser/metrics/tracking_synchronizer.h" |
171 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 170 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
172 #include "chrome/browser/net/network_stats.h" | 171 #include "chrome/browser/net/network_stats.h" |
173 #include "chrome/browser/prefs/pref_service.h" | 172 #include "chrome/browser/prefs/pref_service.h" |
174 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 173 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
175 #include "chrome/browser/profiles/profile.h" | 174 #include "chrome/browser/profiles/profile.h" |
176 #include "chrome/browser/search_engines/template_url_service.h" | 175 #include "chrome/browser/search_engines/template_url_service.h" |
177 #include "chrome/browser/ui/browser_list.h" | 176 #include "chrome/browser/ui/browser_list.h" |
178 #include "chrome/common/child_process_logging.h" | 177 #include "chrome/common/child_process_logging.h" |
179 #include "chrome/common/chrome_notification_types.h" | 178 #include "chrome/common/chrome_notification_types.h" |
180 #include "chrome/common/chrome_switches.h" | 179 #include "chrome/common/chrome_switches.h" |
181 #include "chrome/common/guid.h" | 180 #include "chrome/common/guid.h" |
182 #include "chrome/common/metrics/metrics_log_manager.h" | 181 #include "chrome/common/metrics/metrics_log_manager.h" |
183 #include "chrome/common/net/test_server_locations.h" | 182 #include "chrome/common/net/test_server_locations.h" |
184 #include "chrome/common/pref_names.h" | 183 #include "chrome/common/pref_names.h" |
185 #include "chrome/common/render_messages.h" | 184 #include "chrome/common/render_messages.h" |
186 #include "content/public/browser/child_process_data.h" | 185 #include "content/public/browser/child_process_data.h" |
| 186 #include "content/public/browser/histogram_fetcher.h" |
187 #include "content/public/browser/load_notification_details.h" | 187 #include "content/public/browser/load_notification_details.h" |
188 #include "content/public/browser/notification_service.h" | 188 #include "content/public/browser/notification_service.h" |
189 #include "content/public/browser/plugin_service.h" | 189 #include "content/public/browser/plugin_service.h" |
190 #include "content/public/browser/render_process_host.h" | 190 #include "content/public/browser/render_process_host.h" |
191 #include "content/public/common/url_fetcher.h" | 191 #include "content/public/common/url_fetcher.h" |
192 #include "net/base/load_flags.h" | 192 #include "net/base/load_flags.h" |
193 #include "webkit/plugins/webplugininfo.h" | 193 #include "webkit/plugins/webplugininfo.h" |
194 | 194 |
195 // TODO(port): port browser_distribution.h. | 195 // TODO(port): port browser_distribution.h. |
196 #if !defined(OS_POSIX) | 196 #if !defined(OS_POSIX) |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 DCHECK(waiting_for_asynchronus_reporting_step_); | 1076 DCHECK(waiting_for_asynchronus_reporting_step_); |
1077 | 1077 |
1078 // Create a callback_task for OnHistogramSynchronizationDone. | 1078 // Create a callback_task for OnHistogramSynchronizationDone. |
1079 base::Closure callback = base::Bind( | 1079 base::Closure callback = base::Bind( |
1080 &MetricsService::OnHistogramSynchronizationDone, | 1080 &MetricsService::OnHistogramSynchronizationDone, |
1081 self_ptr_factory_.GetWeakPtr()); | 1081 self_ptr_factory_.GetWeakPtr()); |
1082 | 1082 |
1083 base::StatisticsRecorder::CollectHistogramStats("Browser"); | 1083 base::StatisticsRecorder::CollectHistogramStats("Browser"); |
1084 | 1084 |
1085 // Set up the callback to task to call after we receive histograms from all | 1085 // Set up the callback to task to call after we receive histograms from all |
1086 // renderer processes. Wait time specifies how long to wait before absolutely | 1086 // child processes. Wait time specifies how long to wait before absolutely |
1087 // calling us back on the task. | 1087 // calling us back on the task. |
1088 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( | 1088 content::FetchHistogramsAsynchronously( |
1089 MessageLoop::current(), callback, | 1089 MessageLoop::current(), callback, |
1090 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration)); | 1090 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration)); |
1091 } | 1091 } |
1092 | 1092 |
1093 void MetricsService::OnHistogramSynchronizationDone() { | 1093 void MetricsService::OnHistogramSynchronizationDone() { |
1094 DCHECK(IsSingleThreaded()); | 1094 DCHECK(IsSingleThreaded()); |
1095 // This function should only be called as the callback from an ansynchronous | 1095 // This function should only be called as the callback from an ansynchronous |
1096 // step. | 1096 // step. |
1097 DCHECK(waiting_for_asynchronus_reporting_step_); | 1097 DCHECK(waiting_for_asynchronus_reporting_step_); |
1098 | 1098 |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 if (local_state) { | 1821 if (local_state) { |
1822 const PrefService::Preference* uma_pref = | 1822 const PrefService::Preference* uma_pref = |
1823 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1823 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1824 if (uma_pref) { | 1824 if (uma_pref) { |
1825 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1825 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1826 DCHECK(success); | 1826 DCHECK(success); |
1827 } | 1827 } |
1828 } | 1828 } |
1829 return result; | 1829 return result; |
1830 } | 1830 } |
OLD | NEW |