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

Unified Diff: google_apis/gcm/tools/mcs_probe.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: 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 | « content/shell/browser/shell_net_log.cc ('k') | net/base/net_log_logger.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/tools/mcs_probe.cc
diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc
index 7eea9a6557123ef57a7472db4afbd29e474b05fc..e4be29ad8ed8e3256b7336e90d1bdd2ea0ba72e2 100644
--- a/google_apis/gcm/tools/mcs_probe.cc
+++ b/google_apis/gcm/tools/mcs_probe.cc
@@ -13,6 +13,7 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
+#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -278,6 +279,8 @@ MCSProbe::MCSProbe(
}
MCSProbe::~MCSProbe() {
+ if (logger_)
+ logger_->StopObserving(nullptr);
file_thread_.Stop();
}
@@ -345,20 +348,19 @@ void MCSProbe::UpdateCallback(bool success) {
}
void MCSProbe::InitializeNetworkState() {
- FILE* log_file = NULL;
+ base::ScopedFILE log_file;
if (command_line_.HasSwitch(kLogFileSwitch)) {
base::FilePath log_path = command_line_.GetSwitchValuePath(kLogFileSwitch);
#if defined(OS_WIN)
- log_file = _wfopen(log_path.value().c_str(), L"w");
+ log_file.reset(_wfopen(log_path.value().c_str(), L"w"));
#elif defined(OS_POSIX)
- log_file = fopen(log_path.value().c_str(), "w");
+ log_file.reset(fopen(log_path.value().c_str(), "w"));
#endif
}
- if (log_file != NULL) {
- scoped_ptr<base::Value> net_constants(net::NetLogLogger::GetConstants());
- logger_.reset(new net::NetLogLogger(log_file, *net_constants));
+ if (log_file.get()) {
+ logger_.reset(new net::NetLogLogger());
logger_->set_log_level(net::NetLog::LOG_ALL_BUT_BYTES);
- logger_->StartObserving(&net_log_);
+ logger_->StartObserving(&net_log_, log_file.Pass(), nullptr, nullptr);
}
host_resolver_ = net::HostResolver::CreateDefaultResolver(&net_log_);
« no previous file with comments | « content/shell/browser/shell_net_log.cc ('k') | net/base/net_log_logger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698