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

Side by Side Diff: base/trace_event/trace_event.cc

Issue 2381083003: The TRACE_LINK_IDS macro (Closed)
Patch Set: TracedValue -> CTTF Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698