Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: base/metrics/statistics_recorder.cc

Issue 1872713002: Remove unnecessary lock that causes reentry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/persistent_histogram_allocator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « base/metrics/persistent_histogram_allocator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698