Index: chrome/browser/net/net_log_logger.cc |
=================================================================== |
--- chrome/browser/net/net_log_logger.cc (revision 175049) |
+++ chrome/browser/net/net_log_logger.cc (working copy) |
@@ -14,7 +14,7 @@ |
#include "base/values.h" |
#include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
-NetLogLogger::NetLogLogger(const FilePath &log_path) { |
+NetLogLogger::NetLogLogger(const FilePath &log_path) : net_log_(NULL) { |
if (!log_path.empty()) { |
base::ThreadRestrictions::ScopedAllowIO allow_io; |
FILE* fp = file_util::OpenFile(log_path, "w"); |
@@ -41,8 +41,15 @@ |
void NetLogLogger::StartObserving(net::NetLog* net_log) { |
net_log->AddThreadSafeObserver(this, net::NetLog::LOG_ALL_BUT_BYTES); |
+ net_log_ = net_log; |
} |
+void NetLogLogger::StopObserving() { |
+ DCHECK(net_log_); |
+ net_log_->RemoveThreadSafeObserver(this); |
+ net_log_ = NULL; |
+} |
+ |
void NetLogLogger::OnAddEntry(const net::NetLog::Entry& entry) { |
scoped_ptr<Value> value(entry.ToValue()); |
// Don't pretty print, so each JSON value occupies a single line, with no |