| Index: base/metrics/statistics_recorder.cc
|
| diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
|
| index 4eecddade8058c723392abb32152778e3c5c59eb..e9074cd47fa98393e7cf7fc7255c22f4776f79b6 100644
|
| --- a/base/metrics/statistics_recorder.cc
|
| +++ b/base/metrics/statistics_recorder.cc
|
| @@ -337,6 +337,14 @@ StatisticsRecorder::HistogramIterator StatisticsRecorder::end() {
|
| }
|
|
|
| // static
|
| +void StatisticsRecorder::InitLogOnShutdown() {
|
| + if (lock_ == nullptr)
|
| + return;
|
| + base::AutoLock auto_lock(*lock_);
|
| + g_statistics_recorder_.Get().InitLogOnShutdownWithoutLock();
|
| +}
|
| +
|
| +// static
|
| void StatisticsRecorder::GetSnapshot(const std::string& query,
|
| Histograms* snapshot) {
|
| if (lock_ == NULL)
|
| @@ -475,8 +483,14 @@ StatisticsRecorder::StatisticsRecorder() {
|
| callbacks_ = new CallbackMap;
|
| ranges_ = new RangesMap;
|
|
|
| - if (VLOG_IS_ON(1))
|
| + InitLogOnShutdownWithoutLock();
|
| +}
|
| +
|
| +void StatisticsRecorder::InitLogOnShutdownWithoutLock() {
|
| + if (!vlog_initialized_ && VLOG_IS_ON(1)) {
|
| + vlog_initialized_ = true;
|
| AtExitManager::RegisterCallback(&DumpHistogramsToVlog, this);
|
| + }
|
| }
|
|
|
| // static
|
|
|