| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_HEAP_PROFILER_H | 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_H |
| 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_H | 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_H |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // tracing from the heap profiler dumps. | 26 // tracing from the heap profiler dumps. |
| 27 #define HEAP_PROFILER_SCOPED_IGNORE \ | 27 #define HEAP_PROFILER_SCOPED_IGNORE \ |
| 28 trace_event_internal::HeapProfilerScopedIgnore INTERNAL_HEAP_PROFILER_UID( \ | 28 trace_event_internal::HeapProfilerScopedIgnore INTERNAL_HEAP_PROFILER_UID( \ |
| 29 scoped_ignore) | 29 scoped_ignore) |
| 30 | 30 |
| 31 namespace trace_event_internal { | 31 namespace trace_event_internal { |
| 32 | 32 |
| 33 class BASE_EXPORT HeapProfilerScopedIgnore { | 33 class BASE_EXPORT HeapProfilerScopedIgnore { |
| 34 public: | 34 public: |
| 35 inline HeapProfilerScopedIgnore() { | 35 inline HeapProfilerScopedIgnore() { |
| 36 using base::trace_event::AllocationContextTracker; |
| 36 if (UNLIKELY( | 37 if (UNLIKELY( |
| 37 base::trace_event::AllocationContextTracker::capture_enabled())) { | 38 AllocationContextTracker::capture_mode() != |
| 38 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() | 39 AllocationContextTracker::CaptureMode::DISABLED)) { |
| 40 AllocationContextTracker::GetInstanceForCurrentThread() |
| 39 ->begin_ignore_scope(); | 41 ->begin_ignore_scope(); |
| 40 } | 42 } |
| 41 } | 43 } |
| 42 inline ~HeapProfilerScopedIgnore() { | 44 inline ~HeapProfilerScopedIgnore() { |
| 45 using base::trace_event::AllocationContextTracker; |
| 43 if (UNLIKELY( | 46 if (UNLIKELY( |
| 44 base::trace_event::AllocationContextTracker::capture_enabled())) { | 47 AllocationContextTracker::capture_mode() != |
| 45 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() | 48 AllocationContextTracker::CaptureMode::DISABLED)) { |
| 49 AllocationContextTracker::GetInstanceForCurrentThread() |
| 46 ->end_ignore_scope(); | 50 ->end_ignore_scope(); |
| 47 } | 51 } |
| 48 } | 52 } |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 } // namespace trace_event_internal | 55 } // namespace trace_event_internal |
| 52 | 56 |
| 53 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_H | 57 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_H |
| OLD | NEW |