Index: base/trace_event/trace_event_impl.h |
diff --git a/base/trace_event/trace_event_impl.h b/base/trace_event/trace_event_impl.h |
index ccb850033e1926d59ff4396b8a9bb36acf61a109..f89f53a1e0bee3b002098d19452717f97fb3746a 100644 |
--- a/base/trace_event/trace_event_impl.h |
+++ b/base/trace_event/trace_event_impl.h |
@@ -104,6 +104,10 @@ class BASE_EXPORT TraceEvent { |
TraceEvent(); |
~TraceEvent(); |
+ void appendFlowEvent(TraceEvent *flowEvent) { |
+ flowEvent_ = flowEvent; |
+ } |
+ |
// We don't need to copy TraceEvent except when TraceEventBuffer is cloned. |
// Use explicit copy method to avoid accidentally misuse of copy. |
void CopyFrom(const TraceEvent& other); |
@@ -149,6 +153,7 @@ class BASE_EXPORT TraceEvent { |
TimeDelta thread_duration() const { return thread_duration_; } |
unsigned long long id() const { return id_; } |
unsigned char flags() const { return flags_; } |
+ bool isFlowEvent() const; |
// Exposed for unittesting: |
@@ -185,6 +190,7 @@ class BASE_EXPORT TraceEvent { |
char phase_; |
unsigned char flags_; |
unsigned char arg_types_[kTraceMaxNumArgs]; |
+ TraceEvent *flowEvent_; |
DISALLOW_COPY_AND_ASSIGN(TraceEvent); |
}; |
@@ -709,6 +715,32 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider { |
DISALLOW_COPY_AND_ASSIGN(TraceLog); |
}; |
+class TraceEventHandleWrapper { |
+public: |
+ TraceEventHandleWrapper() { |
+ handle_ = {0, 0, 0}; |
+ event_ = NULL; |
+ } |
+ TraceEventHandleWrapper(TraceEventHandle h) { |
+ handle_ = h; |
+ TraceLog* tracer = base::trace_event::TraceLog::GetInstance(); |
+ event_ = tracer->GetEventByHandle(h); |
+ } |
+ |
+ void appendFlowEvent(TraceEventHandle h) { |
+ if (event_) { |
+ TraceLog* tracer = base::trace_event::TraceLog::GetInstance(); |
+ TraceEvent *flowEvent = tracer->GetEventByHandle(h); |
+ event_->appendFlowEvent(flowEvent); |
+ } |
+ } |
+ |
+private: |
+ TraceEventHandle handle_; |
+ TraceEvent *event_; |
+}; |
+ |
+ |
} // namespace trace_event |
} // namespace base |