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

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

Issue 23691025: Adding shutdown tracing capabilities (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved the trace starting for OS'ses other then ChromeOS to a later point where is no user intervent… Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(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".
DaveMoore 2013/09/03 17:02:48 What directory is chrometrace.log located in?
Mr4D (OOO till 08-26) 2013/09/03 17:34:34 Added a comment. But following the way as startup
25 // Use the class with a scoped_ptr to automatically write the dump when the
26 // object gets destroyed.
27 // Note that we cannot use the asynchronous file writer since the
28 // |SequencedWorkerPool| will get killed in the shutdown process.
29 class BrowserShutdownProfileDumper {
30 public:
31 BrowserShutdownProfileDumper();
32
33 virtual ~BrowserShutdownProfileDumper();
34
35 private:
36 // Writes all traces which happened to disc.
37 void WriteTracesToDisc(base::FilePath file_name);
38
39 // Returns the file name where we should save the trace dump to.
40 base::FilePath GetFileName();
41
42 // The callback for the |TraceLog::Flush| function. It saves all traces to
43 // disc.
44 void WriteTraceDataCollected(
45 const scoped_refptr<base::RefCountedString>& events_str);
46
47 // Returns true if the dump file is valid.
48 bool IsFileValid();
49
50 // Writes a string to the dump file.
51 void WriteString(const std::string& string);
52
53 // Write a buffer to the dump file.
54 void WriteChars(const char* chars, size_t size);
55
56 // Closes the dump file.
57 void CloseFile();
58
59 // The number of blocks we have already written.
60 int blocks_;
61 // For dumping the content to disc.
62 FILE* dump_file_;
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_BROWSER_BROWSER_SHUTDOWN_PROFILE_DUMPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698