| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_ | 5 #ifndef CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_ |
| 6 #define CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_ | 6 #define CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "content/browser/trace_controller.h" | 12 #include "content/browser/trace_controller.h" |
| 13 | 13 |
| 14 // Stdio implementation of TraceSubscriber. Use this to write traces to a file. | 14 // Stdio implementation of TraceSubscriber. Use this to write traces to a file. |
| 15 class TraceSubscriberStdio : public TraceSubscriber { | 15 class TraceSubscriberStdio : public TraceSubscriber { |
| 16 public: | 16 public: |
| 17 // Creates or overwrites the specified file. Check IsValid() for success. | 17 // Creates or overwrites the specified file. Check IsValid() for success. |
| 18 explicit TraceSubscriberStdio(const FilePath& path); | 18 explicit TraceSubscriberStdio(const FilePath& path); |
| 19 | 19 |
| 20 // Returns TRUE if we're currently writing data to a file. | 20 // Returns TRUE if we're currently writing data to a file. |
| 21 bool IsValid(); | 21 bool IsValid(); |
| 22 | 22 |
| 23 // Implementation of TraceSubscriber | 23 // Implementation of TraceSubscriber |
| 24 virtual void OnEndTracingComplete(); | 24 virtual void OnEndTracingComplete(); |
| 25 virtual void OnTraceDataCollected(const std::string& json_events); | 25 virtual void OnTraceDataCollected(const std::string& json_events); |
| 26 | 26 |
| 27 virtual ~TraceSubscriberStdio(); | 27 virtual ~TraceSubscriberStdio(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 FILE* m_file; | 30 FILE* file_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 #endif // CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_ | 33 #endif // CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_ |
| OLD | NEW |