Chromium Code Reviews| Index: base/metrics/statistics_recorder.cc |
| diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc |
| index d0fa2add3603b3f574dfa9ef9e5ee2e6b152aafc..52e005dace06a891b3be363f1a15c9282da9b944 100644 |
| --- a/base/metrics/statistics_recorder.cc |
| +++ b/base/metrics/statistics_recorder.cc |
| @@ -67,6 +67,13 @@ StatisticsRecorder::HistogramIterator::operator++() { |
| return *this; |
| } |
| +StatisticsRecorder::~StatisticsRecorder() { |
| + DCHECK(histograms_ && ranges_ && lock_); |
|
Alexei Svitkine (slow)
2016/03/07 21:14:51
Nit: Not sure why I missed that in the previous CL
bcwhite
2016/03/07 22:20:41
Done.
|
| + |
| + // Global clean up. |
| + Reset(); |
| +} |
| + |
| // static |
| void StatisticsRecorder::Initialize() { |
| // Ensure that an instance of the StatisticsRecorder object is created. |
| @@ -369,6 +376,17 @@ StatisticsRecorder::OnSampleCallback StatisticsRecorder::FindCallback( |
| } |
| // static |
| +size_t StatisticsRecorder::GetHistogramCount() { |
| + if (!lock_) |
| + return 0; |
| + |
| + base::AutoLock auto_lock(*lock_); |
| + if (!histograms_) |
| + return 0; |
| + return histograms_->size(); |
| +} |
| + |
| +// static |
| void StatisticsRecorder::ResetForTesting() { |
| // Just call the private version that is used also by the destructor. |
| Reset(); |
| @@ -403,13 +421,6 @@ StatisticsRecorder::StatisticsRecorder() { |
| AtExitManager::RegisterCallback(&DumpHistogramsToVlog, this); |
| } |
| -StatisticsRecorder::~StatisticsRecorder() { |
| - DCHECK(histograms_ && ranges_ && lock_); |
| - |
| - // Global clean up. |
| - Reset(); |
| -} |
| - |
| // static |
| void StatisticsRecorder::Reset() { |
| // If there's no lock then there is nothing to reset. |