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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_TRACING_TRACE_SUBSCRIBER_STDIO_H_
6 #define CONTENT_BROWSER_TRACING_TRACE_SUBSCRIBER_STDIO_H_
10 #include "base/compiler_specific.h"
11 #include "content/public/browser/trace_subscriber.h"
12 #include "content/common/content_export.h"
20 // Stdio implementation of TraceSubscriber. Use this to write traces to a file.
21 class CONTENT_EXPORT TraceSubscriberStdio
22 : NON_EXPORTED_BASE(public TraceSubscriber
) {
25 // Output file as array, representing trace events:
26 // [event1, event2, ...]
28 // Output file as property list with one or two items:
29 // {traceEvents: [event1, event2, ...],
30 // systemTraceEvents: "event1\nevent2\n..." // optional}
31 FILE_TYPE_PROPERTY_LIST
34 // has_system_trace indicates whether system trace events are expected.
35 TraceSubscriberStdio(const base::FilePath
& path
,
37 bool has_system_trace
);
38 virtual ~TraceSubscriberStdio();
40 // Implementation of TraceSubscriber
41 virtual void OnEndTracingComplete() OVERRIDE
;
42 virtual void OnTraceDataCollected(
43 const scoped_refptr
<base::RefCountedString
>& data_ptr
) OVERRIDE
;
45 // To be used as callback to DebugDaemonClient::RequestStopSystemTracing().
46 virtual void OnEndSystemTracing(
47 const scoped_refptr
<base::RefCountedString
>& events_str_ptr
);
50 class TraceSubscriberStdioWorker
;
51 scoped_refptr
<TraceSubscriberStdioWorker
> worker_
;
52 DISALLOW_COPY_AND_ASSIGN(TraceSubscriberStdio
);
55 } // namespace content
57 #endif // CONTENT_BROWSER_TRACING_TRACE_SUBSCRIBER_STDIO_H_