OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 // like to record: the histogram of memory usage, so we spawn a task to | 891 // like to record: the histogram of memory usage, so we spawn a task to |
892 // collect the memory details and when that task is finished, it will call | 892 // collect the memory details and when that task is finished, it will call |
893 // OnMemoryDetailCollectionDone, which will call HistogramSynchronization to | 893 // OnMemoryDetailCollectionDone, which will call HistogramSynchronization to |
894 // collect histograms from all renderers and then we will call | 894 // collect histograms from all renderers and then we will call |
895 // OnHistogramSynchronizationDone to continue processing. | 895 // OnHistogramSynchronizationDone to continue processing. |
896 | 896 |
897 // Create a callback_task for OnHistogramSynchronizationDone. | 897 // Create a callback_task for OnHistogramSynchronizationDone. |
898 Task* callback_task = log_sender_factory_.NewRunnableMethod( | 898 Task* callback_task = log_sender_factory_.NewRunnableMethod( |
899 &MetricsService::OnHistogramSynchronizationDone); | 899 &MetricsService::OnHistogramSynchronizationDone); |
900 | 900 |
| 901 base::StatisticsRecorder::CollectHistogramStats("Browser"); |
| 902 |
901 // Set up the callback to task to call after we receive histograms from all | 903 // Set up the callback to task to call after we receive histograms from all |
902 // renderer processes. Wait time specifies how long to wait before absolutely | 904 // renderer processes. Wait time specifies how long to wait before absolutely |
903 // calling us back on the task. | 905 // calling us back on the task. |
904 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( | 906 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( |
905 MessageLoop::current(), callback_task, | 907 MessageLoop::current(), callback_task, |
906 kMaxHistogramGatheringWaitDuration); | 908 kMaxHistogramGatheringWaitDuration); |
907 } | 909 } |
908 | 910 |
909 void MetricsService::OnHistogramSynchronizationDone() { | 911 void MetricsService::OnHistogramSynchronizationDone() { |
910 DCHECK(IsSingleThreaded()); | 912 DCHECK(IsSingleThreaded()); |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 if (local_state) { | 1538 if (local_state) { |
1537 const PrefService::Preference* uma_pref = | 1539 const PrefService::Preference* uma_pref = |
1538 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1540 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1539 if (uma_pref) { | 1541 if (uma_pref) { |
1540 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1542 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1541 DCHECK(success); | 1543 DCHECK(success); |
1542 } | 1544 } |
1543 } | 1545 } |
1544 return result; | 1546 return result; |
1545 } | 1547 } |
OLD | NEW |