Chromium Code Reviews| 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 95cf06d5a576c061eda861c74f923de6c50b9eef..3f099a46436335cd94f16b2327ca5b8d67b15b8e 100644 |
| --- a/base/trace_event/trace_event_impl.cc |
| +++ b/base/trace_event/trace_event_impl.cc |
| @@ -1738,6 +1738,7 @@ void TraceLog::Flush(const TraceLog::OutputCallback& cb) { |
| FinishFlush(generation); |
| } |
| + |
| void TraceLog::ConvertTraceEventsToTraceFormat( |
| scoped_ptr<TraceBuffer> logged_events, |
| const TraceLog::OutputCallback& flush_output_callback) { |
| @@ -1745,9 +1746,10 @@ void TraceLog::ConvertTraceEventsToTraceFormat( |
| if (flush_output_callback.is_null()) |
| return; |
| - // The callback need to be called at least once even if there is no events |
| - // to let the caller know the completion of flush. |
| + // The callback needs to be called at least once even if there is no events to |
| + // let the caller know the completion of flush. |
| bool has_more_events = true; |
| + |
| do { |
| scoped_refptr<RefCountedString> json_events_str_ptr = |
| new RefCountedString(); |
| @@ -1889,6 +1891,46 @@ TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
| unsigned long long id, |
| int thread_id, |
| const TimeTicks& timestamp, |
| + const TimeTicks& thread_time, |
| + int num_args, |
| + const char** arg_names, |
| + const unsigned char* arg_types, |
| + const unsigned long long* arg_values, |
| + const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
| + unsigned char flags) { |
| + return AddTraceEventInternal( |
| + phase, category_group_enabled, name, id, thread_id, timestamp, |
| + thread_time, num_args, arg_names, arg_types, arg_values, |
| + convertable_values, flags); |
| +} |
| + |
| +TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
| + char phase, |
| + const unsigned char* category_group_enabled, |
| + const char* name, |
| + unsigned long long id, |
| + int thread_id, |
| + const TimeTicks& timestamp, |
| + int num_args, |
| + const char** arg_names, |
| + const unsigned char* arg_types, |
| + const unsigned long long* arg_values, |
| + const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
| + unsigned char flags) { |
| + return AddTraceEventInternal( |
|
dsinclair
2015/02/09 21:11:20
Instead of adding the Internal version, just have
Benoit L
2015/02/10 15:31:35
Done.
|
| + phase, category_group_enabled, name, id, thread_id, timestamp, |
| + ThreadNow(), num_args, arg_names, arg_types, arg_values, |
| + convertable_values, flags); |
| +} |
| + |
| +TraceEventHandle TraceLog::AddTraceEventInternal( |
| + char phase, |
| + const unsigned char* category_group_enabled, |
| + const char* name, |
| + unsigned long long id, |
| + int thread_id, |
| + const TimeTicks& timestamp, |
| + const TimeTicks& thread_time, |
| int num_args, |
| const char** arg_names, |
| const unsigned char* arg_types, |
| @@ -1913,7 +1955,6 @@ TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
| id ^= process_id_hash_; |
| TimeTicks now = OffsetTimestamp(timestamp); |
| - TimeTicks thread_now = ThreadNow(); |
| ThreadLocalEventBuffer* thread_local_event_buffer = NULL; |
| // A ThreadLocalEventBuffer needs the message loop |
| @@ -1985,7 +2026,7 @@ TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
| } |
| if (trace_event) { |
| - trace_event->Initialize(thread_id, now, thread_now, phase, |
| + trace_event->Initialize(thread_id, now, thread_time, phase, |
| category_group_enabled, name, id, |
| num_args, arg_names, arg_types, arg_values, |
| convertable_values, flags); |
| @@ -2034,7 +2075,7 @@ TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
| } |
| if (thread_local_event_buffer) |
| - thread_local_event_buffer->ReportOverhead(now, thread_now); |
| + thread_local_event_buffer->ReportOverhead(now, thread_time); |
| return handle; |
| } |