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