Chromium Code Reviews| Index: content/browser/browser_shutdown_profile_dumper.h |
| diff --git a/content/browser/browser_shutdown_profile_dumper.h b/content/browser/browser_shutdown_profile_dumper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..da71223d424315304b2c8fdf2dd4bd731bd40382 |
| --- /dev/null |
| +++ b/content/browser/browser_shutdown_profile_dumper.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_BROWSER_SHUTDOWN_PROFILE_DUMPER_H_ |
| +#define CONTENT_BROWSER_BROWSER_SHUTDOWN_PROFILE_DUMPER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/ref_counted_memory.h" |
| +#include "content/common/content_export.h" |
| + |
| +namespace base { |
| +class FilePath; |
| +} |
| + |
| +namespace content { |
| + |
| +// This class is intended to dump the tracing results of the shutdown process |
| +// to a file before the browser process exits. |
| +// It will save the file either into the command line passed |
| +// "--trace-shutdown-file=<name>" parameter - or - to "chrometrace.log" in the |
| +// current directory. |
| +// 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.
|
| +// object gets destroyed. |
| +// Note that we cannot use the asynchronous file writer since the |
| +// |SequencedWorkerPool| will get killed in the shutdown process. |
| +class BrowserShutdownProfileDumper { |
| + public: |
| + BrowserShutdownProfileDumper(); |
| + |
| + virtual ~BrowserShutdownProfileDumper(); |
|
sky
2013/09/05 00:00:14
no virtual.
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
|
| + |
| + private: |
| + // 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.
|
| + 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.
|
| + |
| + // Returns the file name where we should save the trace dump to. |
| + base::FilePath GetFileName(); |
| + |
| + // The callback for the |TraceLog::Flush| function. It saves all traces to |
| + // disc. |
| + void WriteTraceDataCollected( |
| + const scoped_refptr<base::RefCountedString>& events_str); |
| + |
| + // Returns true if the dump file is valid. |
| + bool IsFileValid(); |
| + |
| + // Writes a string to the dump file. |
| + void WriteString(const std::string& string); |
| + |
| + // Write a buffer to the dump file. |
| + void WriteChars(const char* chars, size_t size); |
| + |
| + // Closes the dump file. |
| + void CloseFile(); |
| + |
| + // The number of blocks we have already written. |
| + int blocks_; |
| + // For dumping the content to disc. |
| + FILE* dump_file_; |
| +}; |
|
sky
2013/09/05 00:00:14
DISALLOW_...
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
|
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_BROWSER_SHUTDOWN_PROFILE_DUMPER_H_ |