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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 // like to record: the histogram of memory usage, so we spawn a task to | 962 // like to record: the histogram of memory usage, so we spawn a task to |
963 // collect the memory details and when that task is finished, it will call | 963 // collect the memory details and when that task is finished, it will call |
964 // OnMemoryDetailCollectionDone, which will call HistogramSynchronization to | 964 // OnMemoryDetailCollectionDone, which will call HistogramSynchronization to |
965 // collect histograms from all renderers and then we will call | 965 // collect histograms from all renderers and then we will call |
966 // OnHistogramSynchronizationDone to continue processing. | 966 // OnHistogramSynchronizationDone to continue processing. |
967 | 967 |
968 // Create a callback_task for OnHistogramSynchronizationDone. | 968 // Create a callback_task for OnHistogramSynchronizationDone. |
969 Task* callback_task = log_sender_factory_.NewRunnableMethod( | 969 Task* callback_task = log_sender_factory_.NewRunnableMethod( |
970 &MetricsService::OnHistogramSynchronizationDone); | 970 &MetricsService::OnHistogramSynchronizationDone); |
971 | 971 |
| 972 base::StatisticsRecorder::CollectHistogramStats("Browser"); |
| 973 |
972 // Set up the callback to task to call after we receive histograms from all | 974 // Set up the callback to task to call after we receive histograms from all |
973 // renderer processes. Wait time specifies how long to wait before absolutely | 975 // renderer processes. Wait time specifies how long to wait before absolutely |
974 // calling us back on the task. | 976 // calling us back on the task. |
975 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( | 977 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( |
976 MessageLoop::current(), callback_task, | 978 MessageLoop::current(), callback_task, |
977 kMaxHistogramGatheringWaitDuration); | 979 kMaxHistogramGatheringWaitDuration); |
978 } | 980 } |
979 | 981 |
980 void MetricsService::OnHistogramSynchronizationDone() { | 982 void MetricsService::OnHistogramSynchronizationDone() { |
981 DCHECK(IsSingleThreaded()); | 983 DCHECK(IsSingleThreaded()); |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 thread_id = base::PlatformThread::CurrentId(); | 1695 thread_id = base::PlatformThread::CurrentId(); |
1694 return base::PlatformThread::CurrentId() == thread_id; | 1696 return base::PlatformThread::CurrentId() == thread_id; |
1695 } | 1697 } |
1696 | 1698 |
1697 #if defined(OS_CHROMEOS) | 1699 #if defined(OS_CHROMEOS) |
1698 void MetricsService::StartExternalMetrics() { | 1700 void MetricsService::StartExternalMetrics() { |
1699 external_metrics_ = new chromeos::ExternalMetrics; | 1701 external_metrics_ = new chromeos::ExternalMetrics; |
1700 external_metrics_->Start(); | 1702 external_metrics_->Start(); |
1701 } | 1703 } |
1702 #endif | 1704 #endif |
OLD | NEW |