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

Unified Diff: base/trace_event/trace_event_impl.cc

Issue 1870563002: Escape name and category of trace events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove escaping of trace event category Created 4 years, 8 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_event_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_impl.cc
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc
index 4ab0d358f9d202dd31ba6418b098da6751348e05..e2e250ed567ed6385a8ff9072f2a452bd5f0f4be 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -293,10 +293,10 @@ void TraceEvent::AppendAsJSON(
// Category group checked at category creation time.
DCHECK(!strchr(name_, '"'));
StringAppendF(out, "{\"pid\":%i,\"tid\":%i,\"ts\":%" PRId64
- ","
- "\"ph\":\"%c\",\"cat\":\"%s\",\"name\":\"%s\",\"args\":",
- process_id, thread_id, time_int64, phase_, category_group_name,
- name_);
+ ",\"ph\":\"%c\",\"cat\":\"%s\",\"name\":",
+ process_id, thread_id, time_int64, phase_, category_group_name);
+ EscapeJSONString(name_, true, out);
+ *out += ",\"args\":";
// Output argument names and values, stop at first NULL argument name.
// TODO(oysteine): The dual predicates here is a bit ugly; if the filtering
« no previous file with comments | « no previous file | base/trace_event/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698