OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 const TraceLog::OutputCallback& flush_output_callback); | 629 const TraceLog::OutputCallback& flush_output_callback); |
630 void FinishFlush(int generation); | 630 void FinishFlush(int generation); |
631 void OnFlushTimeout(int generation); | 631 void OnFlushTimeout(int generation); |
632 | 632 |
633 int generation() const { | 633 int generation() const { |
634 return static_cast<int>(subtle::NoBarrier_Load(&generation_)); | 634 return static_cast<int>(subtle::NoBarrier_Load(&generation_)); |
635 } | 635 } |
636 bool CheckGeneration(int generation) const { | 636 bool CheckGeneration(int generation) const { |
637 return generation == this->generation(); | 637 return generation == this->generation(); |
638 } | 638 } |
639 int NextGeneration() { | 639 int NextGeneration(); |
640 return static_cast<int>(subtle::NoBarrier_AtomicIncrement(&generation_, 1)); | |
641 } | |
642 | 640 |
643 TimeTicks OffsetNow() const { | 641 TimeTicks OffsetNow() const { |
644 return OffsetTimestamp(TimeTicks::NowFromSystemTraceTime()); | 642 return OffsetTimestamp(TimeTicks::NowFromSystemTraceTime()); |
645 } | 643 } |
646 TimeTicks OffsetTimestamp(const TimeTicks& timestamp) const { | 644 TimeTicks OffsetTimestamp(const TimeTicks& timestamp) const { |
647 return timestamp - time_offset_; | 645 return timestamp - time_offset_; |
648 } | 646 } |
649 | 647 |
650 // This lock protects TraceLog member accesses (except for members protected | 648 // This lock protects TraceLog member accesses (except for members protected |
651 // by thread_info_lock_) from arbitrary threads. | 649 // by thread_info_lock_) from arbitrary threads. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; | 709 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; |
712 subtle::AtomicWord generation_; | 710 subtle::AtomicWord generation_; |
713 | 711 |
714 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 712 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
715 }; | 713 }; |
716 | 714 |
717 } // namespace debug | 715 } // namespace debug |
718 } // namespace base | 716 } // namespace base |
719 | 717 |
720 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 718 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |