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

Side by Side Diff: content/browser/trace_subscriber_stdio.h

Issue 9443020: Use SequencedWorkerPool for disk operations in TraceSubscriberStdio. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 10 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/trace_message_filter.cc ('k') | content/browser/trace_subscriber_stdio.cc » ('j') | 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) 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 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 14
15 namespace content {
16
17 class TraceSubscriberStdioImpl;
18
15 // Stdio implementation of TraceSubscriber. Use this to write traces to a file. 19 // Stdio implementation of TraceSubscriber. Use this to write traces to a file.
16 class CONTENT_EXPORT TraceSubscriberStdio : public TraceSubscriber { 20 class CONTENT_EXPORT TraceSubscriberStdio : public TraceSubscriber {
17 public: 21 public:
18 TraceSubscriberStdio();
19 // Creates or overwrites the specified file. Check IsValid() for success. 22 // Creates or overwrites the specified file. Check IsValid() for success.
20 explicit TraceSubscriberStdio(const FilePath& path); 23 explicit TraceSubscriberStdio(const FilePath& path);
21 24 virtual ~TraceSubscriberStdio();
22 // Creates or overwrites the specified file. Returns true on success.
23 bool OpenFile(const FilePath& path);
24 // Finishes json output and closes file.
25 void CloseFile();
26
27 // Returns TRUE if we're currently writing data to a file.
28 bool IsValid();
29 25
30 // Implementation of TraceSubscriber 26 // Implementation of TraceSubscriber
31 virtual void OnEndTracingComplete() OVERRIDE; 27 virtual void OnEndTracingComplete() OVERRIDE;
32 virtual void OnTraceDataCollected(const std::string& trace_fragment) OVERRIDE; 28 virtual void OnTraceDataCollected(
33 29 const scoped_refptr<base::RefCountedString>& data_ptr) OVERRIDE;
34 virtual ~TraceSubscriberStdio();
35 30
36 private: 31 private:
37 void Write(const std::string& output_str); 32 scoped_refptr<TraceSubscriberStdioImpl> impl_;
38 33 DISALLOW_COPY_AND_ASSIGN(TraceSubscriberStdio);
39 FILE* file_;
40 base::debug::TraceResultBuffer trace_buffer_;
41 }; 34 };
42 35
36 } // namespace content
37
43 #endif // CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_ 38 #endif // CONTENT_BROWSER_TRACE_SUBSCRIBER_STDIO_H_
OLDNEW
« no previous file with comments | « content/browser/trace_message_filter.cc ('k') | content/browser/trace_subscriber_stdio.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698