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

Unified Diff: base/trace_event/trace_event.h

Issue 2381083003: The TRACE_LINK_IDS macro (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/common/trace_event_common.h ('k') | base/trace_event/trace_event_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event.h
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h
index 4de64837161fded5fd176d1dc5136006d8521a9e..2dd5e93416ba22659e1d5a42c898f0e12d1f937e 100644
--- a/base/trace_event/trace_event.h
+++ b/base/trace_event/trace_event.h
@@ -376,29 +376,20 @@ TRACE_EVENT_API_CLASS_EXPORT extern \
} \
} while (0)
-// This macro ignores whether the bind_id is local, global, or mangled.
-#define INTERNAL_TRACE_EVENT_ADD_BIND_IDS(category_group, name, id, bind_id, \
- ...) \
+// The linked ID will not be mangled.
+#define INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id1, id2) \
do { \
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
- trace_event_internal::TraceID source_id((id)); \
+ trace_event_internal::TraceID source_id((id1)); \
unsigned int source_flags = source_id.id_flags(); \
- trace_event_internal::TraceID target_id((bind_id)); \
- if (target_id.scope() == trace_event_internal::kGlobalScope) { \
- trace_event_internal::AddTraceEvent( \
- TRACE_EVENT_PHASE_BIND_IDS, \
- INTERNAL_TRACE_EVENT_UID(category_group_enabled), \
- name, source_id.scope(), source_id.raw_id(), \
- source_flags, target_id.raw_id(), ##__VA_ARGS__); \
- } else { \
- trace_event_internal::AddTraceEvent( \
- TRACE_EVENT_PHASE_BIND_IDS, \
- INTERNAL_TRACE_EVENT_UID(category_group_enabled), \
- name, source_id.scope(), source_id.raw_id(), \
- source_flags, target_id.raw_id(), \
- "bind_scope", target_id.scope(), ##__VA_ARGS__); \
- } \
+ trace_event_internal::TraceID target_id((id2)); \
+ trace_event_internal::AddTraceEvent( \
+ TRACE_EVENT_PHASE_LINK_IDS, \
+ INTERNAL_TRACE_EVENT_UID(category_group_enabled), \
+ name, source_id.scope(), source_id.raw_id(), source_flags, \
+ trace_event_internal::kNoId, \
+ "linked_id", target_id.AsConvertableToTraceFormat()); \
} \
} while (0)
@@ -456,7 +447,7 @@ const unsigned long long kNoId = 0;
// TraceID encapsulates an ID that can either be an integer or pointer. Pointers
// are by default mangled with the Process ID so that they are unlikely to
// collide when the same pointer is used on different processes.
-class TraceID {
+class BASE_EXPORT TraceID {
public:
// Can be combined with WithScope.
class LocalId {
@@ -582,6 +573,9 @@ class TraceID {
const char* scope() const { return scope_; }
unsigned int id_flags() const { return id_flags_; }
+ std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
+ AsConvertableToTraceFormat() const;
+
private:
const char* scope_ = nullptr;
unsigned long long raw_id_;
« no previous file with comments | « base/trace_event/common/trace_event_common.h ('k') | base/trace_event/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698