Chromium Code Reviews| Index: base/metrics/statistics_recorder.cc |
| diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc |
| index b19a897a96c1ab6e2d7737bd2648100c9bd10281..627b5d195c71f1eeea73287bbfb8b3a9123fe440 100644 |
| --- a/base/metrics/statistics_recorder.cc |
| +++ b/base/metrics/statistics_recorder.cc |
| @@ -285,9 +285,6 @@ void StatisticsRecorder::GetBucketRanges( |
| HistogramBase* StatisticsRecorder::FindHistogram(base::StringPiece name) { |
| if (lock_ == NULL) |
| return NULL; |
| - base::AutoLock auto_lock(*lock_); |
| - if (histograms_ == NULL) |
| - return NULL; |
| // Import histograms from known persistent storage. Histograms could have |
| // been added by other processes and they must be fetched and recognized |
| @@ -297,6 +294,10 @@ HistogramBase* StatisticsRecorder::FindHistogram(base::StringPiece name) { |
| if (allocator) |
| allocator->ImportHistogramsToStatisticsRecorder(); |
| + base::AutoLock auto_lock(*lock_); |
|
Alexei Svitkine (slow)
2016/04/08 14:51:48
Add a comment for why this is done here and not at
bcwhite
2016/04/08 15:06:08
Done.
|
| + if (histograms_ == NULL) |
| + return NULL; |
| + |
| HistogramMap::iterator it = histograms_->find(name); |
| if (histograms_->end() == it) |
| return NULL; |