OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/trace_event/trace_event.h" |
| 6 |
| 7 #include "base/format_macros.h" |
| 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/trace_event/trace_event_argument.h" |
| 11 |
| 12 namespace trace_event_internal { |
| 13 |
| 14 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 15 TraceID::dict_value() const { |
| 16 auto value = base::MakeUnique<base::trace_event::TracedValue>(); |
| 17 |
| 18 if (scope_ != kGlobalScope) |
| 19 value->SetString("scope", scope_); |
| 20 switch (id_flags_) { |
| 21 case TRACE_EVENT_FLAG_HAS_ID: |
| 22 value->SetString( |
| 23 "id", |
| 24 base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_))); |
| 25 break; |
| 26 case TRACE_EVENT_FLAG_HAS_GLOBAL_ID: |
| 27 value->BeginDictionary("id2"); |
| 28 value->SetString( |
| 29 "global", |
| 30 base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_))); |
| 31 value->EndDictionary(); |
| 32 break; |
| 33 case TRACE_EVENT_FLAG_HAS_LOCAL_ID: |
| 34 value->BeginDictionary("id2"); |
| 35 value->SetString( |
| 36 "local", |
| 37 base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_))); |
| 38 value->EndDictionary(); |
| 39 break; |
| 40 default: |
| 41 NOTREACHED() << "Unrecognized ID flag"; |
| 42 } |
| 43 |
| 44 return std::move(value); |
| 45 } |
| 46 |
| 47 } // namespace trace_event_internal |
OLD | NEW |