Chromium Code Reviews| Index: base/trace_event/heap_profiler_allocation_context_tracker.cc |
| diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.cc b/base/trace_event/heap_profiler_allocation_context_tracker.cc |
| index f3a03fe90d08f6039aac99140af228df74a0e11c..b8ca8a3b8aa767f1ed0413e2b6aa02f33e40a086 100644 |
| --- a/base/trace_event/heap_profiler_allocation_context_tracker.cc |
| +++ b/base/trace_event/heap_profiler_allocation_context_tracker.cc |
| @@ -29,7 +29,6 @@ const size_t kMaxStackDepth = 128u; |
| const size_t kMaxTaskDepth = 16u; |
| AllocationContextTracker* const kInitializingSentinel = |
| reinterpret_cast<AllocationContextTracker*>(-1); |
| -const char kTracingOverhead[] = "tracing_overhead"; |
| ThreadLocalStorage::StaticSlot g_tls_alloc_ctx_tracker = TLS_INITIALIZER; |
| @@ -157,21 +156,16 @@ void AllocationContextTracker::PopCurrentTaskContext(const char* context) { |
| } |
| // static |
| -AllocationContext AllocationContextTracker::GetContextSnapshot() { |
| - AllocationContext ctx; |
| - |
| +bool AllocationContextTracker::GetContextSnapshot(AllocationContext* ctx) { |
| if (ignore_scope_depth_) { |
|
Primiano Tucci (use gerrit)
2017/01/17 17:54:09
drop the braces at this point
|
| - ctx.backtrace.frames[0] = StackFrame::FromTraceEventName(kTracingOverhead); |
| - ctx.type_name = kTracingOverhead; |
| - ctx.backtrace.frame_count = 1; |
| - return ctx; |
| + return false; |
| } |
| CaptureMode mode = static_cast<CaptureMode>( |
| subtle::NoBarrier_Load(&capture_mode_)); |
| - auto* backtrace = std::begin(ctx.backtrace.frames); |
| - auto* backtrace_end = std::end(ctx.backtrace.frames); |
| + auto* backtrace = std::begin(ctx->backtrace.frames); |
| + auto* backtrace_end = std::end(ctx->backtrace.frames); |
| if (!thread_name_) { |
| // Ignore the string allocation made by GetAndLeakThreadName to avoid |
| @@ -236,19 +230,19 @@ AllocationContext AllocationContextTracker::GetContextSnapshot() { |
| } |
| } |
| - ctx.backtrace.frame_count = backtrace - std::begin(ctx.backtrace.frames); |
| + ctx->backtrace.frame_count = backtrace - std::begin(ctx->backtrace.frames); |
| // TODO(ssid): Fix crbug.com/594803 to add file name as 3rd dimension |
| // (component name) in the heap profiler and not piggy back on the type name. |
| if (!task_contexts_.empty()) { |
| - ctx.type_name = task_contexts_.back(); |
| + ctx->type_name = task_contexts_.back(); |
| } else if (!pseudo_stack_.empty()) { |
| // If task context was unavailable, then the category names are taken from |
| // trace events. |
| - ctx.type_name = pseudo_stack_.back().trace_event_category; |
| + ctx->type_name = pseudo_stack_.back().trace_event_category; |
| } |
| - return ctx; |
| + return true; |
| } |
| } // namespace trace_event |