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

Unified Diff: base/metrics/persistent_histogram_allocator.cc

Issue 1872713002: Remove unnecessary lock that causes reentry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added comment as to why Import is done before lock 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 | « no previous file | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_histogram_allocator.cc
diff --git a/base/metrics/persistent_histogram_allocator.cc b/base/metrics/persistent_histogram_allocator.cc
index 864753bab5d3413c46252320657b0d1d4b5e79cd..2d635a552375ab6d7948597b9799869f7d16f929 100644
--- a/base/metrics/persistent_histogram_allocator.cc
+++ b/base/metrics/persistent_histogram_allocator.cc
@@ -575,8 +575,9 @@ void GlobalHistogramAllocator::ImportHistogramsToStatisticsRecorder() {
// about 40%.
Reference record_to_ignore = last_created();
- // There is no lock on this because it's expected to be called only by
- // the StatisticsRecorder which has its own lock.
+ // There is no lock on this because the iterator is lock-free while still
+ // guaranteed to only return each entry only once. The StatisticsRecorder
+ // has its own lock so the Register operation is safe.
while (true) {
std::unique_ptr<HistogramBase> histogram =
import_iterator_.GetNextWithIgnore(record_to_ignore);
« no previous file with comments | « no previous file | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698