Chromium Code Reviews| Index: base/trace_event/trace_event.h |
| diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h |
| index fe8f6576d697b5fccda6b624c6323687a70b0243..59c2058b2fbb284fa715cf4dcd5e0b9546fee51a 100644 |
| --- a/base/trace_event/trace_event.h |
| +++ b/base/trace_event/trace_event.h |
| @@ -44,8 +44,8 @@ |
| // By default, trace IDs are eventually converted to a single 64-bit number. Use |
| // this macro to add a scope string. |
|
Primiano Tucci (use gerrit)
2017/01/17 12:25:47
can you just add some examples in the comment to s
chiniforooshan1
2017/01/17 16:44:08
Done.
|
| -#define TRACE_ID_WITH_SCOPE(scope, id) \ |
| - trace_event_internal::TraceID::WithScope(scope, id) |
| +#define TRACE_ID_WITH_SCOPE(scope, ...) \ |
| + trace_event_internal::TraceID::WithScope(scope, ##__VA_ARGS__) |
| #define TRACE_ID_GLOBAL(id) trace_event_internal::TraceID::GlobalId(id) |
| #define TRACE_ID_LOCAL(id) trace_event_internal::TraceID::LocalId(id) |
| @@ -430,11 +430,27 @@ class BASE_EXPORT TraceID { |
| : scope_(scope), raw_id_(global_id.raw_id()) { |
| id_flags_ = TRACE_EVENT_FLAG_HAS_GLOBAL_ID; |
| } |
| + WithScope(const char* scope, |
| + unsigned long long prefix, |
| + unsigned long long raw_id) |
| + : scope_(scope), has_prefix_(true), prefix_(prefix), raw_id_(raw_id) {} |
| + WithScope(const char* scope, unsigned long long prefix, GlobalId global_id) |
| + : scope_(scope), |
| + has_prefix_(true), |
| + prefix_(prefix), |
| + raw_id_(global_id.raw_id()) { |
| + id_flags_ = TRACE_EVENT_FLAG_HAS_GLOBAL_ID; |
| + } |
| unsigned long long raw_id() const { return raw_id_; } |
| const char* scope() const { return scope_; } |
| + bool has_prefix() const { return has_prefix_; } |
| + unsigned long long prefix() const { return prefix_; } |
| unsigned int id_flags() const { return id_flags_; } |
| + |
| private: |
| const char* scope_ = nullptr; |
| + bool has_prefix_ = false; |
| + unsigned long long prefix_; |
| unsigned long long raw_id_; |
| unsigned int id_flags_ = TRACE_EVENT_FLAG_HAS_ID; |
| }; |
| @@ -517,11 +533,17 @@ class BASE_EXPORT TraceID { |
| TraceID(GlobalId raw_id) : raw_id_(raw_id.raw_id()) { |
| id_flags_ = TRACE_EVENT_FLAG_HAS_GLOBAL_ID; |
| } |
| - TraceID(WithScope scoped_id) : scope_(scoped_id.scope()), |
| - raw_id_(scoped_id.raw_id()), id_flags_(scoped_id.id_flags()) {} |
| + TraceID(WithScope scoped_id) |
| + : scope_(scoped_id.scope()), |
| + has_prefix_(scoped_id.has_prefix()), |
| + prefix_(scoped_id.prefix()), |
| + raw_id_(scoped_id.raw_id()), |
| + id_flags_(scoped_id.id_flags()) {} |
| unsigned long long raw_id() const { return raw_id_; } |
| const char* scope() const { return scope_; } |
| + bool has_prefix() const { return has_prefix_; } |
| + unsigned long long prefix() const { return prefix_; } |
| unsigned int id_flags() const { return id_flags_; } |
| std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| @@ -529,6 +551,8 @@ class BASE_EXPORT TraceID { |
| private: |
| const char* scope_ = nullptr; |
| + bool has_prefix_ = false; |
| + unsigned long long prefix_; |
| unsigned long long raw_id_; |
| unsigned int id_flags_ = TRACE_EVENT_FLAG_HAS_ID; |
| }; |