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

Unified Diff: net/base/net_log_logger.h

Issue 976483002: Add ability for NetLogLogger to gather data from more than just NetLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gcm/tools/mcs_probe.cc ('k') | net/base/net_log_logger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « google_apis/gcm/tools/mcs_probe.cc ('k') | net/base/net_log_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698