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

Unified Diff: base/metrics/histogram_base.cc

Issue 1445283004: Use subtle::NoBarrier* statements for Histogram flags_ field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/histogram_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_base.cc
diff --git a/base/metrics/histogram_base.cc b/base/metrics/histogram_base.cc
index 6b3f69c2c047a63198d6cf69e94ec6e29336e8b7..92da79f165f465da0fd2a98041fe1bea6f933896 100644
--- a/base/metrics/histogram_base.cc
+++ b/base/metrics/histogram_base.cc
@@ -72,11 +72,13 @@ void HistogramBase::CheckName(const StringPiece& name) const {
}
void HistogramBase::SetFlags(int32 flags) {
- flags_ |= flags;
+ HistogramBase::Count old_flags = subtle::NoBarrier_Load(&flags_);
+ subtle::NoBarrier_Store(&flags_, old_flags | flags);
Alexander Potapenko 2015/11/18 11:23:28 The question is whether there is any data that is
Alexei Svitkine (slow) 2015/11/18 16:37:12 I don't think there's a case where there is associ
}
void HistogramBase::ClearFlags(int32 flags) {
- flags_ &= ~flags;
+ HistogramBase::Count old_flags = subtle::NoBarrier_Load(&flags_);
+ subtle::NoBarrier_Store(&flags_, old_flags & ~flags);
}
void HistogramBase::AddTime(const TimeDelta& time) {
@@ -119,7 +121,7 @@ void HistogramBase::WriteJSON(std::string* output) const {
}
void HistogramBase::FindAndRunCallback(HistogramBase::Sample sample) const {
- if ((flags_ & kCallbackExists) == 0)
+ if ((flags() & kCallbackExists) == 0)
return;
StatisticsRecorder::OnSampleCallback cb =
« no previous file with comments | « base/metrics/histogram_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698