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_event_common.h instead of here. | 10 // implementation-specific should go in trace_event_common.h instead of here. |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 private: | 1049 private: |
1050 const char* previous_state_; | 1050 const char* previous_state_; |
1051 }; | 1051 }; |
1052 | 1052 |
1053 // ScopedTaskExecutionEvent records the current task's context in the heap | 1053 // ScopedTaskExecutionEvent records the current task's context in the heap |
1054 // profiler. | 1054 // profiler. |
1055 class ScopedTaskExecutionEvent { | 1055 class ScopedTaskExecutionEvent { |
1056 public: | 1056 public: |
1057 explicit ScopedTaskExecutionEvent(const char* task_context) | 1057 explicit ScopedTaskExecutionEvent(const char* task_context) |
1058 : context_(task_context) { | 1058 : context_(task_context) { |
| 1059 using base::trace_event::AllocationContextTracker; |
1059 if (UNLIKELY( | 1060 if (UNLIKELY( |
1060 base::trace_event::AllocationContextTracker::capture_enabled())) { | 1061 AllocationContextTracker::capture_mode() != |
1061 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() | 1062 AllocationContextTracker::CaptureMode::DISABLED)) { |
| 1063 AllocationContextTracker::GetInstanceForCurrentThread() |
1062 ->PushCurrentTaskContext(context_); | 1064 ->PushCurrentTaskContext(context_); |
1063 } | 1065 } |
1064 } | 1066 } |
1065 | 1067 |
1066 ~ScopedTaskExecutionEvent() { | 1068 ~ScopedTaskExecutionEvent() { |
| 1069 using base::trace_event::AllocationContextTracker; |
1067 if (UNLIKELY( | 1070 if (UNLIKELY( |
1068 base::trace_event::AllocationContextTracker::capture_enabled())) { | 1071 AllocationContextTracker::capture_mode() != |
1069 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() | 1072 AllocationContextTracker::CaptureMode::DISABLED)) { |
| 1073 AllocationContextTracker::GetInstanceForCurrentThread() |
1070 ->PopCurrentTaskContext(context_); | 1074 ->PopCurrentTaskContext(context_); |
1071 } | 1075 } |
1072 } | 1076 } |
1073 | 1077 |
1074 private: | 1078 private: |
1075 const char* context_; | 1079 const char* context_; |
1076 }; | 1080 }; |
1077 | 1081 |
1078 } // namespace trace_event_internal | 1082 } // namespace trace_event_internal |
1079 | 1083 |
(...skipping 23 matching lines...) Expand all Loading... |
1103 const char* name_; | 1107 const char* name_; |
1104 IDType id_; | 1108 IDType id_; |
1105 | 1109 |
1106 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1110 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1107 }; | 1111 }; |
1108 | 1112 |
1109 } // namespace trace_event | 1113 } // namespace trace_event |
1110 } // namespace base | 1114 } // namespace base |
1111 | 1115 |
1112 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1116 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |