Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / tracing / trace_subscriber_stdio.h
blob06a70db8c88be665ec5407aa1f3df7109cfd7bb3
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_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "content/public/browser/trace_subscriber.h"
12 #include "content/common/content_export.h"
14 namespace base {
15 class FilePath;
18 namespace content {
20 class TraceSubscriberStdioImpl;
22 // Stdio implementation of TraceSubscriber. Use this to write traces to a file.
23 class CONTENT_EXPORT TraceSubscriberStdio
24 : NON_EXPORTED_BASE(public TraceSubscriber) {
25 public:
26 // Creates or overwrites the specified file. Check IsValid() for success.
27 explicit TraceSubscriberStdio(const base::FilePath& path);
28 virtual ~TraceSubscriberStdio();
30 // Implementation of TraceSubscriber
31 virtual void OnEndTracingComplete() OVERRIDE;
32 virtual void OnTraceDataCollected(
33 const scoped_refptr<base::RefCountedString>& data_ptr) OVERRIDE;
35 private:
36 scoped_refptr<TraceSubscriberStdioImpl> impl_;
37 DISALLOW_COPY_AND_ASSIGN(TraceSubscriberStdio);
40 } // namespace content
42 #endif // CONTENT_BROWSER_TRACING_TRACE_SUBSCRIBER_STDIO_H_