| Index: net/base/net_log_logger.h
|
| diff --git a/net/base/net_log_logger.h b/net/base/net_log_logger.h
|
| index ede3ca443db32839305e97af91699de692930baf..79a45d84c25fed5d3a7b1936d2a237dfe4eb7d16 100644
|
| --- a/net/base/net_log_logger.h
|
| +++ b/net/base/net_log_logger.h
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/files/scoped_file.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "net/base/net_log.h"
|
|
|
| namespace base {
|
| @@ -19,38 +20,48 @@ class Value;
|
|
|
| namespace net {
|
|
|
| +class URLRequestContext;
|
| +
|
| // NetLogLogger watches the NetLog event stream, and sends all entries to
|
| // a file specified on creation.
|
| //
|
| // The text file will contain a single JSON object.
|
| class NET_EXPORT NetLogLogger : public NetLog::ThreadSafeObserver {
|
| public:
|
| - // Takes ownership of |file| and will write network events to it once logging
|
| - // starts. |file| must be non-NULL handle and be open for writing.
|
| - // |constants| is a legend for decoding constant values used in the log.
|
| - NetLogLogger(FILE* file, const base::Value& constants);
|
| + NetLogLogger();
|
| ~NetLogLogger() override;
|
|
|
| // Sets the log level to log at. Must be called before StartObserving.
|
| void set_log_level(NetLog::LogLevel log_level);
|
|
|
| - // Starts observing specified NetLog. Must not already be watching a NetLog.
|
| - // Separate from constructor to enforce thread safety.
|
| - void StartObserving(NetLog* net_log);
|
| -
|
| - // Stops observing net_log(). Must already be watching.
|
| - void StopObserving();
|
| + // Starts observing |net_log| and writes output to |file|. Must not already
|
| + // be watching a NetLog. Separate from constructor to enforce thread safety.
|
| + //
|
| + // |file| must be a non-NULL empty file that's open for writing.
|
| + //
|
| + // |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, this must be called on the context's thread.
|
| + void StartObserving(NetLog* net_log,
|
| + base::ScopedFILE file,
|
| + base::Value* constants,
|
| + net::URLRequestContext* url_request_context);
|
| +
|
| + // Stops observing net_log(). Must already be watching. Must be called
|
| + // before destruction of the NetLogLogger and the NetLog.
|
| + //
|
| + // |url_request_context| is an optional argument used to added additional
|
| + // network stack state to the log. If the context is non-NULL, this must be
|
| + // called on the context's thread.
|
| + void StopObserving(net::URLRequestContext* url_request_context);
|
|
|
| // net::NetLog::ThreadSafeObserver implementation:
|
| void OnAddEntry(const NetLog::Entry& entry) override;
|
|
|
| - // Create a dictionary containing legend for net/ constants. Caller takes
|
| - // ownership of returned value.
|
| - // TODO(mmenke): Get rid of this, and have embedders use GetNetConstants
|
| - // directly. Also maybe call that function by default, so only embedders
|
| - // that need more constants need to worry about it.
|
| - static base::DictionaryValue* GetConstants();
|
| -
|
| private:
|
| base::ScopedFILE file_;
|
|
|
|
|