Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: content/browser/tracing/trace_subscriber_stdio.cc

Issue 22962004: Thread-local trace-event buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update browser_shutdown_profile_dumper Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/tracing/trace_controller_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/tracing/trace_subscriber_stdio.h" 5 #include "content/browser/tracing/trace_subscriber_stdio.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 39
40 LOG(INFO) << "Logging performance trace to file: " << path_.value(); 40 LOG(INFO) << "Logging performance trace to file: " << path_.value();
41 if (file_type_ == FILE_TYPE_PROPERTY_LIST) 41 if (file_type_ == FILE_TYPE_PROPERTY_LIST)
42 WriteString("{\"traceEvents\":"); 42 WriteString("{\"traceEvents\":");
43 WriteString("["); 43 WriteString("[");
44 } 44 }
45 45
46 void OnTraceData(const scoped_refptr<base::RefCountedString>& data_ptr) { 46 void OnTraceData(const scoped_refptr<base::RefCountedString>& data_ptr) {
47 if (!IsValid()) 47 if (!IsValid())
48 return; 48 return;
49 DCHECK(!data_ptr->data().empty());
49 if (needs_comma_) 50 if (needs_comma_)
50 WriteString(","); 51 WriteString(",");
51 WriteString(data_ptr->data()); 52 WriteString(data_ptr->data());
52 needs_comma_ = true; 53 needs_comma_ = true;
53 } 54 }
54 55
55 void OnSystemTraceData( 56 void OnSystemTraceData(
56 const scoped_refptr<base::RefCountedString>& data_ptr) { 57 const scoped_refptr<base::RefCountedString>& data_ptr) {
57 if (wrote_trace_) { 58 if (wrote_trace_) {
58 WriteSystemTrace(data_ptr); 59 WriteSystemTrace(data_ptr);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 void TraceSubscriberStdio::OnEndSystemTracing( 192 void TraceSubscriberStdio::OnEndSystemTracing(
192 const scoped_refptr<base::RefCountedString>& events_str_ptr) { 193 const scoped_refptr<base::RefCountedString>& events_str_ptr) {
193 BrowserThread::PostBlockingPoolSequencedTask( 194 BrowserThread::PostBlockingPoolSequencedTask(
194 __FILE__, FROM_HERE, 195 __FILE__, FROM_HERE,
195 base::Bind(&TraceSubscriberStdioWorker::OnSystemTraceData, 196 base::Bind(&TraceSubscriberStdioWorker::OnSystemTraceData,
196 worker_, 197 worker_,
197 events_str_ptr)); 198 events_str_ptr));
198 } 199 }
199 200
200 } // namespace content 201 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/trace_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698