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

Unified Diff: base/trace_event/trace_event.h

Issue 1850603002: [tracing] Use trace event profiling for heap profiling Base URL: https://chromium.googlesource.com/chromium/src.git@all_categories
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/trace_event/trace_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event.h
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h
index 7d489aecc26d72700b62685bd0170372eb843122..d5a2e57b2f57d630f3174c7d8c7d7103e1cf4be5 100644
--- a/base/trace_event/trace_event.h
+++ b/base/trace_event/trace_event.h
@@ -986,13 +986,17 @@ class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer {
ScopedTracer() : p_data_(NULL) {}
~ScopedTracer() {
- if (p_data_ && *data_.category_group_enabled) {
- TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
- data_.category_group_enabled, data_.name, data_.event_handle);
+ if (data_.name) {
+ if (p_data_ && *data_.category_group_enabled) {
+ TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
+ data_.category_group_enabled, data_.name, data_.event_handle);
+ }
+ if (data_.initialized_for_profiling) {
+ base::trace_event::AllocationContextTracker::
+ GetInstanceForCurrentThread()
+ ->PopPseudoStackFrame(data_.name);
+ }
}
- // TODO(ssid): Pop the frame from the pseudo stack if initialized for
- // profiling is true, after adding profiling mode in skia and Blink
- // crbug.com/598426.
}
void Initialize(const unsigned char* category_group_enabled,
@@ -1008,8 +1012,8 @@ class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer {
if (!(flags & TRACE_EVENT_FLAG_COPY)) {
data_.initialized_for_profiling = true;
data_.name = name;
- // TODO(ssid): Add the frame to the pseudo stack after adding profiling
- // mode in skia and Blink crbug.com/598426.
+ base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread()
+ ->PushPseudoStackFrame(name);
}
}
« no previous file with comments | « no previous file | base/trace_event/trace_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698