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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 #include "base/tracked_objects.h" | 160 #include "base/tracked_objects.h" |
161 #include "base/utf_string_conversions.h" | 161 #include "base/utf_string_conversions.h" |
162 #include "base/values.h" | 162 #include "base/values.h" |
163 #include "chrome/browser/autocomplete/autocomplete_log.h" | 163 #include "chrome/browser/autocomplete/autocomplete_log.h" |
164 #include "chrome/browser/bookmarks/bookmark_model.h" | 164 #include "chrome/browser/bookmarks/bookmark_model.h" |
165 #include "chrome/browser/browser_process.h" | 165 #include "chrome/browser/browser_process.h" |
166 #include "chrome/browser/extensions/extension_service.h" | 166 #include "chrome/browser/extensions/extension_service.h" |
167 #include "chrome/browser/extensions/process_map.h" | 167 #include "chrome/browser/extensions/process_map.h" |
168 #include "chrome/browser/io_thread.h" | 168 #include "chrome/browser/io_thread.h" |
169 #include "chrome/browser/memory_details.h" | 169 #include "chrome/browser/memory_details.h" |
170 #include "chrome/browser/metrics/histogram_synchronizer.h" | |
171 #include "chrome/browser/metrics/metrics_log.h" | 170 #include "chrome/browser/metrics/metrics_log.h" |
172 #include "chrome/browser/metrics/metrics_log_serializer.h" | 171 #include "chrome/browser/metrics/metrics_log_serializer.h" |
173 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 172 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" |
174 #include "chrome/browser/metrics/tracking_synchronizer.h" | 173 #include "chrome/browser/metrics/tracking_synchronizer.h" |
175 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 174 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
176 #include "chrome/browser/net/network_stats.h" | 175 #include "chrome/browser/net/network_stats.h" |
177 #include "chrome/browser/prefs/pref_service.h" | 176 #include "chrome/browser/prefs/pref_service.h" |
178 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 177 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
179 #include "chrome/browser/profiles/profile.h" | 178 #include "chrome/browser/profiles/profile.h" |
180 #include "chrome/browser/search_engines/template_url_service.h" | 179 #include "chrome/browser/search_engines/template_url_service.h" |
181 #include "chrome/browser/ui/browser_list.h" | 180 #include "chrome/browser/ui/browser_list.h" |
182 #include "chrome/common/child_process_logging.h" | 181 #include "chrome/common/child_process_logging.h" |
183 #include "chrome/common/chrome_notification_types.h" | 182 #include "chrome/common/chrome_notification_types.h" |
184 #include "chrome/common/chrome_result_codes.h" | 183 #include "chrome/common/chrome_result_codes.h" |
185 #include "chrome/common/chrome_switches.h" | 184 #include "chrome/common/chrome_switches.h" |
186 #include "chrome/common/metrics/metrics_log_manager.h" | 185 #include "chrome/common/metrics/metrics_log_manager.h" |
187 #include "chrome/common/net/test_server_locations.h" | 186 #include "chrome/common/net/test_server_locations.h" |
188 #include "chrome/common/pref_names.h" | 187 #include "chrome/common/pref_names.h" |
189 #include "chrome/common/render_messages.h" | 188 #include "chrome/common/render_messages.h" |
190 #include "content/public/browser/child_process_data.h" | 189 #include "content/public/browser/child_process_data.h" |
| 190 #include "content/public/browser/histogram_fetcher.h" |
191 #include "content/public/browser/load_notification_details.h" | 191 #include "content/public/browser/load_notification_details.h" |
192 #include "content/public/browser/notification_service.h" | 192 #include "content/public/browser/notification_service.h" |
193 #include "content/public/browser/plugin_service.h" | 193 #include "content/public/browser/plugin_service.h" |
194 #include "content/public/browser/render_process_host.h" | 194 #include "content/public/browser/render_process_host.h" |
195 #include "net/base/load_flags.h" | 195 #include "net/base/load_flags.h" |
196 #include "net/url_request/url_fetcher.h" | 196 #include "net/url_request/url_fetcher.h" |
197 #include "webkit/plugins/webplugininfo.h" | 197 #include "webkit/plugins/webplugininfo.h" |
198 | 198 |
199 // TODO(port): port browser_distribution.h. | 199 // TODO(port): port browser_distribution.h. |
200 #if !defined(OS_POSIX) | 200 #if !defined(OS_POSIX) |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 DCHECK(waiting_for_asynchronous_reporting_step_); | 1203 DCHECK(waiting_for_asynchronous_reporting_step_); |
1204 | 1204 |
1205 // Create a callback_task for OnHistogramSynchronizationDone. | 1205 // Create a callback_task for OnHistogramSynchronizationDone. |
1206 base::Closure callback = base::Bind( | 1206 base::Closure callback = base::Bind( |
1207 &MetricsService::OnHistogramSynchronizationDone, | 1207 &MetricsService::OnHistogramSynchronizationDone, |
1208 self_ptr_factory_.GetWeakPtr()); | 1208 self_ptr_factory_.GetWeakPtr()); |
1209 | 1209 |
1210 base::StatisticsRecorder::CollectHistogramStats("Browser"); | 1210 base::StatisticsRecorder::CollectHistogramStats("Browser"); |
1211 | 1211 |
1212 // Set up the callback to task to call after we receive histograms from all | 1212 // Set up the callback to task to call after we receive histograms from all |
1213 // renderer processes. Wait time specifies how long to wait before absolutely | 1213 // child processes. Wait time specifies how long to wait before absolutely |
1214 // calling us back on the task. | 1214 // calling us back on the task. |
1215 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( | 1215 content::FetchHistogramsAsynchronously( |
1216 MessageLoop::current(), callback, | 1216 MessageLoop::current(), callback, |
1217 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration)); | 1217 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration)); |
1218 } | 1218 } |
1219 | 1219 |
1220 void MetricsService::OnHistogramSynchronizationDone() { | 1220 void MetricsService::OnHistogramSynchronizationDone() { |
1221 DCHECK(IsSingleThreaded()); | 1221 DCHECK(IsSingleThreaded()); |
1222 // This function should only be called as the callback from an ansynchronous | 1222 // This function should only be called as the callback from an ansynchronous |
1223 // step. | 1223 // step. |
1224 DCHECK(waiting_for_asynchronous_reporting_step_); | 1224 DCHECK(waiting_for_asynchronous_reporting_step_); |
1225 | 1225 |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 if (local_state) { | 1902 if (local_state) { |
1903 const PrefService::Preference* uma_pref = | 1903 const PrefService::Preference* uma_pref = |
1904 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1904 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1905 if (uma_pref) { | 1905 if (uma_pref) { |
1906 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1906 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1907 DCHECK(success); | 1907 DCHECK(success); |
1908 } | 1908 } |
1909 } | 1909 } |
1910 return result; | 1910 return result; |
1911 } | 1911 } |
OLD | NEW |