| 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 1065 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 // renderer/child processes. Wait time specifies how long to wait before |
| 1087 // calling us back on the task. | 1087 // absolutely calling us back on the task. |
| 1088 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( | 1088 HistogramSynchronizer::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 |