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 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ |
6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ | 6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ |
7 | 7 |
8 // This header file defines implementation details of how the trace macros in | 8 // This header file defines implementation details of how the trace macros in |
9 // trace_event_common.h collect and store trace events. Anything not | 9 // trace_event_common.h collect and store trace events. Anything not |
10 // implementation-specific should go in trace_macros_common.h instead of here. | 10 // implementation-specific should go in trace_macros_common.h instead of here. |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 TRACE_EVENT_API_ATOMIC_STORE( | 933 TRACE_EVENT_API_ATOMIC_STORE( |
934 g_trace_state[BucketNumber], | 934 g_trace_state[BucketNumber], |
935 reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( | 935 reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( |
936 const_cast<char*>(category_and_name))); | 936 const_cast<char*>(category_and_name))); |
937 } | 937 } |
938 | 938 |
939 private: | 939 private: |
940 const char* previous_state_; | 940 const char* previous_state_; |
941 }; | 941 }; |
942 | 942 |
943 using TraceContext = const void*; | 943 using TraceContext = trace_event_internal::TraceID; |
944 | 944 |
945 class TraceScopedContext { | 945 class TraceScopedContext { |
946 public: | 946 public: |
947 TraceScopedContext(const char* category_group, | 947 TraceScopedContext(const char* category_group, |
948 const char* name, | 948 const char* name, |
949 TraceContext context) | 949 trace_event_internal::TraceID::DontMangle context) |
950 : category_group_(category_group), name_(name), context_(context) { | 950 : category_group_(category_group), name_(name), context_(context) { |
951 TRACE_EVENT_ENTER_CONTEXT(category_group_, name_, context_); | 951 TRACE_EVENT_ENTER_CONTEXT(category_group_, name_, context_); |
952 } | 952 } |
953 | 953 |
954 ~TraceScopedContext() { | 954 ~TraceScopedContext() { |
955 TRACE_EVENT_LEAVE_CONTEXT(category_group_, name_, context_); | 955 TRACE_EVENT_LEAVE_CONTEXT(category_group_, name_, context_); |
956 } | 956 } |
957 | 957 |
958 private: | 958 private: |
959 const char* category_group_; | 959 const char* category_group_; |
960 const char* name_; | 960 const char* name_; |
961 TraceContext context_; | 961 trace_event_internal::TraceID::DontMangle context_; |
962 DISALLOW_COPY_AND_ASSIGN(TraceScopedContext); | 962 DISALLOW_COPY_AND_ASSIGN(TraceScopedContext); |
963 }; | 963 }; |
964 | 964 |
965 } // namespace trace_event_internal | 965 } // namespace trace_event_internal |
966 | 966 |
967 namespace base { | 967 namespace base { |
968 namespace trace_event { | 968 namespace trace_event { |
969 | 969 |
970 using trace_event_internal::TraceContext; | |
971 | |
972 template<typename IDType> class TraceScopedTrackableObject { | 970 template<typename IDType> class TraceScopedTrackableObject { |
973 public: | 971 public: |
974 TraceScopedTrackableObject(const char* category_group, const char* name, | 972 TraceScopedTrackableObject(const char* category_group, const char* name, |
975 IDType id) | 973 IDType id) |
976 : category_group_(category_group), | 974 : category_group_(category_group), |
977 name_(name), | 975 name_(name), |
978 id_(id) { | 976 id_(id) { |
979 TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group_, name_, id_); | 977 TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group_, name_, id_); |
980 } | 978 } |
981 | 979 |
(...skipping 10 matching lines...) Expand all Loading... |
992 const char* name_; | 990 const char* name_; |
993 IDType id_; | 991 IDType id_; |
994 | 992 |
995 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 993 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
996 }; | 994 }; |
997 | 995 |
998 } // namespace trace_event | 996 } // namespace trace_event |
999 } // namespace base | 997 } // namespace base |
1000 | 998 |
1001 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 999 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |