| 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 b5d4298e653027c20bfd52b7806aaac90f1e928a..5882333c1714385d343be54791629c67031772fa 100644
|
| --- a/base/trace_event/trace_event_impl.cc
|
| +++ b/base/trace_event/trace_event_impl.cc
|
| @@ -1815,25 +1815,21 @@ void TraceLog::ConvertTraceEventsToTraceFormat(
|
|
|
| // The callback need 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();
|
| -
|
| - while (json_events_str_ptr->size() < kTraceEventBufferSizeInBytes) {
|
| - const TraceBufferChunk* chunk = logged_events->NextChunk();
|
| - has_more_events = chunk != NULL;
|
| - if (!chunk)
|
| - break;
|
| - for (size_t j = 0; j < chunk->size(); ++j) {
|
| - if (json_events_str_ptr->size())
|
| - json_events_str_ptr->data().append(",\n");
|
| - chunk->GetEventAt(j)->AppendAsJSON(&(json_events_str_ptr->data()),
|
| - argument_filter_predicate);
|
| + 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) {
|
| + size_t size = json_events_str_ptr->size();
|
| + if (size > kTraceEventBufferSizeInBytes) {
|
| + flush_output_callback.Run(json_events_str_ptr, true);
|
| + json_events_str_ptr = new RefCountedString();
|
| + } else if (size) {
|
| + json_events_str_ptr->data().append(",\n");
|
| }
|
| + chunk->GetEventAt(j)->AppendAsJSON(&(json_events_str_ptr->data()),
|
| + argument_filter_predicate);
|
| }
|
| - flush_output_callback.Run(json_events_str_ptr, has_more_events);
|
| - } while (has_more_events);
|
| + }
|
| + flush_output_callback.Run(json_events_str_ptr, false);
|
| }
|
|
|
| void TraceLog::FinishFlush(int generation) {
|
|
|