summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authormmenke <mmenke@chromium.org>2015-03-16 10:38:49 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-16 17:39:13 +0000
commit853ed15d6d080b116bbc496de3302276f3668f1f (patch)
treead4c6072b616df6062359da554481de913c08a6e /google_apis
parent109d025eefa2952f8294c93f407e3f283265b7c0 (diff)
downloadchromium_src-853ed15d6d080b116bbc496de3302276f3668f1f.zip
chromium_src-853ed15d6d080b116bbc496de3302276f3668f1f.tar.gz
chromium_src-853ed15d6d080b116bbc496de3302276f3668f1f.tar.bz2
Add ability for NetLogLogger to gather data from more than just NetLog
This includes data from other net-internals tabs and from pending URLRequests. This also changes the semantices of NetLogLogger so that it takes the input file in StartObserving and closes it in StopObserving, to make thread restrictions when using the new capability a little simpler. This CL also fixes a number of cases where StopObserving either wasn't being called, or was being called incorrectly by consumers. BUG=426918 Review URL: https://codereview.chromium.org/976483002 Cr-Commit-Position: refs/heads/master@{#320745}
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/gcm/tools/mcs_probe.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc
index 7eea9a6..e4be29ad 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_);