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

Unified Diff: base/trace_event/trace_event_impl.cc

Issue 2504753002: tracing: Introduce API for composite IDs (Closed)
Patch Set: comments Created 3 years, 11 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 f9792d0d6df6aea004447b3bf2a293f50d08e646..cb23eb474c54e605f9f83f01367b896d1d445a5f 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -458,30 +458,32 @@ TraceID::AsConvertableToTraceFormat() const {
if (scope_ != kGlobalScope)
value->SetString("scope", scope_);
- switch (id_flags_) {
- case TRACE_EVENT_FLAG_HAS_ID:
- value->SetString(
- "id",
- base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_)));
- break;
- case TRACE_EVENT_FLAG_HAS_GLOBAL_ID:
- value->BeginDictionary("id2");
- value->SetString(
- "global",
- base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_)));
- value->EndDictionary();
- break;
- case TRACE_EVENT_FLAG_HAS_LOCAL_ID:
- value->BeginDictionary("id2");
- value->SetString(
- "local",
- base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_)));
- value->EndDictionary();
- break;
- default:
- NOTREACHED() << "Unrecognized ID flag";
+
+ const char* id_field_name = "id";
+ if (id_flags_ == TRACE_EVENT_FLAG_HAS_GLOBAL_ID) {
+ id_field_name = "global";
+ value->BeginDictionary("id2");
+ } else if (id_flags_ == TRACE_EVENT_FLAG_HAS_LOCAL_ID) {
+ id_field_name = "local";
+ value->BeginDictionary("id2");
+ } else if (id_flags_ != TRACE_EVENT_FLAG_HAS_ID) {
+ NOTREACHED() << "Unrecognized ID flag";
}
+ if (has_prefix_) {
+ value->SetString(id_field_name,
+ base::StringPrintf("0x%" PRIx64 "/0x%" PRIx64,
+ static_cast<uint64_t>(prefix_),
+ static_cast<uint64_t>(raw_id_)));
+ } else {
+ value->SetString(
+ id_field_name,
+ base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_)));
+ }
+
+ if (id_flags_ != TRACE_EVENT_FLAG_HAS_ID)
+ value->EndDictionary();
+
return std::move(value);
}
« 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