| Index: net/log/file_net_log_observer.h
|
| diff --git a/net/log/file_net_log_observer.h b/net/log/file_net_log_observer.h
|
| index b7c8a2fac427b551da5fac1b4b9250815f81cadd..6173a2496b1c628330514738453bc36817f3705e 100644
|
| --- a/net/log/file_net_log_observer.h
|
| +++ b/net/log/file_net_log_observer.h
|
| @@ -21,7 +21,6 @@ class SingleThreadTaskRunner;
|
| namespace net {
|
|
|
| class NetLogCaptureMode;
|
| -class URLRequestContext;
|
|
|
| // FileNetLogObserver watches the NetLog event stream and sends all entries to
|
| // either a group of files in a directory (bounded mode) or to a single file
|
| @@ -49,16 +48,12 @@ class URLRequestContext;
|
| // on which thread is used.
|
| class NET_EXPORT FileNetLogObserver : public NetLog::ThreadSafeObserver {
|
| public:
|
| + // Creates a FileNetLogObserver in bounded mode.
|
| + //
|
| // |file_task_runner| indicates the task runner that should be used to post
|
| // tasks from the main thread to the file thread.
|
| - explicit FileNetLogObserver(
|
| - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner);
|
| -
|
| - ~FileNetLogObserver() override;
|
| -
|
| - // Starts observing |net_log| in bounded mode and writes output files to
|
| - // |directory|.
|
| - // May only be called once in the lifetime of the object.
|
| + //
|
| + // |directory| is the directory where the log files will be.
|
| //
|
| // |max_total_size| is the approximate limit on the cumulative size of all
|
| // netlog files.
|
| @@ -69,48 +64,44 @@ class NET_EXPORT FileNetLogObserver : public NetLog::ThreadSafeObserver {
|
| // |constants| is an optional legend for decoding constant values used in
|
| // the log. It should generally be a modified version of GetNetConstants().
|
| // If not present, the output of GetNetConstants() will be used.
|
| + static std::unique_ptr<FileNetLogObserver> CreateBounded(
|
| + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
|
| + const base::FilePath& directory,
|
| + size_t max_total_size,
|
| + size_t total_num_files,
|
| + std::unique_ptr<base::Value> constants);
|
| +
|
| + // Creates a FileNetLogObserver in unbounded mode.
|
| //
|
| - // |url_request_context| is an optional URLRequestContext that will be used
|
| - // to pre-populate the log with information about in-progress events. If the
|
| - // context is non-NULL, StartObservingBounded() must be called on the
|
| - // context's thread.
|
| - void StartObservingBounded(NetLog* net_log,
|
| - NetLogCaptureMode capture_mode,
|
| - const base::FilePath& directory,
|
| - std::unique_ptr<base::Value> constants,
|
| - URLRequestContext* url_request_context,
|
| - size_t max_total_size,
|
| - size_t total_num_files);
|
| -
|
| - // Starts observing |net_log| in unbounded mode and writes to the file at
|
| - // |filepath|.
|
| - // May only be called once in the lifetime of the object.
|
| + // |file_task_runner| indicates the task runner that should be used to post
|
| + // tasks from the main thread to the file thread.
|
| + //
|
| + // |log_path| is where the log file will be.
|
| //
|
| // |constants| is an optional legend for decoding constant values used in
|
| // the log. It should generally be a modified version of GetNetConstants().
|
| // If not present, the output of GetNetConstants() will be used.
|
| - //
|
| - // |url_request_context| is an optional URLRequestContext that will be used
|
| - // to pre-populate the log with information about in-progress events. If the
|
| - // context is non-NULL, StartObservingUnbounded() must be called on
|
| - // the context's thread.
|
| - void StartObservingUnbounded(NetLog* net_log,
|
| - NetLogCaptureMode capture_mode,
|
| - const base::FilePath& filepath,
|
| - std::unique_ptr<base::Value> constants,
|
| - URLRequestContext* url_request_context);
|
| -
|
| - // Stops observing net_log(). Must be called after StartObservingBounded/
|
| - // StartObservingUnbounded. Should be called before destruction of the
|
| + static std::unique_ptr<FileNetLogObserver> CreateUnbounded(
|
| + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
|
| + const base::FilePath& log_path,
|
| + std::unique_ptr<base::Value> constants);
|
| +
|
| + ~FileNetLogObserver() override;
|
| +
|
| + // Attaches this observer to |net_log| and begins observing events.
|
| + void StartObserving(NetLog* net_log, NetLogCaptureMode capture_mode);
|
| +
|
| + // Stops observing net_log() and closes the output file(s). Must be called
|
| + // after StartObserving. Should be called before destruction of the
|
| // FileNetLogObserver and the NetLog, or the NetLog files will be deleted when
|
| // the observer is destroyed.
|
| //
|
| + // |polled_data| is an optional argument used to add additional network stack
|
| + // state to the log.
|
| + //
|
| // |callback| will be run on whichever thread StopObserving() was called on
|
| // once all file writing is complete and the netlog files can be accessed
|
| // safely.
|
| - //
|
| - // |polled_data| is an optional argument used to add additional network stack
|
| - // state to the log.
|
| void StopObserving(std::unique_ptr<base::Value> polled_data,
|
| const base::Closure& callback);
|
|
|
| @@ -123,12 +114,11 @@ class NET_EXPORT FileNetLogObserver : public NetLog::ThreadSafeObserver {
|
| class BoundedFileWriter;
|
| class UnboundedFileWriter;
|
|
|
| - // Performs tasks common to both StartObservingBounded() and
|
| - // StartObservingUnbounded().
|
| - void StartObservingHelper(NetLog* net_log,
|
| - NetLogCaptureMode capture_mode,
|
| - std::unique_ptr<base::Value> constants,
|
| - URLRequestContext* url_request_context);
|
| + FileNetLogObserver(
|
| + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
|
| + std::unique_ptr<FileWriter> file_writer,
|
| + scoped_refptr<WriteQueue> write_queue,
|
| + std::unique_ptr<base::Value> constants);
|
|
|
| scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
|
|
|
|
|