Index: base/trace_event/trace_event.cc |
diff --git a/base/trace_event/trace_event.cc b/base/trace_event/trace_event.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0ea34e37637b8b2db311742262f6e468163d0b28 |
--- /dev/null |
+++ b/base/trace_event/trace_event.cc |
@@ -0,0 +1,47 @@ |
+// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/trace_event/trace_event.h" |
+ |
+#include "base/format_macros.h" |
+#include "base/memory/ptr_util.h" |
+#include "base/strings/stringprintf.h" |
+#include "base/trace_event/trace_event_argument.h" |
+ |
+namespace trace_event_internal { |
+ |
+std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
+TraceID::dict_value() const { |
+ auto value = base::MakeUnique<base::trace_event::TracedValue>(); |
+ |
+ 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"; |
+ } |
+ |
+ return std::move(value); |
+} |
+ |
+} // namespace trace_event_internal |