OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/debug/trace_event_synthetic_delay.h" | 5 #include "base/debug/trace_event_synthetic_delay.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 | 7 |
8 namespace { | 8 namespace { |
9 const int kMaxSyntheticDelays = 32; | 9 const int kMaxSyntheticDelays = 32; |
10 } // namespace | 10 } // namespace |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 ScopedSyntheticDelay::~ScopedSyntheticDelay() { | 214 ScopedSyntheticDelay::~ScopedSyntheticDelay() { |
215 delay_impl_->EndParallel(end_time_); | 215 delay_impl_->EndParallel(end_time_); |
216 } | 216 } |
217 | 217 |
218 base::debug::TraceEventSyntheticDelay* GetOrCreateDelay( | 218 base::debug::TraceEventSyntheticDelay* GetOrCreateDelay( |
219 const char* name, | 219 const char* name, |
220 base::subtle::AtomicWord* impl_ptr) { | 220 base::subtle::AtomicWord* impl_ptr) { |
221 base::debug::TraceEventSyntheticDelay* delay_impl = | 221 base::debug::TraceEventSyntheticDelay* delay_impl = |
222 reinterpret_cast<base::debug::TraceEventSyntheticDelay*>( | 222 reinterpret_cast<base::debug::TraceEventSyntheticDelay*>( |
223 base::subtle::NoBarrier_Load(impl_ptr)); | 223 base::subtle::Acquire_Load(impl_ptr)); |
224 if (!delay_impl) { | 224 if (!delay_impl) { |
225 delay_impl = base::debug::TraceEventSyntheticDelayRegistry::GetInstance() | 225 delay_impl = base::debug::TraceEventSyntheticDelayRegistry::GetInstance() |
226 ->GetOrCreateDelay(name); | 226 ->GetOrCreateDelay(name); |
227 base::subtle::NoBarrier_Store( | 227 base::subtle::Release_Store( |
228 impl_ptr, reinterpret_cast<base::subtle::AtomicWord>(delay_impl)); | 228 impl_ptr, reinterpret_cast<base::subtle::AtomicWord>(delay_impl)); |
229 } | 229 } |
230 return delay_impl; | 230 return delay_impl; |
231 } | 231 } |
232 | 232 |
233 } // namespace trace_event_internal | 233 } // namespace trace_event_internal |
OLD | NEW |