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

Unified Diff: chrome/browser/net/chrome_net_log.cc

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: Fix comments Created 5 years, 10 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
Index: chrome/browser/net/chrome_net_log.cc
diff --git a/chrome/browser/net/chrome_net_log.cc b/chrome/browser/net/chrome_net_log.cc
index 7b9fabd54b49e1c6888d08539d35ebaa168c11ca..20284eb7ed5ebb1aa3d1a3f6d1fe052c6ab25164 100644
--- a/chrome/browser/net/chrome_net_log.cc
+++ b/chrome/browser/net/chrome_net_log.cc
@@ -7,6 +7,7 @@
#include <stdio.h>
#include "base/command_line.h"
+#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -32,19 +33,19 @@ ChromeNetLog::ChromeNetLog()
// would result in an unbounded buffer size, so not much can be gained by
// doing this on another thread. It's only used when debugging Chrome, so
// performance is not a big concern.
- FILE* file = NULL;
+ base::ScopedFILE file;
#if defined(OS_WIN)
- file = _wfopen(log_path.value().c_str(), L"w");
+ file.reset(_wfopen(log_path.value().c_str(), L"w"));
#elif defined(OS_POSIX)
- file = fopen(log_path.value().c_str(), "w");
+ file.reset(fopen(log_path.value().c_str(), "w"));
#endif
- if (file == NULL) {
+ if (!file) {
LOG(ERROR) << "Could not open file " << log_path.value()
<< " for net logging";
} else {
scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants());
- net_log_logger_.reset(new net::NetLogLogger(file, *constants));
+ net_log_logger_.reset(new net::NetLogLogger());
if (command_line->HasSwitch(switches::kNetLogLevel)) {
std::string log_level_string =
command_line->GetSwitchValueASCII(switches::kNetLogLevel);
@@ -56,7 +57,8 @@ ChromeNetLog::ChromeNetLog()
static_cast<LogLevel>(command_line_log_level));
}
}
- net_log_logger_->StartObserving(this);
+ net_log_logger_->StartObserving(this, file.Pass(), constants.get(),
+ nullptr);
}
}

Powered by Google App Engine
This is Rietveld 408576698