Index: base/trace_event/trace_event_impl.cc |
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc |
index 1fc22565d0ec182e1e908abb40f36921846f23bb..71e64239f3b7cff38b20438321dddf71e5b33a95 100644 |
--- a/base/trace_event/trace_event_impl.cc |
+++ b/base/trace_event/trace_event_impl.cc |
@@ -602,6 +602,7 @@ void TraceEvent::Initialize( |
thread_id_ = thread_id; |
phase_ = phase; |
flags_ = flags; |
+ flowEvent_ = NULL; |
// Clamp num_args since it may have been set by a third_party library. |
num_args = (num_args > kTraceMaxNumArgs) ? kTraceMaxNumArgs : num_args; |
@@ -862,6 +863,12 @@ void TraceEvent::AppendAsJSON( |
StringAppendF(out, ",\"s\":\"%c\"", scope); |
} |
+ // Output flow event info if there is any |
+ if (flowEvent_) { |
+ StringAppendF(out, ",\"flow\":"); |
+ flowEvent_->AppendAsJSON(out, argument_filter_predicate); |
+ } |
+ |
*out += "}"; |
} |
@@ -888,6 +895,12 @@ void TraceEvent::AppendPrettyPrinted(std::ostringstream* out) const { |
} |
} |
+bool TraceEvent::isFlowEvent() const { |
+ return ((phase() == TRACE_EVENT_PHASE_FLOW_BEGIN) || |
+ (phase() == TRACE_EVENT_PHASE_FLOW_STEP) || |
+ (phase() == TRACE_EVENT_PHASE_FLOW_END)); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// |
// TraceResultBuffer |
@@ -1851,6 +1864,11 @@ void TraceLog::ConvertTraceEventsToTraceFormat( |
scoped_refptr<RefCountedString> json_events_str_ptr = new RefCountedString(); |
while (const TraceBufferChunk* chunk = logged_events->NextChunk()) { |
for (size_t j = 0; j < chunk->size(); ++j) { |
+ // Flow Events are always bundled to regular events, and will be handled |
+ // within their bundled events. |
+ if (chunk->GetEventAt(j)->isFlowEvent()) |
+ continue; |
+ |
size_t size = json_events_str_ptr->size(); |
if (size > kTraceEventBufferSizeInBytes) { |
flush_output_callback.Run(json_events_str_ptr, true); |