Index: base/synchronization/atomic_flag.cc |
diff --git a/base/synchronization/atomic_flag.cc b/base/synchronization/atomic_flag.cc |
index 98d90cb88fd6c039842eb6ac5ccd6bd6017abf9f..8c2018d369324bb4ea64b8cf4ccabe989a3eab71 100644 |
--- a/base/synchronization/atomic_flag.cc |
+++ b/base/synchronization/atomic_flag.cc |
@@ -8,10 +8,16 @@ |
namespace base { |
-AtomicFlag::AtomicFlag() = default; |
+AtomicFlag::AtomicFlag() { |
+ // It doesn't matter where the AtomicFlag is built so long as it's always |
+ // Set() from the same sequence after. Note: the sequencing requirements are |
+ // necessary for IsSet()'s callers to know which sequence's memory operations |
+ // they are synchronized with. |
+ set_sequence_checker_.DetachFromSequence(); |
+} |
void AtomicFlag::Set() { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK(set_sequence_checker_.CalledOnValidSequence()); |
base::subtle::Release_Store(&flag_, 1); |
} |