Chromium Code Reviews| Index: base/files/file_tracing.cc |
| diff --git a/base/files/file_tracing.cc b/base/files/file_tracing.cc |
| index 6d11cbc746ed268a357e0d2ba08d463c501e5d96..c909569e692e8bf5c2567b515e321740c38547f1 100644 |
| --- a/base/files/file_tracing.cc |
| +++ b/base/files/file_tracing.cc |
| @@ -4,8 +4,11 @@ |
| #include "base/files/file_tracing.h" |
| +#include "base/atomicops.h" |
| #include "base/files/file.h" |
| +using base::subtle::AtomicWord; |
|
danakj
2016/07/07 22:40:36
nit: you could put this in the method that uses it
Dan Beam
2016/07/07 23:13:48
Done.
|
| + |
| namespace base { |
| namespace { |
| @@ -19,7 +22,8 @@ bool FileTracing::IsCategoryEnabled() { |
| // static |
| void FileTracing::SetProvider(FileTracing::Provider* provider) { |
| - g_provider = provider; |
| + base::subtle::NoBarrier_Store(reinterpret_cast<AtomicWord*>(&g_provider), |
|
danakj
2016/07/07 22:40:36
I think the way most people do this would be with
Dan Beam
2016/07/07 23:13:48
g_provider should only be set once. ever. i can ve
danakj
2016/07/07 23:21:04
Ah, so it's just threads are reading null.. readin
|
| + reinterpret_cast<AtomicWord>(provider)); |
| } |
| FileTracing::ScopedEnabler::ScopedEnabler() { |