| Index: components/net_log/chrome_net_log.h
|
| diff --git a/components/net_log/chrome_net_log.h b/components/net_log/chrome_net_log.h
|
| index 42c0c2a56dbc5068366da2cfe069be13553c6ec1..cfa0298bf9771608b0df4f5c3ae5e12dbc50f84f 100644
|
| --- a/components/net_log/chrome_net_log.h
|
| +++ b/components/net_log/chrome_net_log.h
|
| @@ -18,7 +18,7 @@ class Value;
|
| }
|
|
|
| namespace net {
|
| -class WriteToFileNetLogObserver;
|
| +class FileNetLogObserver;
|
| class TraceNetLogObserver;
|
| }
|
|
|
| @@ -29,6 +29,10 @@ class NetExportFileWriter;
|
| // ChromeNetLog is an implementation of NetLog that manages common observers
|
| // (for --log-net-log, chrome://net-export/, tracing), as well as acting as the
|
| // entry point for other consumers.
|
| +//
|
| +// Threading:
|
| +// * The methods on net::NetLog are threadsafe
|
| +// * The methods defined by ChromeNetLog must be sequenced.
|
| class ChromeNetLog : public net::NetLog {
|
| public:
|
| ChromeNetLog();
|
| @@ -36,11 +40,11 @@ class ChromeNetLog : public net::NetLog {
|
|
|
| // Starts streaming the NetLog events to a file on disk. This will continue
|
| // until the application shuts down.
|
| - // * |log_file| - path to write the file.
|
| - // * |log_file_mode| - capture mode for event granularity.
|
| + // * |path| - destination file path of the log file.
|
| + // * |capture_mode| - capture mode for event granularity.
|
| void StartWritingToFile(
|
| - const base::FilePath& log_file,
|
| - net::NetLogCaptureMode log_file_mode,
|
| + const base::FilePath& path,
|
| + net::NetLogCaptureMode capture_mode,
|
| const base::CommandLine::StringType& command_line_string,
|
| const std::string& channel_string);
|
|
|
| @@ -52,9 +56,31 @@ class ChromeNetLog : public net::NetLog {
|
| const base::CommandLine::StringType& command_line_string,
|
| const std::string& channel_string);
|
|
|
| + // Notify the ChromeNetLog that things are shutting-down.
|
| + //
|
| + // If ChromeNetLog does not outlive the TaskScheduler, there is no need to
|
| + // call this.
|
| + //
|
| + // However, if it can outlive the TaskScheduler, this should be called
|
| + // before the TaskScheduler is shutdown. This allows for any file writers
|
| + // using BLOCK_SHUTDOWN to finish posting their writes.
|
| + //
|
| + // Not calling this is not a fatal error, however may result in an incomplete
|
| + // NetLog file being written to disk.
|
| + void ShutDownBeforeTaskScheduler();
|
| +
|
| private:
|
| - std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_;
|
| + // Deletes file_net_log_observer_.
|
| + void ClearFileNetLogObserver();
|
| +
|
| + // This observer handles writing NetLogs specified via StartWritingToFile()
|
| + // (In Chrome this corresponds to the --log-net-log command line).
|
| + std::unique_ptr<net::FileNetLogObserver> file_net_log_observer_;
|
| +
|
| + // This observer handles writing NetLogs started by chrome://net-export/
|
| std::unique_ptr<NetExportFileWriter> net_export_file_writer_;
|
| +
|
| + // This observer forwards NetLog events to the chrome://tracing system.
|
| std::unique_ptr<net::TraceNetLogObserver> trace_net_log_observer_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ChromeNetLog);
|
|
|