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

Unified Diff: base/trace_event/trace_event_impl.cc

Issue 2253973003: Add an explicit way of making IDs local or global (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: versioning the id field 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/trace_event.h ('k') | 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 510cc2ffac6b32add118eb53ed4147b4b70369d9..d41500dc06f3652d60bb17bf9de0f2c46c4302e1 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -358,10 +358,33 @@ void TraceEvent::AppendAsJSON(
// If id_ is set, print it out as a hex string so we don't loose any
// bits (it might be a 64-bit pointer).
- if (flags_ & TRACE_EVENT_FLAG_HAS_ID) {
+ unsigned int id_flags_ = flags_ & (TRACE_EVENT_FLAG_HAS_ID |
+ TRACE_EVENT_FLAG_HAS_LOCAL_ID |
+ TRACE_EVENT_FLAG_HAS_GLOBAL_ID);
+ if (id_flags_) {
if (scope_ != trace_event_internal::kGlobalScope)
StringAppendF(out, ",\"scope\":\"%s\"", scope_);
- StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"", static_cast<uint64_t>(id_));
+
+ switch (id_flags_) {
+ case TRACE_EVENT_FLAG_HAS_ID:
+ StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"",
+ static_cast<uint64_t>(id_));
+ break;
+
+ case TRACE_EVENT_FLAG_HAS_LOCAL_ID:
+ StringAppendF(out, ",\"id2\":{\"local\":\"0x%" PRIx64 "\"}",
+ static_cast<uint64_t>(id_));
+ break;
+
+ case TRACE_EVENT_FLAG_HAS_GLOBAL_ID:
+ StringAppendF(out, ",\"id2\":{\"global\":\"0x%" PRIx64 "\"}",
+ static_cast<uint64_t>(id_));
+ break;
+
+ default:
+ NOTREACHED() << "More than one of the ID flags are set";
+ break;
+ }
}
if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING)
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698