summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/metrics/statistics_recorder.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
index 1bfa348..12e4489 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -48,7 +48,12 @@ StatisticsRecorder::HistogramIterator::~HistogramIterator() {}
StatisticsRecorder::HistogramIterator&
StatisticsRecorder::HistogramIterator::operator++() {
const HistogramMap::iterator histograms_end = histograms_->end();
- while (iter_ != histograms_end) {
+ if (iter_ == histograms_end || lock_ == NULL)
+ return *this;
+
+ base::AutoLock auto_lock(*lock_);
+
+ for (;;) {
++iter_;
if (iter_ == histograms_end)
break;
@@ -58,6 +63,7 @@ StatisticsRecorder::HistogramIterator::operator++() {
}
break;
}
+
return *this;
}