OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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. | |
4 | |
5 #ifndef CONTENT_BROWSER_BROWSER_SHUTDOWN_PROFILE_DUMPER_H_ | |
6 #define CONTENT_BROWSER_BROWSER_SHUTDOWN_PROFILE_DUMPER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/ref_counted_memory.h" | |
13 #include "content/common/content_export.h" | |
14 | |
15 namespace base { | |
16 class FilePath; | |
17 } | |
18 | |
19 namespace content { | |
20 | |
21 // This class is intended to dump the tracing results of the shutdown process | |
22 // to a file before the browser process exits. | |
23 // It will save the file either into the command line passed | |
24 // "--trace-shutdown-file=<name>" parameter - or - to "chrometrace.log" in the | |
25 // current directory. | |
26 // Use the class with a scoped_ptr to automatically write the dump when the | |
sky
2013/09/05 00:00:14
Instead of this I think you want. Files is written
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
| |
27 // object gets destroyed. | |
28 // Note that we cannot use the asynchronous file writer since the | |
29 // |SequencedWorkerPool| will get killed in the shutdown process. | |
30 class BrowserShutdownProfileDumper { | |
31 public: | |
32 BrowserShutdownProfileDumper(); | |
33 | |
34 virtual ~BrowserShutdownProfileDumper(); | |
sky
2013/09/05 00:00:14
no virtual.
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
| |
35 | |
36 private: | |
37 // Writes all traces which happened to disc. | |
sky
2013/09/05 00:00:14
Isn't it disk?
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
| |
38 void WriteTracesToDisc(base::FilePath file_name); | |
sky
2013/09/05 00:00:14
const base::FilePath&
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
| |
39 | |
40 // Returns the file name where we should save the trace dump to. | |
41 base::FilePath GetFileName(); | |
42 | |
43 // The callback for the |TraceLog::Flush| function. It saves all traces to | |
44 // disc. | |
45 void WriteTraceDataCollected( | |
46 const scoped_refptr<base::RefCountedString>& events_str); | |
47 | |
48 // Returns true if the dump file is valid. | |
49 bool IsFileValid(); | |
50 | |
51 // Writes a string to the dump file. | |
52 void WriteString(const std::string& string); | |
53 | |
54 // Write a buffer to the dump file. | |
55 void WriteChars(const char* chars, size_t size); | |
56 | |
57 // Closes the dump file. | |
58 void CloseFile(); | |
59 | |
60 // The number of blocks we have already written. | |
61 int blocks_; | |
62 // For dumping the content to disc. | |
63 FILE* dump_file_; | |
64 }; | |
sky
2013/09/05 00:00:14
DISALLOW_...
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
| |
65 | |
66 } // namespace content | |
67 | |
68 #endif // CONTENT_BROWSER_BROWSER_SHUTDOWN_PROFILE_DUMPER_H_ | |
OLD | NEW |