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; | |
1060 if (UNLIKELY( | 1059 if (UNLIKELY( |
1061 AllocationContextTracker::capture_mode() != | 1060 base::trace_event::AllocationContextTracker::capture_enabled())) { |
1062 AllocationContextTracker::CaptureMode::DISABLED)) { | 1061 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() |
1063 AllocationContextTracker::GetInstanceForCurrentThread() | |
1064 ->PushCurrentTaskContext(context_); | 1062 ->PushCurrentTaskContext(context_); |
1065 } | 1063 } |
1066 } | 1064 } |
1067 | 1065 |
1068 ~ScopedTaskExecutionEvent() { | 1066 ~ScopedTaskExecutionEvent() { |
1069 using base::trace_event::AllocationContextTracker; | |
1070 if (UNLIKELY( | 1067 if (UNLIKELY( |
1071 AllocationContextTracker::capture_mode() != | 1068 base::trace_event::AllocationContextTracker::capture_enabled())) { |
1072 AllocationContextTracker::CaptureMode::DISABLED)) { | 1069 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() |
1073 AllocationContextTracker::GetInstanceForCurrentThread() | |
1074 ->PopCurrentTaskContext(context_); | 1070 ->PopCurrentTaskContext(context_); |
1075 } | 1071 } |
1076 } | 1072 } |
1077 | 1073 |
1078 private: | 1074 private: |
1079 const char* context_; | 1075 const char* context_; |
1080 }; | 1076 }; |
1081 | 1077 |
1082 } // namespace trace_event_internal | 1078 } // namespace trace_event_internal |
1083 | 1079 |
(...skipping 23 matching lines...) Expand all Loading... |
1107 const char* name_; | 1103 const char* name_; |
1108 IDType id_; | 1104 IDType id_; |
1109 | 1105 |
1110 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1106 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1111 }; | 1107 }; |
1112 | 1108 |
1113 } // namespace trace_event | 1109 } // namespace trace_event |
1114 } // namespace base | 1110 } // namespace base |
1115 | 1111 |
1116 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1112 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |