Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: base/trace_event/heap_profiler_allocation_context_tracker.cc

Issue 2323483005: [tracing] Add filtering mode in TraceLog (Closed)
Patch Set: Fixes. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 5 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Guard for stack underflow. If tracing was started with a TRACE_EVENT in 122 // Guard for stack underflow. If tracing was started with a TRACE_EVENT in
123 // scope, the frame was never pushed, so it is possible that pop is called 123 // scope, the frame was never pushed, so it is possible that pop is called
124 // on an empty stack. 124 // on an empty stack.
125 if (pseudo_stack_.empty()) 125 if (pseudo_stack_.empty())
126 return; 126 return;
127 127
128 // Assert that pushes and pops are nested correctly. This DCHECK can be 128 // Assert that pushes and pops are nested correctly. This DCHECK can be
129 // hit if some TRACE_EVENT macro is unbalanced (a TRACE_EVENT_END* call 129 // hit if some TRACE_EVENT macro is unbalanced (a TRACE_EVENT_END* call
130 // without a corresponding TRACE_EVENT_BEGIN). 130 // without a corresponding TRACE_EVENT_BEGIN).
131 DCHECK(stack_frame == pseudo_stack_.back()) 131 DCHECK(stack_frame == pseudo_stack_.back())
132 << "Encountered an unmatched TRACE_EVENT_END"; 132 << "Encountered an unmatched TRACE_EVENT_END: "
133 << stack_frame.trace_event_name
134 << ", event in stack: " << pseudo_stack_.back().trace_event_name;
Primiano Tucci (use gerrit) 2016/09/23 18:34:31 I'd probably s/,/vs/
ssid 2016/09/26 18:39:53 Done.
133 135
134 pseudo_stack_.pop_back(); 136 pseudo_stack_.pop_back();
135 } 137 }
136 138
137 void AllocationContextTracker::PushCurrentTaskContext(const char* context) { 139 void AllocationContextTracker::PushCurrentTaskContext(const char* context) {
138 DCHECK(context); 140 DCHECK(context);
139 if (task_contexts_.size() < kMaxTaskDepth) 141 if (task_contexts_.size() < kMaxTaskDepth)
140 task_contexts_.push_back(context); 142 task_contexts_.push_back(context);
141 else 143 else
142 NOTREACHED(); 144 NOTREACHED();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // If task context was unavailable, then the category names are taken from 246 // If task context was unavailable, then the category names are taken from
245 // trace events. 247 // trace events.
246 ctx.type_name = pseudo_stack_.back().trace_event_category; 248 ctx.type_name = pseudo_stack_.back().trace_event_category;
247 } 249 }
248 250
249 return ctx; 251 return ctx;
250 } 252 }
251 253
252 } // namespace trace_event 254 } // namespace trace_event
253 } // namespace base 255 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698