| 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_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
| 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
| 8 | 8 |
| 9 #include <stack> | 9 #include <stack> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/atomicops.h" | 13 #include "base/atomicops.h" |
| 14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/memory/ref_counted_memory.h" | 18 #include "base/memory/ref_counted_memory.h" |
| 19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/synchronization/condition_variable.h" | 22 #include "base/synchronization/condition_variable.h" |
| 23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
| 24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
| 25 #include "base/threading/thread_local.h" | 25 #include "base/threading/thread_local.h" |
| 26 | 26 |
| 27 // Older style trace macros with explicit id and extra data | 27 // Older style trace macros with explicit id and extra data |
| 28 // Only these macros result in publishing data to ETW as currently implemented. | 28 // Only these macros result in publishing data to ETW as currently implemented. |
| 29 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \ | 29 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \ |
| 30 base::debug::TraceLog::AddTraceEventEtw( \ | 30 base::trace_event::TraceLog::AddTraceEventEtw( \ |
| 31 TRACE_EVENT_PHASE_BEGIN, \ | 31 TRACE_EVENT_PHASE_BEGIN, \ |
| 32 name, reinterpret_cast<const void*>(id), extra) | 32 name, reinterpret_cast<const void*>(id), extra) |
| 33 | 33 |
| 34 #define TRACE_EVENT_END_ETW(name, id, extra) \ | 34 #define TRACE_EVENT_END_ETW(name, id, extra) \ |
| 35 base::debug::TraceLog::AddTraceEventEtw( \ | 35 base::trace_event::TraceLog::AddTraceEventEtw( \ |
| 36 TRACE_EVENT_PHASE_END, \ | 36 TRACE_EVENT_PHASE_END, \ |
| 37 name, reinterpret_cast<const void*>(id), extra) | 37 name, reinterpret_cast<const void*>(id), extra) |
| 38 | 38 |
| 39 #define TRACE_EVENT_INSTANT_ETW(name, id, extra) \ | 39 #define TRACE_EVENT_INSTANT_ETW(name, id, extra) \ |
| 40 base::debug::TraceLog::AddTraceEventEtw( \ | 40 base::trace_event::TraceLog::AddTraceEventEtw( \ |
| 41 TRACE_EVENT_PHASE_INSTANT, \ | 41 TRACE_EVENT_PHASE_INSTANT, \ |
| 42 name, reinterpret_cast<const void*>(id), extra) | 42 name, reinterpret_cast<const void*>(id), extra) |
| 43 | 43 |
| 44 template <typename Type> | 44 template <typename Type> |
| 45 struct DefaultSingletonTraits; | 45 struct DefaultSingletonTraits; |
| 46 | 46 |
| 47 namespace base { | 47 namespace base { |
| 48 | 48 |
| 49 class WaitableEvent; | 49 class WaitableEvent; |
| 50 class MessageLoop; | 50 class MessageLoop; |
| 51 | 51 |
| 52 namespace debug { | 52 namespace trace_event { |
| 53 | 53 |
| 54 // For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided | 54 // For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided |
| 55 // class must implement this interface. | 55 // class must implement this interface. |
| 56 class BASE_EXPORT ConvertableToTraceFormat | 56 class BASE_EXPORT ConvertableToTraceFormat |
| 57 : public RefCounted<ConvertableToTraceFormat> { | 57 : public RefCounted<ConvertableToTraceFormat> { |
| 58 public: | 58 public: |
| 59 // Append the class info to the provided |out| string. The appended | 59 // Append the class info to the provided |out| string. The appended |
| 60 // data must be a valid JSON object. Strings must be properly quoted, and | 60 // data must be a valid JSON object. Strings must be properly quoted, and |
| 61 // escaped. There is no processing applied to the content after it is | 61 // escaped. There is no processing applied to the content after it is |
| 62 // appended. | 62 // appended. |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 size_t thread_shared_chunk_index_; | 800 size_t thread_shared_chunk_index_; |
| 801 | 801 |
| 802 // Set when asynchronous Flush is in progress. | 802 // Set when asynchronous Flush is in progress. |
| 803 OutputCallback flush_output_callback_; | 803 OutputCallback flush_output_callback_; |
| 804 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; | 804 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; |
| 805 subtle::AtomicWord generation_; | 805 subtle::AtomicWord generation_; |
| 806 | 806 |
| 807 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 807 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
| 808 }; | 808 }; |
| 809 | 809 |
| 810 } // namespace trace_event |
| 811 } // namespace base |
| 812 |
| 813 // TODO(ssid): remove these aliases after the tracing clients are moved to the |
| 814 // new trace_event namespace. See crbug.com/451032. ETA: March 2015. |
| 815 namespace base { |
| 816 namespace debug { |
| 817 using base::trace_event::CategoryFilter; |
| 818 using base::trace_event::ConvertableToTraceFormat; |
| 819 using base::trace_event::RECORD_UNTIL_FULL; |
| 820 using base::trace_event::RECORD_CONTINUOUSLY; |
| 821 using base::trace_event::RECORD_AS_MUCH_AS_POSSIBLE; |
| 822 using base::trace_event::TraceEventHandle; |
| 823 using base::trace_event::TraceLog; |
| 824 using base::trace_event::TraceLogStatus; |
| 825 using base::trace_event::TraceOptions; |
| 826 using base::trace_event::TraceResultBuffer; |
| 810 } // namespace debug | 827 } // namespace debug |
| 811 } // namespace base | 828 } // namespace base |
| 812 | 829 |
| 813 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 830 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
| OLD | NEW |