summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 19:28:09 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 19:28:09 +0000
commitec11be60eaf6e832219328ea18656c558dec3040 (patch)
tree1d8a6710f277a55b4743fbc54c8554abf3164669 /net
parent9bb75ccc56cdb94a9778dcef26be3de97808f3ce (diff)
downloadchromium_src-ec11be60eaf6e832219328ea18656c558dec3040.zip
chromium_src-ec11be60eaf6e832219328ea18656c558dec3040.tar.gz
chromium_src-ec11be60eaf6e832219328ea18656c558dec3040.tar.bz2
More cleanup to address TODOs in net_log.h.
* Removes 9 methods: AddEventWithParameters, BeginEventWithParameters, EndEventWithParameters, BeginEventWithString, BeginEventWithInteger, AddEventWithString, AddEventWithInteger, EndEventWithParameters, EndEventWithInteger. This was becoming ridiculous, instead made the EventParameters* a required parameter. * Moves CapturingBoundNetLog / CapturingNetLog to its own file. BUG=37421 Review URL: http://codereview.chromium.org/1746012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/capturing_net_log.cc43
-rw-r--r--net/base/capturing_net_log.h109
-rw-r--r--net/base/host_resolver_impl.cc20
-rw-r--r--net/base/host_resolver_impl.h1
-rw-r--r--net/base/net_log.cc109
-rw-r--r--net/base/net_log.h135
-rw-r--r--net/base/net_log_unittest.h2
-rw-r--r--net/base/net_log_util.h2
-rw-r--r--net/http/http_cache_transaction.cc24
-rw-r--r--net/http/http_network_transaction.cc33
-rw-r--r--net/http/http_stream_parser.cc4
-rw-r--r--net/net.gyp2
-rw-r--r--net/proxy/init_proxy_resolver.cc29
-rw-r--r--net/proxy/proxy_resolver_v8.cc16
-rw-r--r--net/proxy/proxy_service.cc29
-rw-r--r--net/proxy/single_threaded_proxy_resolver.cc6
-rw-r--r--net/proxy/single_threaded_proxy_resolver_unittest.cc2
-rw-r--r--net/socket/client_socket_pool_base.cc72
-rw-r--r--net/socket/socks5_client_socket.cc50
-rw-r--r--net/socket/socks_client_socket.cc6
-rw-r--r--net/socket/ssl_client_socket_mac.cc10
-rw-r--r--net/socket/ssl_client_socket_nss.cc10
-rw-r--r--net/socket/ssl_client_socket_win.cc8
-rw-r--r--net/socket/tcp_client_socket_libevent.cc26
-rw-r--r--net/socket/tcp_client_socket_pool.cc11
-rw-r--r--net/socket/tcp_client_socket_win.cc28
-rw-r--r--net/socket_stream/socket_stream.cc21
-rw-r--r--net/spdy/spdy_network_transaction.cc17
-rw-r--r--net/spdy/spdy_session.cc2
-rw-r--r--net/spdy/spdy_stream.cc16
-rw-r--r--net/url_request/url_request.cc23
31 files changed, 429 insertions, 437 deletions
diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc
new file mode 100644
index 0000000..08f3b8d
--- /dev/null
+++ b/net/base/capturing_net_log.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/base/capturing_net_log.h"
+
+namespace net {
+
+CapturingNetLog::CapturingNetLog(size_t max_num_entries)
+ : next_id_(0), max_num_entries_(max_num_entries) {
+}
+
+void CapturingNetLog::AddEntry(EventType type,
+ const base::TimeTicks& time,
+ const Source& source,
+ EventPhase phase,
+ EventParameters* extra_parameters) {
+ Entry entry(type, time, source, phase, extra_parameters);
+ if (entries_.size() + 1 < max_num_entries_)
+ entries_.push_back(entry);
+}
+
+uint32 CapturingNetLog::NextID() {
+ return next_id_++;
+}
+
+void CapturingNetLog::Clear() {
+ entries_.clear();
+}
+
+void CapturingBoundNetLog::Clear() {
+ capturing_net_log_->Clear();
+}
+
+void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const {
+ for (size_t i = 0; i < entries().size(); ++i) {
+ const CapturingNetLog::Entry& entry = entries()[i];
+ net_log.AddEntryWithTime(entry.type, entry.time, entry.phase,
+ entry.extra_parameters);
+ }
+}
+
+} // namespace net
diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h
new file mode 100644
index 0000000..2f95f7c
--- /dev/null
+++ b/net/base/capturing_net_log.h
@@ -0,0 +1,109 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_BASE_CAPTURING_NET_LOG_H_
+#define NET_BASE_CAPTURING_NET_LOG_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "net/base/net_log.h"
+
+namespace net {
+
+// CapturingNetLog is an implementation of NetLog that saves messages to a
+// bounded buffer.
+class CapturingNetLog : public NetLog {
+ public:
+ struct Entry {
+ Entry(EventType type,
+ const base::TimeTicks& time,
+ Source source,
+ EventPhase phase,
+ EventParameters* extra_parameters)
+ : type(type), time(time), source(source), phase(phase),
+ extra_parameters(extra_parameters) {
+ }
+
+ EventType type;
+ base::TimeTicks time;
+ Source source;
+ EventPhase phase;
+ scoped_refptr<EventParameters> extra_parameters;
+ };
+
+ // Ordered set of entries that were logged.
+ typedef std::vector<Entry> EntryList;
+
+ enum { kUnbounded = -1 };
+
+ // Creates a CapturingNetLog that logs a maximum of |max_num_entries|
+ // messages.
+ explicit CapturingNetLog(size_t max_num_entries);
+
+ // NetLog implementation:
+ virtual void AddEntry(EventType type,
+ const base::TimeTicks& time,
+ const Source& source,
+ EventPhase phase,
+ EventParameters* extra_parameters);
+ virtual uint32 NextID();
+ virtual bool HasListener() const { return true; }
+
+ // Returns the list of all entries in the log.
+ const EntryList& entries() const { return entries_; }
+
+ void Clear();
+
+ private:
+ uint32 next_id_;
+ size_t max_num_entries_;
+ EntryList entries_;
+
+ DISALLOW_COPY_AND_ASSIGN(CapturingNetLog);
+};
+
+// Helper class that exposes a similar API as BoundNetLog, but uses a
+// CapturingNetLog rather than the more generic NetLog.
+//
+// CapturingBoundNetLog can easily be converted to a BoundNetLog using the
+// bound() method.
+class CapturingBoundNetLog {
+ public:
+ CapturingBoundNetLog(const NetLog::Source& source, CapturingNetLog* net_log)
+ : source_(source), capturing_net_log_(net_log) {
+ }
+
+ explicit CapturingBoundNetLog(size_t max_num_entries)
+ : capturing_net_log_(new CapturingNetLog(max_num_entries)) {}
+
+ // The returned BoundNetLog is only valid while |this| is alive.
+ BoundNetLog bound() const {
+ return BoundNetLog(source_, capturing_net_log_.get());
+ }
+
+ // Returns the list of all entries in the log.
+ const CapturingNetLog::EntryList& entries() const {
+ return capturing_net_log_->entries();
+ }
+
+ void Clear();
+
+ // Sends all of captured messages to |net_log|, using the same source ID
+ // as |net_log|.
+ void AppendTo(const BoundNetLog& net_log) const;
+
+ private:
+ NetLog::Source source_;
+ scoped_ptr<CapturingNetLog> capturing_net_log_;
+
+ DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog);
+};
+
+} // namespace net
+
+#endif // NET_BASE_CAPTURING_NET_LOG_H_
+
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index f1b57f6..1c97f22 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -1003,7 +1003,7 @@ void HostResolverImpl::OnJobComplete(Job* job,
void HostResolverImpl::OnStartRequest(const BoundNetLog& net_log,
int request_id,
const RequestInfo& info) {
- net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL);
+ net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL, NULL);
if (requests_trace_) {
requests_trace_->Add(StringPrintf(
@@ -1021,14 +1021,14 @@ void HostResolverImpl::OnStartRequest(const BoundNetLog& net_log,
// Notify the observers of the start.
if (!observers_.empty()) {
- net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONSTART);
+ net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONSTART, NULL);
for (ObserversList::iterator it = observers_.begin();
it != observers_.end(); ++it) {
(*it)->OnStartResolution(request_id, info);
}
- net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONSTART);
+ net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONSTART, NULL);
}
}
@@ -1043,7 +1043,7 @@ void HostResolverImpl::OnFinishRequest(const BoundNetLog& net_log,
// Notify the observers of the completion.
if (!observers_.empty()) {
- net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONFINISH);
+ net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONFINISH, NULL);
bool was_resolved = error == OK;
for (ObserversList::iterator it = observers_.begin();
@@ -1051,33 +1051,33 @@ void HostResolverImpl::OnFinishRequest(const BoundNetLog& net_log,
(*it)->OnFinishResolutionWithStatus(request_id, was_resolved, info);
}
- net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONFINISH);
+ net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONFINISH, NULL);
}
- net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL);
+ net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL, NULL);
}
void HostResolverImpl::OnCancelRequest(const BoundNetLog& net_log,
int request_id,
const RequestInfo& info) {
- net_log.AddEvent(NetLog::TYPE_CANCELLED);
+ net_log.AddEvent(NetLog::TYPE_CANCELLED, NULL);
if (requests_trace_)
requests_trace_->Add(StringPrintf("Cancelled request r%d", request_id));
// Notify the observers of the cancellation.
if (!observers_.empty()) {
- net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONCANCEL);
+ net_log.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONCANCEL, NULL);
for (ObserversList::iterator it = observers_.begin();
it != observers_.end(); ++it) {
(*it)->OnCancelResolution(request_id, info);
}
- net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONCANCEL);
+ net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONCANCEL, NULL);
}
- net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL);
+ net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL, NULL);
}
void HostResolverImpl::OnIPAddressChanged() {
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index 1a182b3..80ca2ca 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/scoped_ptr.h"
+#include "net/base/capturing_net_log.h"
#include "net/base/host_cache.h"
#include "net/base/host_resolver.h"
#include "net/base/host_resolver_proc.h"
diff --git a/net/base/net_log.cc b/net/base/net_log.cc
index c46214f..02b6bbd 100644
--- a/net/base/net_log.cc
+++ b/net/base/net_log.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "net/base/net_log.h"
-#include "base/logging.h"
#include "base/string_util.h"
#include "base/values.h"
@@ -28,12 +27,12 @@ std::vector<NetLog::EventType> NetLog::GetAllEventTypes() {
return types;
}
-void BoundNetLog::AddEntry(NetLog::EventType type,
- NetLog::EventPhase phase,
- NetLog::EventParameters* extra_parameters) const {
+void BoundNetLog::AddEntry(
+ NetLog::EventType type,
+ NetLog::EventPhase phase,
+ const scoped_refptr<NetLog::EventParameters>& params) const {
if (net_log_) {
- net_log_->AddEntry(type, base::TimeTicks::Now(), source_, phase,
- extra_parameters);
+ net_log_->AddEntry(type, base::TimeTicks::Now(), source_, phase, params);
}
}
@@ -41,9 +40,9 @@ void BoundNetLog::AddEntryWithTime(
NetLog::EventType type,
const base::TimeTicks& time,
NetLog::EventPhase phase,
- NetLog::EventParameters* extra_parameters) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
if (net_log_) {
- net_log_->AddEntry(type, time, source_, phase, extra_parameters);
+ net_log_->AddEntry(type, time, source_, phase, params);
}
}
@@ -53,76 +52,24 @@ bool BoundNetLog::HasListener() const {
return false;
}
-void BoundNetLog::AddEvent(NetLog::EventType event_type) const {
- AddEventWithParameters(event_type, NULL);
-}
-
-void BoundNetLog::AddEventWithParameters(
+void BoundNetLog::AddEvent(
NetLog::EventType event_type,
- NetLog::EventParameters* params) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
AddEntry(event_type, NetLog::PHASE_NONE, params);
}
-void BoundNetLog::AddEventWithInteger(NetLog::EventType event_type,
- const char* name,
- int value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(name, value);
- AddEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::AddEventWithString(NetLog::EventType event_type,
- const char* name,
- const std::string& value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogStringParameter(name, value);
- AddEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::BeginEvent(NetLog::EventType event_type) const {
- BeginEventWithParameters(event_type, NULL);
-}
-
-void BoundNetLog::BeginEventWithParameters(
+void BoundNetLog::BeginEvent(
NetLog::EventType event_type,
- NetLog::EventParameters* params) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
AddEntry(event_type, NetLog::PHASE_BEGIN, params);
}
-void BoundNetLog::BeginEventWithString(NetLog::EventType event_type,
- const char* name,
- const std::string& value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogStringParameter(name, value);
- BeginEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::BeginEventWithInteger(NetLog::EventType event_type,
- const char* name,
- int value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(name, value);
- BeginEventWithParameters(event_type, params);
-}
-
-void BoundNetLog::EndEvent(NetLog::EventType event_type) const {
- EndEventWithParameters(event_type, NULL);
-}
-
-void BoundNetLog::EndEventWithParameters(
+void BoundNetLog::EndEvent(
NetLog::EventType event_type,
- NetLog::EventParameters* params) const {
+ const scoped_refptr<NetLog::EventParameters>& params) const {
AddEntry(event_type, NetLog::PHASE_END, params);
}
-void BoundNetLog::EndEventWithInteger(NetLog::EventType event_type,
- const char* name,
- int value) const {
- scoped_refptr<NetLog::EventParameters> params =
- new NetLogIntegerParameter(name, value);
- EndEventWithParameters(event_type, params);
-}
-
// static
BoundNetLog BoundNetLog::Make(NetLog* net_log,
NetLog::SourceType source_type) {
@@ -150,34 +97,4 @@ Value* NetLogStringParameter::ToValue() const {
return dict;
}
-void CapturingNetLog::AddEntry(EventType type,
- const base::TimeTicks& time,
- const Source& source,
- EventPhase phase,
- EventParameters* extra_parameters) {
- Entry entry(type, time, source, phase, extra_parameters);
- if (entries_.size() + 1 < max_num_entries_)
- entries_.push_back(entry);
-}
-
-uint32 CapturingNetLog::NextID() {
- return next_id_++;
-}
-
-void CapturingNetLog::Clear() {
- entries_.clear();
-}
-
-void CapturingBoundNetLog::Clear() {
- capturing_net_log_->Clear();
-}
-
-void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const {
- for (size_t i = 0; i < entries().size(); ++i) {
- const CapturingNetLog::Entry& entry = entries()[i];
- net_log.AddEntryWithTime(entry.type, entry.time, entry.phase,
- entry.extra_parameters);
- }
-}
-
} // namespace net
diff --git a/net/base/net_log.h b/net/base/net_log.h
index c847b0e..6bef13c 100644
--- a/net/base/net_log.h
+++ b/net/base/net_log.h
@@ -12,7 +12,6 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
-#include "net/base/net_log.h"
class Value;
@@ -34,8 +33,6 @@ namespace net {
// TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods.
// TODO(eroman): Remove NetLogUtil. Pretty printing should only be done from
// javascript, and should be very context-aware.
-// TODO(eroman): Move Capturing*NetLog to its own file. (And eventually remove
-// all the consumers of it).
// TODO(eroman): Make the DNS jobs emit directly into the NetLog.
// TODO(eroman): Start a new Source each time URLRequest redirects
// (simpler to reason about each as a separate entity).
@@ -149,37 +146,29 @@ class BoundNetLog {
: source_(source), net_log_(net_log) {
}
+ // Convenience methods that call through to the NetLog, passing in the
+ // currently bound source.
void AddEntry(NetLog::EventType type,
NetLog::EventPhase phase,
- NetLog::EventParameters* extra_parameters) const;
+ const scoped_refptr<NetLog::EventParameters>& params) const;
- void AddEntryWithTime(NetLog::EventType type,
- const base::TimeTicks& time,
- NetLog::EventPhase phase,
- NetLog::EventParameters* extra_parameters) const;
+ void AddEntryWithTime(
+ NetLog::EventType type,
+ const base::TimeTicks& time,
+ NetLog::EventPhase phase,
+ const scoped_refptr<NetLog::EventParameters>& params) const;
// Convenience methods that call through to the NetLog, passing in the
- // currently bound source.
- void AddEvent(NetLog::EventType event_type) const;
- void AddEventWithParameters(NetLog::EventType event_type,
- NetLog::EventParameters* params) const;
+ // currently bound source, current time, and a fixed "capture phase"
+ // (begin, end, or none).
+ void AddEvent(NetLog::EventType event_type,
+ const scoped_refptr<NetLog::EventParameters>& params) const;
+ void BeginEvent(NetLog::EventType event_type,
+ const scoped_refptr<NetLog::EventParameters>& params) const;
+ void EndEvent(NetLog::EventType event_type,
+ const scoped_refptr<NetLog::EventParameters>& params) const;
+
bool HasListener() const;
- void BeginEvent(NetLog::EventType event_type) const;
- void BeginEventWithParameters(NetLog::EventType event_type,
- NetLog::EventParameters* params) const;
- void BeginEventWithString(NetLog::EventType event_type,
- const char* name, const std::string& value) const;
- void BeginEventWithInteger(NetLog::EventType event_type,
- const char* name, int value) const;
- void AddEventWithInteger(NetLog::EventType event_type,
- const char* name, int value) const;
- void AddEventWithString(NetLog::EventType event_type,
- const char* name, const std::string& value) const;
- void EndEvent(NetLog::EventType event_type) const;
- void EndEventWithParameters(NetLog::EventType event_type,
- NetLog::EventParameters* params) const;
- void EndEventWithInteger(NetLog::EventType event_type,
- const char* name, int value) const;
// Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care
// of creating a unique source ID, and handles the case of NULL net_log.
@@ -230,96 +219,6 @@ class NetLogIntegerParameter : public NetLog::EventParameters {
const int value_;
};
-// CapturingNetLog is an implementation of NetLog that saves messages to a
-// bounded buffer.
-class CapturingNetLog : public NetLog {
- public:
- struct Entry {
- Entry(EventType type,
- const base::TimeTicks& time,
- Source source,
- EventPhase phase,
- EventParameters* extra_parameters)
- : type(type), time(time), source(source), phase(phase),
- extra_parameters(extra_parameters) {
- }
-
- EventType type;
- base::TimeTicks time;
- Source source;
- EventPhase phase;
- scoped_refptr<EventParameters> extra_parameters;
- };
-
- // Ordered set of entries that were logged.
- typedef std::vector<Entry> EntryList;
-
- enum { kUnbounded = -1 };
-
- // Creates a CapturingNetLog that logs a maximum of |max_num_entries|
- // messages.
- explicit CapturingNetLog(size_t max_num_entries)
- : next_id_(0), max_num_entries_(max_num_entries) {}
-
- // NetLog implementation:
- virtual void AddEntry(EventType type,
- const base::TimeTicks& time,
- const Source& source,
- EventPhase phase,
- EventParameters* extra_parameters);
- virtual uint32 NextID();
- virtual bool HasListener() const { return true; }
-
- // Returns the list of all entries in the log.
- const EntryList& entries() const { return entries_; }
-
- void Clear();
-
- private:
- uint32 next_id_;
- size_t max_num_entries_;
- EntryList entries_;
-
- DISALLOW_COPY_AND_ASSIGN(CapturingNetLog);
-};
-
-// Helper class that exposes a similar API as BoundNetLog, but uses a
-// CapturingNetLog rather than the more generic NetLog.
-//
-// CapturingBoundNetLog can easily be converted to a BoundNetLog using the
-// bound() method.
-class CapturingBoundNetLog {
- public:
- CapturingBoundNetLog(const NetLog::Source& source, CapturingNetLog* net_log)
- : source_(source), capturing_net_log_(net_log) {
- }
-
- explicit CapturingBoundNetLog(size_t max_num_entries)
- : capturing_net_log_(new CapturingNetLog(max_num_entries)) {}
-
- // The returned BoundNetLog is only valid while |this| is alive.
- BoundNetLog bound() const {
- return BoundNetLog(source_, capturing_net_log_.get());
- }
-
- // Returns the list of all entries in the log.
- const CapturingNetLog::EntryList& entries() const {
- return capturing_net_log_->entries();
- }
-
- void Clear();
-
- // Sends all of captured messages to |net_log|, using the same source ID
- // as |net_log|.
- void AppendTo(const BoundNetLog& net_log) const;
-
- private:
- NetLog::Source source_;
- scoped_ptr<CapturingNetLog> capturing_net_log_;
-
- DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog);
-};
-
} // namespace net
#endif // NET_BASE_NET_LOG_H_
diff --git a/net/base/net_log_unittest.h b/net/base/net_log_unittest.h
index b7a6147..376ceac 100644
--- a/net/base/net_log_unittest.h
+++ b/net/base/net_log_unittest.h
@@ -7,7 +7,7 @@
#include <cstddef>
#include <vector>
-#include "net/base/net_log.h"
+#include "net/base/capturing_net_log.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
diff --git a/net/base/net_log_util.h b/net/base/net_log_util.h
index 7ca5e65..0d603e8 100644
--- a/net/base/net_log_util.h
+++ b/net/base/net_log_util.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/basictypes.h"
-#include "net/base/net_log.h"
+#include "net/base/capturing_net_log.h"
namespace net {
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index c0eefea..a25608a 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -678,7 +678,7 @@ int HttpCache::Transaction::DoOpenEntry() {
DCHECK(!new_entry_);
next_state_ = STATE_OPEN_ENTRY_COMPLETE;
cache_pending_ = true;
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY, NULL);
return cache_->OpenEntry(cache_key_, &new_entry_, this);
}
@@ -686,7 +686,7 @@ int HttpCache::Transaction::DoOpenEntryComplete(int result) {
// It is important that we go to STATE_ADD_TO_ENTRY whenever the result is
// OK, otherwise the cache will end up with an active entry without any
// transaction attached.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY, NULL);
cache_pending_ = false;
if (result == OK) {
next_state_ = STATE_ADD_TO_ENTRY;
@@ -721,7 +721,7 @@ int HttpCache::Transaction::DoCreateEntry() {
DCHECK(!new_entry_);
next_state_ = STATE_CREATE_ENTRY_COMPLETE;
cache_pending_ = true;
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY, NULL);
return cache_->CreateEntry(cache_key_, &new_entry_, this);
}
@@ -729,7 +729,7 @@ int HttpCache::Transaction::DoCreateEntryComplete(int result) {
// It is important that we go to STATE_ADD_TO_ENTRY whenever the result is
// OK, otherwise the cache will end up with an active entry without any
// transaction attached.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY, NULL);
cache_pending_ = false;
next_state_ = STATE_ADD_TO_ENTRY;
@@ -755,12 +755,12 @@ int HttpCache::Transaction::DoCreateEntryComplete(int result) {
int HttpCache::Transaction::DoDoomEntry() {
next_state_ = STATE_DOOM_ENTRY_COMPLETE;
cache_pending_ = true;
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY, NULL);
return cache_->DoomEntry(cache_key_, this);
}
int HttpCache::Transaction::DoDoomEntryComplete(int result) {
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY, NULL);
next_state_ = STATE_CREATE_ENTRY;
cache_pending_ = false;
if (result == ERR_CACHE_RACE)
@@ -773,12 +773,12 @@ int HttpCache::Transaction::DoAddToEntry() {
DCHECK(new_entry_);
cache_pending_ = true;
next_state_ = STATE_ADD_TO_ENTRY_COMPLETE;
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WAITING);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
return cache_->AddTransactionToEntry(new_entry_, this);
}
int HttpCache::Transaction::DoAddToEntryComplete(int result) {
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WAITING);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
DCHECK(new_entry_);
cache_pending_ = false;
@@ -958,7 +958,7 @@ int HttpCache::Transaction::DoCacheReadResponse() {
io_buf_len_ = entry_->disk_entry->GetDataSize(kResponseInfoIndex);
read_buf_ = new IOBuffer(io_buf_len_);
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL);
cache_callback_->AddRef(); // Balanced in DoCacheReadResponseComplete.
return entry_->disk_entry->ReadData(kResponseInfoIndex, 0, read_buf_,
io_buf_len_, cache_callback_);
@@ -966,7 +966,7 @@ int HttpCache::Transaction::DoCacheReadResponse() {
int HttpCache::Transaction::DoCacheReadResponseComplete(int result) {
cache_callback_->Release(); // Balance the AddRef from DoCacheReadResponse.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL);
if (result != io_buf_len_ ||
!HttpCache::ParseResponseInfo(read_buf_->data(), io_buf_len_,
&response_, &truncated_)) {
@@ -1036,7 +1036,7 @@ int HttpCache::Transaction::DoCacheReadMetadata() {
response_.metadata =
new IOBufferWithSize(entry_->disk_entry->GetDataSize(kMetadataIndex));
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL);
cache_callback_->AddRef(); // Balanced in DoCacheReadMetadataComplete.
return entry_->disk_entry->ReadData(kMetadataIndex, 0, response_.metadata,
response_.metadata->size(),
@@ -1045,7 +1045,7 @@ int HttpCache::Transaction::DoCacheReadMetadata() {
int HttpCache::Transaction::DoCacheReadMetadataComplete(int result) {
cache_callback_->Release(); // Balance the AddRef from DoCacheReadMetadata.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL);
if (result != response_.metadata->size()) {
DLOG(ERROR) << "ReadData failed: " << result;
return ERR_CACHE_READ_FAILURE;
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index ccb600e..4a789b6 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -554,52 +554,53 @@ int HttpNetworkTransaction::DoLoop(int result) {
case STATE_SEND_REQUEST:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.send_request", request_, request_->url.spec());
- net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, NULL);
rv = DoSendRequest();
break;
case STATE_SEND_REQUEST_COMPLETE:
rv = DoSendRequestComplete(rv);
TRACE_EVENT_END("http.send_request", request_, request_->url.spec());
- net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, NULL);
break;
case STATE_READ_HEADERS:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec());
- net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, NULL);
rv = DoReadHeaders();
break;
case STATE_READ_HEADERS_COMPLETE:
rv = DoReadHeadersComplete(rv);
TRACE_EVENT_END("http.read_headers", request_, request_->url.spec());
- net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, NULL);
break;
case STATE_RESOLVE_CANONICAL_NAME:
DCHECK_EQ(OK, rv);
net_log_.BeginEvent(
- NetLog::TYPE_HTTP_TRANSACTION_RESOLVE_CANONICAL_NAME);
+ NetLog::TYPE_HTTP_TRANSACTION_RESOLVE_CANONICAL_NAME, NULL);
rv = DoResolveCanonicalName();
break;
case STATE_RESOLVE_CANONICAL_NAME_COMPLETE:
rv = DoResolveCanonicalNameComplete(rv);
- net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_RESOLVE_CANONICAL_NAME);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_RESOLVE_CANONICAL_NAME,
+ NULL);
break;
case STATE_READ_BODY:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_body", request_, request_->url.spec());
- net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, NULL);
rv = DoReadBody();
break;
case STATE_READ_BODY_COMPLETE:
rv = DoReadBodyComplete(rv);
TRACE_EVENT_END("http.read_body", request_, request_->url.spec());
- net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, NULL);
break;
case STATE_DRAIN_BODY_FOR_AUTH_RESTART:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.drain_body_for_auth_restart",
request_, request_->url.spec());
net_log_.BeginEvent(
- NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART);
+ NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART, NULL);
rv = DoDrainBodyForAuthRestart();
break;
case STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE:
@@ -607,40 +608,40 @@ int HttpNetworkTransaction::DoLoop(int result) {
TRACE_EVENT_END("http.drain_body_for_auth_restart",
request_, request_->url.spec());
net_log_.EndEvent(
- NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART);
+ NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART, NULL);
break;
case STATE_SPDY_SEND_REQUEST:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.send_request", request_, request_->url.spec());
- net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST, NULL);
rv = DoSpdySendRequest();
break;
case STATE_SPDY_SEND_REQUEST_COMPLETE:
rv = DoSpdySendRequestComplete(rv);
TRACE_EVENT_END("http.send_request", request_, request_->url.spec());
- net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST, NULL);
break;
case STATE_SPDY_READ_HEADERS:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec());
- net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS, NULL);
rv = DoSpdyReadHeaders();
break;
case STATE_SPDY_READ_HEADERS_COMPLETE:
rv = DoSpdyReadHeadersComplete(rv);
TRACE_EVENT_END("http.read_headers", request_, request_->url.spec());
- net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS, NULL);
break;
case STATE_SPDY_READ_BODY:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_body", request_, request_->url.spec());
- net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY, NULL);
rv = DoSpdyReadBody();
break;
case STATE_SPDY_READ_BODY_COMPLETE:
rv = DoSpdyReadBodyComplete(rv);
TRACE_EVENT_END("http.read_body", request_, request_->url.spec());
- net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY, NULL);
break;
default:
NOTREACHED() << "bad state";
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 1137f57..e0b18a9 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -149,12 +149,12 @@ int HttpStreamParser::DoLoop(int result) {
break;
case STATE_READ_HEADERS:
TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec());
- net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, NULL);
result = DoReadHeaders();
break;
case STATE_READ_HEADERS_COMPLETE:
result = DoReadHeadersComplete(result);
- net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, NULL);
TRACE_EVENT_END("http.read_headers", request_, request_->url.spec());
break;
case STATE_BODY_PENDING:
diff --git a/net/net.gyp b/net/net.gyp
index a7f3095..d659731 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -26,6 +26,8 @@
'base/address_list.h',
'base/auth.h',
'base/cache_type.h',
+ 'base/capturing_net_log.cc',
+ 'base/capturing_net_log.h',
'base/cert_database.h',
'base/cert_database_mac.cc',
'base/cert_database_nss.cc',
diff --git a/net/proxy/init_proxy_resolver.cc b/net/proxy/init_proxy_resolver.cc
index e4bd51b..2c27dcb 100644
--- a/net/proxy/init_proxy_resolver.cc
+++ b/net/proxy/init_proxy_resolver.cc
@@ -42,7 +42,7 @@ int InitProxyResolver::Init(const ProxyConfig& config,
net_log_ = net_log;
- net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER);
+ net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER, NULL);
pac_urls_ = BuildPacUrlsFallbackList(config);
DCHECK(!pac_urls_.empty());
@@ -126,11 +126,12 @@ int InitProxyResolver::DoFetchPacScript() {
const GURL& pac_url = current_pac_url();
- net_log_.BeginEventWithString(
- NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, "url", pac_url.spec());
+ net_log_.BeginEvent(
+ NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
+ new NetLogStringParameter("url", pac_url.spec()));
if (!proxy_script_fetcher_) {
- net_log_.AddEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_HAS_NO_FETCHER);
+ net_log_.AddEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_HAS_NO_FETCHER, NULL);
return ERR_UNEXPECTED;
}
@@ -141,11 +142,11 @@ int InitProxyResolver::DoFetchPacScriptComplete(int result) {
DCHECK(resolver_->expects_pac_bytes());
if (result == OK) {
- net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT);
+ net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, NULL);
} else {
- net_log_.EndEventWithInteger(
+ net_log_.EndEvent(
NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- "net_error", result);
+ new NetLogIntegerParameter("net_error", result));
return TryToFallbackPacUrl(result);
}
@@ -154,7 +155,7 @@ int InitProxyResolver::DoFetchPacScriptComplete(int result) {
}
int InitProxyResolver::DoSetPacScript() {
- net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT);
+ net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, NULL);
const GURL& pac_url = current_pac_url();
@@ -167,13 +168,13 @@ int InitProxyResolver::DoSetPacScript() {
int InitProxyResolver::DoSetPacScriptComplete(int result) {
if (result != OK) {
- net_log_.EndEventWithInteger(
+ net_log_.EndEvent(
NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
- "net_error", result);
+ new NetLogIntegerParameter("net_error", result));
return TryToFallbackPacUrl(result);
}
- net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT);
+ net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, NULL);
return result;
}
@@ -189,7 +190,7 @@ int InitProxyResolver::TryToFallbackPacUrl(int error) {
++current_pac_url_index_;
net_log_.AddEvent(
- NetLog::TYPE_INIT_PROXY_RESOLVER_FALLING_BACK_TO_NEXT_PAC_URL);
+ NetLog::TYPE_INIT_PROXY_RESOLVER_FALLING_BACK_TO_NEXT_PAC_URL, NULL);
next_state_ = GetStartState();
@@ -207,13 +208,13 @@ const GURL& InitProxyResolver::current_pac_url() const {
}
void InitProxyResolver::DidCompleteInit() {
- net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER);
+ net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER, NULL);
}
void InitProxyResolver::Cancel() {
DCHECK_NE(STATE_NONE, next_state_);
- net_log_.AddEvent(NetLog::TYPE_CANCELLED);
+ net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL);
switch (next_state_) {
case STATE_FETCH_PAC_SCRIPT_COMPLETE:
diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc
index 8734dff..17916e6 100644
--- a/net/proxy/proxy_resolver_v8.cc
+++ b/net/proxy/proxy_resolver_v8.cc
@@ -294,14 +294,14 @@ class ProxyResolverV8::Context {
static_cast<Context*>(v8::External::Cast(*args.Data())->Value());
context->current_request_net_log_.BeginEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS);
+ NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS, NULL);
// We shouldn't be called with any arguments, but will not complain if
// we are.
std::string result = context->js_bindings_->MyIpAddress();
context->current_request_net_log_.EndEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS);
+ NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS, NULL);
if (result.empty())
result = "127.0.0.1";
@@ -315,14 +315,14 @@ class ProxyResolverV8::Context {
static_cast<Context*>(v8::External::Cast(*args.Data())->Value());
context->current_request_net_log_.BeginEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX);
+ NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX, NULL);
// We shouldn't be called with any arguments, but will not complain if
// we are.
std::string result = context->js_bindings_->MyIpAddressEx();
context->current_request_net_log_.EndEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX);
+ NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX, NULL);
return StdStringToV8String(result);
}
@@ -342,12 +342,12 @@ class ProxyResolverV8::Context {
}
context->current_request_net_log_.BeginEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE);
+ NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE, NULL);
std::string result = context->js_bindings_->DnsResolve(host);
context->current_request_net_log_.EndEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE);
+ NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE, NULL);
// DnsResolve() returns empty string on failure.
return result.empty() ? v8::Null() : StdStringToV8String(result);
@@ -368,12 +368,12 @@ class ProxyResolverV8::Context {
}
context->current_request_net_log_.BeginEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX);
+ NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX, NULL);
std::string result = context->js_bindings_->DnsResolveEx(host);
context->current_request_net_log_.EndEvent(
- NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX);
+ NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX, NULL);
return StdStringToV8String(result);
}
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 588b240..2c68cf4 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -130,7 +130,7 @@ class ProxyService::PacRequest
}
void Cancel() {
- net_log_.AddEvent(NetLog::TYPE_CANCELLED);
+ net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL);
if (is_started())
CancelResolveJob();
@@ -140,7 +140,7 @@ class ProxyService::PacRequest
user_callback_ = NULL;
results_ = NULL;
- net_log_.EndEvent(NetLog::TYPE_PROXY_SERVICE);
+ net_log_.EndEvent(NetLog::TYPE_PROXY_SERVICE, NULL);
}
// Returns true if Cancel() has been called.
@@ -285,7 +285,7 @@ int ProxyService::ResolveProxy(const GURL& raw_url,
const BoundNetLog& net_log) {
DCHECK(callback);
- net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE);
+ net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE, NULL);
// Strip away any reference fragments and the username/password, as they
// are not relevant to proxy resolution.
@@ -309,7 +309,8 @@ int ProxyService::ResolveProxy(const GURL& raw_url,
if (rv != ERR_IO_PENDING)
return req->QueryDidComplete(rv);
} else {
- req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC);
+ req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC,
+ NULL);
}
DCHECK_EQ(ERR_IO_PENDING, rv);
@@ -365,7 +366,7 @@ void ProxyService::SuspendAllPendingRequests() {
req->CancelResolveJob();
req->net_log()->BeginEvent(
- NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC);
+ NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC, NULL);
}
}
}
@@ -383,7 +384,8 @@ void ProxyService::ResumeAllPendingRequests() {
++it) {
PacRequest* req = it->get();
if (!req->is_started() && !req->was_cancelled()) {
- req->net_log()->EndEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC);
+ req->net_log()->EndEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC,
+ NULL);
// Note that we re-check for synchronous completion, in case we are
// no longer using a ProxyResolver (can happen if we fell-back to manual).
@@ -469,15 +471,15 @@ int ProxyService::DidFinishResolvingProxy(ProxyInfo* result,
if (result_code == OK) {
// When full logging is enabled, dump the proxy list.
if (net_log.HasListener()) {
- net_log.AddEventWithString(
+ net_log.AddEvent(
NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST,
- "pac_string", result->ToPacString());
+ new NetLogStringParameter("pac_string", result->ToPacString()));
}
result->DeprioritizeBadProxies(proxy_retry_info_);
} else {
- net_log.AddEventWithInteger(
+ net_log.AddEvent(
NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST,
- "net_error", result_code);
+ new NetLogIntegerParameter("net_error", result_code));
// Fall-back to direct when the proxy resolver fails. This corresponds
// with a javascript runtime error in the PAC script.
@@ -490,7 +492,7 @@ int ProxyService::DidFinishResolvingProxy(ProxyInfo* result,
result_code = OK;
}
- net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE);
+ net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE, NULL);
return result_code;
}
@@ -589,9 +591,10 @@ void ProxyService::UpdateConfig(const BoundNetLog& net_log) {
// Fetch the proxy settings.
TimeTicks start_time = TimeTicks::Now();
net_log.BeginEvent(
- NetLog::TYPE_PROXY_SERVICE_POLL_CONFIG_SERVICE_FOR_CHANGES);
+ NetLog::TYPE_PROXY_SERVICE_POLL_CONFIG_SERVICE_FOR_CHANGES, NULL);
int rv = config_service_->GetProxyConfig(&latest);
- net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE_POLL_CONFIG_SERVICE_FOR_CHANGES);
+ net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE_POLL_CONFIG_SERVICE_FOR_CHANGES,
+ NULL);
TimeTicks end_time = TimeTicks::Now();
// Record how long the call to config_service_->GetConfig() above took.
diff --git a/net/proxy/single_threaded_proxy_resolver.cc b/net/proxy/single_threaded_proxy_resolver.cc
index b0fd4a3..1903820 100644
--- a/net/proxy/single_threaded_proxy_resolver.cc
+++ b/net/proxy/single_threaded_proxy_resolver.cc
@@ -6,7 +6,7 @@
#include "base/message_loop.h"
#include "base/thread.h"
-#include "net/base/net_log.h"
+#include "net/base/capturing_net_log.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_info.h"
@@ -247,7 +247,7 @@ int SingleThreadedProxyResolver::GetProxyForURL(const GURL& url,
} else {
// Otherwise the job will get started eventually by ProcessPendingJobs().
job->net_log()->BeginEvent(
- NetLog::TYPE_WAITING_FOR_SINGLE_PROXY_RESOLVER_THREAD);
+ NetLog::TYPE_WAITING_FOR_SINGLE_PROXY_RESOLVER_THREAD, NULL);
}
// Completion will be notified through |callback|, unless the caller cancels
@@ -329,7 +329,7 @@ void SingleThreadedProxyResolver::ProcessPendingJobs() {
return;
job->net_log()->EndEvent(
- NetLog::TYPE_WAITING_FOR_SINGLE_PROXY_RESOLVER_THREAD);
+ NetLog::TYPE_WAITING_FOR_SINGLE_PROXY_RESOLVER_THREAD, NULL);
EnsureThreadStarted();
job->Start();
diff --git a/net/proxy/single_threaded_proxy_resolver_unittest.cc b/net/proxy/single_threaded_proxy_resolver_unittest.cc
index ee52a77..b6029ee 100644
--- a/net/proxy/single_threaded_proxy_resolver_unittest.cc
+++ b/net/proxy/single_threaded_proxy_resolver_unittest.cc
@@ -42,7 +42,7 @@ class MockProxyResolver : public ProxyResolver {
EXPECT_TRUE(request == NULL);
// Write something into |net_log| (doesn't really have any meaning.)
- net_log.BeginEvent(NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE);
+ net_log.BeginEvent(NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE, NULL);
results->UseNamedProxy(query_url.host());
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index d35372d..739bb82 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -48,8 +48,8 @@ ConnectJob::~ConnectJob() {
if (delegate_ && !idle_) {
// If the delegate was not NULLed, then NotifyDelegateOfCompletion has
// not been called yet. If we've started then we are cancelling.
- net_log_.AddEvent(NetLog::TYPE_CANCELLED);
- net_log_.EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB);
+ net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL);
+ net_log_.EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB, NULL);
}
}
@@ -57,15 +57,15 @@ int ConnectJob::Connect() {
if (timeout_duration_ != base::TimeDelta())
timer_.Start(timeout_duration_, this, &ConnectJob::OnTimeout);
- net_log_.BeginEventWithString(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB,
- "group_name", group_name_);
+ net_log_.BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB,
+ new NetLogStringParameter("group_name", group_name_));
idle_ = false;
int rv = ConnectInternal();
if (rv != ERR_IO_PENDING) {
delegate_ = NULL;
- net_log_.EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB);
+ net_log_.EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB, NULL);
}
return rv;
@@ -76,7 +76,7 @@ void ConnectJob::NotifyDelegateOfCompletion(int rv) {
Delegate *delegate = delegate_;
delegate_ = NULL;
- net_log_.EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB);
+ net_log_.EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB, NULL);
delegate->OnConnectJobComplete(rv, this);
}
@@ -90,7 +90,7 @@ void ConnectJob::OnTimeout() {
// Make sure the socket is NULL before calling into |delegate|.
set_socket(NULL);
- net_log_.AddEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_TIMED_OUT);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_TIMED_OUT, NULL);
NotifyDelegateOfCompletion(ERR_TIMED_OUT);
}
@@ -172,11 +172,11 @@ ClientSocketPoolBaseHelper::RemoveRequestFromQueue(
int ClientSocketPoolBaseHelper::RequestSocket(
const std::string& group_name,
const Request* request) {
- request->net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL);
+ request->net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL, NULL);
Group& group = group_map_[group_name];
int rv = RequestSocketInternal(group_name, request);
if (rv != ERR_IO_PENDING)
- request->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL);
+ request->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL);
else
InsertRequestIntoQueue(request, &group.pending_requests);
return rv;
@@ -200,10 +200,11 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal(
// a scan of all groups, so just flip a flag here, and do the check later.
may_have_stalled_group_ = true;
- request->net_log().AddEvent(NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS);
+ request->net_log().AddEvent(NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS,
+ NULL);
} else {
request->net_log().AddEvent(
- NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS_PER_GROUP);
+ NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS_PER_GROUP, NULL);
}
return ERR_IO_PENDING;
}
@@ -234,9 +235,9 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal(
// We couldn't find a socket to reuse, so allocate and connect a new one.
BoundNetLog job_net_log = BoundNetLog::Make(
request->net_log().net_log(), NetLog::SOURCE_CONNECT_JOB);
- request->net_log().BeginEventWithInteger(
+ request->net_log().BeginEvent(
NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_ID,
- "source_id", job_net_log.source().id);
+ new NetLogIntegerParameter("source_id", job_net_log.source().id));
scoped_ptr<ConnectJob> connect_job(
connect_job_factory_->NewConnectJob(group_name, *request, this,
@@ -244,9 +245,9 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal(
int rv = connect_job->Connect();
if (rv == OK) {
- request->net_log().EndEventWithInteger(
+ request->net_log().EndEvent(
NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_ID,
- "source_id", job_net_log.source().id);
+ new NetLogIntegerParameter("source_id", job_net_log.source().id));
HandOutSocket(connect_job->ReleaseSocket(), false /* not reused */,
handle, base::TimeDelta(), &group, request->net_log());
} else if (rv == ERR_IO_PENDING) {
@@ -266,9 +267,9 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal(
ConnectJob* job = connect_job.release();
group.jobs.insert(job);
} else {
- request->net_log().EndEventWithInteger(
+ request->net_log().EndEvent(
NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_ID,
- "source_id", job_net_log.source().id);
+ new NetLogIntegerParameter("source_id", job_net_log.source().id));
if (group.IsEmpty())
group_map_.erase(group_name);
}
@@ -308,13 +309,14 @@ void ClientSocketPoolBaseHelper::OnBackupSocketTimerFired(
if (ReachedMaxSocketsLimit() ||
!group.HasAvailableSocketSlot(max_sockets_per_group_) ||
(*group.jobs.begin())->GetLoadState() == LOAD_STATE_RESOLVING_HOST) {
- group.backup_job->net_log().EndEvent(
- NetLog::TYPE_SOCKET_BACKUP_TIMER_EXTENDED);
+ group.backup_job->net_log().AddEvent(
+ NetLog::TYPE_SOCKET_BACKUP_TIMER_EXTENDED, NULL);
StartBackupSocketTimer(group_name);
return;
}
- group.backup_job->net_log().AddEvent(NetLog::TYPE_SOCKET_BACKUP_CREATED);
+ group.backup_job->net_log().AddEvent(NetLog::TYPE_SOCKET_BACKUP_CREATED,
+ NULL);
SIMPLE_STATS_COUNTER("socket.backup_created");
int rv = group.backup_job->Connect();
connecting_socket_count_++;
@@ -336,8 +338,8 @@ void ClientSocketPoolBaseHelper::CancelRequest(
for (; it != group.pending_requests.end(); ++it) {
if ((*it)->handle() == handle) {
const Request* req = RemoveRequestFromQueue(it, &group.pending_requests);
- req->net_log().AddEvent(NetLog::TYPE_CANCELLED);
- req->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL);
+ req->net_log().AddEvent(NetLog::TYPE_CANCELLED, NULL);
+ req->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL);
delete req;
// Let one connect job connect and become idle for potential future use.
if (group.jobs.size() > group.pending_requests.size() + 1) {
@@ -575,9 +577,10 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete(
if (!group.pending_requests.empty()) {
scoped_ptr<const Request> r(RemoveRequestFromQueue(
group.pending_requests.begin(), &group.pending_requests));
- r->net_log().EndEventWithInteger(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_ID,
- "source_id", job_log.source().id);
- r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL);
+ r->net_log().EndEvent(
+ NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_ID,
+ new NetLogIntegerParameter("source_id", job_log.source().id));
+ r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL);
HandOutSocket(
socket.release(), false /* unused socket */, r->handle(),
base::TimeDelta(), &group, r->net_log());
@@ -591,9 +594,10 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete(
if (!group.pending_requests.empty()) {
scoped_ptr<const Request> r(RemoveRequestFromQueue(
group.pending_requests.begin(), &group.pending_requests));
- r->net_log().EndEventWithInteger(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_ID,
- "source_id", job_log.source().id);
- r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL);
+ r->net_log().EndEvent(
+ NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_ID,
+ new NetLogIntegerParameter("source_id", job_log.source().id));
+ r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL);
r->callback()->Run(result);
}
MaybeOnAvailableSocketSlot(group_name);
@@ -654,7 +658,7 @@ void ClientSocketPoolBaseHelper::ProcessPendingRequest(
int rv = RequestSocketInternal(group_name, r.get());
if (rv != ERR_IO_PENDING) {
- r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL);
+ r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL);
RemoveRequestFromQueue(group->pending_requests.begin(),
&group->pending_requests);
r->callback()->Run(rv);
@@ -681,13 +685,15 @@ void ClientSocketPoolBaseHelper::HandOutSocket(
handle->set_idle_time(idle_time);
if (reused) {
- net_log.AddEventWithInteger(
+ net_log.AddEvent(
NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET,
- "idle_ms", static_cast<int>(idle_time.InMilliseconds()));
+ new NetLogIntegerParameter(
+ "idle_ms", static_cast<int>(idle_time.InMilliseconds())));
}
- net_log.AddEventWithInteger(NetLog::TYPE_SOCKET_POOL_SOCKET_ID,
- "source_id", socket->NetLog().source().id);
+ net_log.AddEvent(NetLog::TYPE_SOCKET_POOL_SOCKET_ID,
+ new NetLogIntegerParameter(
+ "source_id", socket->NetLog().source().id));
handed_out_socket_count_++;
group->active_socket_count++;
diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc
index 2a4317e..997fb25 100644
--- a/net/socket/socks5_client_socket.cc
+++ b/net/socket/socks5_client_socket.cc
@@ -75,7 +75,7 @@ int SOCKS5ClientSocket::Connect(CompletionCallback* callback) {
if (completed_handshake_)
return OK;
- net_log_.BeginEvent(NetLog::TYPE_SOCKS5_CONNECT);
+ net_log_.BeginEvent(NetLog::TYPE_SOCKS5_CONNECT, NULL);
next_state_ = STATE_GREET_WRITE;
buffer_.clear();
@@ -84,7 +84,7 @@ int SOCKS5ClientSocket::Connect(CompletionCallback* callback) {
if (rv == ERR_IO_PENDING) {
user_callback_ = callback;
} else {
- net_log_.EndEvent(NetLog::TYPE_SOCKS5_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS5_CONNECT, NULL);
}
return rv;
}
@@ -152,7 +152,7 @@ void SOCKS5ClientSocket::OnIOComplete(int result) {
DCHECK_NE(STATE_NONE, next_state_);
int rv = DoLoop(result);
if (rv != ERR_IO_PENDING) {
- net_log_.EndEvent(NetLog::TYPE_SOCKS5_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS5_CONNECT, NULL);
DoCallback(rv);
}
}
@@ -166,39 +166,39 @@ int SOCKS5ClientSocket::DoLoop(int last_io_result) {
switch (state) {
case STATE_GREET_WRITE:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SOCKS5_GREET_WRITE);
+ net_log_.BeginEvent(NetLog::TYPE_SOCKS5_GREET_WRITE, NULL);
rv = DoGreetWrite();
break;
case STATE_GREET_WRITE_COMPLETE:
rv = DoGreetWriteComplete(rv);
- net_log_.EndEvent(NetLog::TYPE_SOCKS5_GREET_WRITE);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS5_GREET_WRITE, NULL);
break;
case STATE_GREET_READ:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SOCKS5_GREET_READ);
+ net_log_.BeginEvent(NetLog::TYPE_SOCKS5_GREET_READ, NULL);
rv = DoGreetRead();
break;
case STATE_GREET_READ_COMPLETE:
rv = DoGreetReadComplete(rv);
- net_log_.EndEvent(NetLog::TYPE_SOCKS5_GREET_READ);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS5_GREET_READ, NULL);
break;
case STATE_HANDSHAKE_WRITE:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_WRITE);
+ net_log_.BeginEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_WRITE, NULL);
rv = DoHandshakeWrite();
break;
case STATE_HANDSHAKE_WRITE_COMPLETE:
rv = DoHandshakeWriteComplete(rv);
- net_log_.EndEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_WRITE);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_WRITE, NULL);
break;
case STATE_HANDSHAKE_READ:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_READ);
+ net_log_.BeginEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_READ, NULL);
rv = DoHandshakeRead();
break;
case STATE_HANDSHAKE_READ_COMPLETE:
rv = DoHandshakeReadComplete(rv);
- net_log_.EndEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_READ);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_READ, NULL);
break;
default:
NOTREACHED() << "bad state";
@@ -216,7 +216,7 @@ int SOCKS5ClientSocket::DoGreetWrite() {
// Since we only have 1 byte to send the hostname length in, if the
// URL has a hostname longer than 255 characters we can't send it.
if (0xFF < host_request_info_.hostname().size()) {
- net_log_.AddEvent(NetLog::TYPE_SOCKS_HOSTNAME_TOO_BIG);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_HOSTNAME_TOO_BIG, NULL);
return ERR_SOCKS_CONNECTION_FAILED;
}
@@ -263,7 +263,8 @@ int SOCKS5ClientSocket::DoGreetReadComplete(int result) {
return result;
if (result == 0) {
- net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTEDLY_CLOSED_DURING_GREETING);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTEDLY_CLOSED_DURING_GREETING,
+ NULL);
return ERR_SOCKS_CONNECTION_FAILED;
}
@@ -276,13 +277,13 @@ int SOCKS5ClientSocket::DoGreetReadComplete(int result) {
// Got the greet data.
if (buffer_[0] != kSOCKS5Version) {
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKS_UNEXPECTED_VERSION,
- "version", buffer_[0]);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTED_VERSION,
+ new NetLogIntegerParameter("version", buffer_[0]));
return ERR_SOCKS_CONNECTION_FAILED;
}
if (buffer_[1] != 0x00) {
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKS_UNEXPECTED_AUTH,
- "method", buffer_[1]);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTED_AUTH,
+ new NetLogIntegerParameter("method", buffer_[1]));
return ERR_SOCKS_CONNECTION_FAILED;
}
@@ -373,7 +374,8 @@ int SOCKS5ClientSocket::DoHandshakeReadComplete(int result) {
// The underlying socket closed unexpectedly.
if (result == 0) {
- net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTEDLY_CLOSED_DURING_HANDSHAKE);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTEDLY_CLOSED_DURING_HANDSHAKE,
+ NULL);
return ERR_SOCKS_CONNECTION_FAILED;
}
@@ -384,13 +386,13 @@ int SOCKS5ClientSocket::DoHandshakeReadComplete(int result) {
// and accordingly increase them
if (bytes_received_ == kReadHeaderSize) {
if (buffer_[0] != kSOCKS5Version || buffer_[2] != kNullByte) {
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKS_UNEXPECTED_VERSION,
- "version", buffer_[0]);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTED_VERSION,
+ new NetLogIntegerParameter("version", buffer_[0]));
return ERR_SOCKS_CONNECTION_FAILED;
}
if (buffer_[1] != 0x00) {
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKS_SERVER_ERROR,
- "error_code", buffer_[1]);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_SERVER_ERROR,
+ new NetLogIntegerParameter("error_code", buffer_[1]));
return ERR_SOCKS_CONNECTION_FAILED;
}
@@ -408,8 +410,8 @@ int SOCKS5ClientSocket::DoHandshakeReadComplete(int result) {
else if (address_type == kEndPointResolvedIPv6)
read_header_size += sizeof(struct in6_addr) - 1;
else {
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKS_UNKNOWN_ADDRESS_TYPE,
- "address_type", buffer_[3]);
+ net_log_.AddEvent(NetLog::TYPE_SOCKS_UNKNOWN_ADDRESS_TYPE,
+ new NetLogIntegerParameter("address_type", buffer_[3]));
return ERR_SOCKS_CONNECTION_FAILED;
}
diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc
index ec51099..32c4e3b 100644
--- a/net/socket/socks_client_socket.cc
+++ b/net/socket/socks_client_socket.cc
@@ -112,13 +112,13 @@ int SOCKSClientSocket::Connect(CompletionCallback* callback) {
next_state_ = STATE_RESOLVE_HOST;
- net_log_.BeginEvent(NetLog::TYPE_SOCKS_CONNECT);
+ net_log_.BeginEvent(NetLog::TYPE_SOCKS_CONNECT, NULL);
int rv = DoLoop(OK);
if (rv == ERR_IO_PENDING) {
user_callback_ = callback;
} else {
- net_log_.EndEvent(NetLog::TYPE_SOCKS_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS_CONNECT, NULL);
}
return rv;
}
@@ -188,7 +188,7 @@ void SOCKSClientSocket::OnIOComplete(int result) {
DCHECK_NE(STATE_NONE, next_state_);
int rv = DoLoop(result);
if (rv != ERR_IO_PENDING) {
- net_log_.EndEvent(NetLog::TYPE_SOCKS_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SOCKS_CONNECT, NULL);
DoCallback(rv);
}
}
diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc
index 4c36009..973a77d 100644
--- a/net/socket/ssl_client_socket_mac.cc
+++ b/net/socket/ssl_client_socket_mac.cc
@@ -531,11 +531,11 @@ int SSLClientSocketMac::Connect(CompletionCallback* callback) {
DCHECK(next_handshake_state_ == STATE_NONE);
DCHECK(!user_connect_callback_);
- net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL);
int rv = InitializeSSLContext();
if (rv != OK) {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
return rv;
}
@@ -544,7 +544,7 @@ int SSLClientSocketMac::Connect(CompletionCallback* callback) {
if (rv == ERR_IO_PENDING) {
user_connect_callback_ = callback;
} else {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
}
return rv;
}
@@ -866,7 +866,7 @@ void SSLClientSocketMac::OnHandshakeIOComplete(int result) {
DCHECK(next_handshake_state_ != STATE_NONE);
int rv = DoHandshakeLoop(result);
if (rv != ERR_IO_PENDING) {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
DoConnectCallback(rv);
}
}
@@ -882,7 +882,7 @@ void SSLClientSocketMac::OnTransportReadComplete(int result) {
if (next_handshake_state_ != STATE_NONE) {
int rv = DoHandshakeLoop(result);
if (rv != ERR_IO_PENDING) {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
DoConnectCallback(rv);
}
return;
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index a033c79..d3c1f8d 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -292,17 +292,17 @@ int SSLClientSocketNSS::Connect(CompletionCallback* callback) {
DCHECK(!user_read_buf_);
DCHECK(!user_write_buf_);
- net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL);
int rv = Init();
if (rv != OK) {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
return rv;
}
rv = InitializeSSLOptions();
if (rv != OK) {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
return rv;
}
@@ -311,7 +311,7 @@ int SSLClientSocketNSS::Connect(CompletionCallback* callback) {
if (rv == ERR_IO_PENDING) {
user_connect_callback_ = callback;
} else {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
}
LeaveFunction("");
@@ -817,7 +817,7 @@ void SSLClientSocketNSS::OnHandshakeIOComplete(int result) {
EnterFunction(result);
int rv = DoHandshakeLoop(result);
if (rv != ERR_IO_PENDING) {
- net_log_.EndEvent(net::NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(net::NetLog::TYPE_SSL_CONNECT, NULL);
DoConnectCallback(rv);
}
LeaveFunction("");
diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc
index 1502a65..1d014ab 100644
--- a/net/socket/ssl_client_socket_win.cc
+++ b/net/socket/ssl_client_socket_win.cc
@@ -436,11 +436,11 @@ int SSLClientSocketWin::Connect(CompletionCallback* callback) {
DCHECK(next_state_ == STATE_NONE);
DCHECK(!user_connect_callback_);
- net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL);
int rv = InitializeSSLContext();
if (rv != OK) {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
return rv;
}
@@ -450,7 +450,7 @@ int SSLClientSocketWin::Connect(CompletionCallback* callback) {
if (rv == ERR_IO_PENDING) {
user_connect_callback_ = callback;
} else {
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
}
return rv;
}
@@ -654,7 +654,7 @@ void SSLClientSocketWin::OnHandshakeIOComplete(int result) {
c->Run(rv);
return;
}
- net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
CompletionCallback* c = user_connect_callback_;
user_connect_callback_ = NULL;
c->Run(rv);
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index 56cb435..581b8f4 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -137,7 +137,7 @@ TCPClientSocketLibevent::TCPClientSocketLibevent(const AddressList& addresses,
TCPClientSocketLibevent::~TCPClientSocketLibevent() {
Disconnect();
- net_log_.AddEvent(NetLog::TYPE_TCP_SOCKET_DONE);
+ net_log_.AddEvent(NetLog::TYPE_TCP_SOCKET_DONE, NULL);
}
int TCPClientSocketLibevent::Connect(CompletionCallback* callback) {
@@ -149,7 +149,7 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) {
TRACE_EVENT_BEGIN("socket.connect", this, "");
- net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT, NULL);
int rv = DoConnect();
@@ -161,7 +161,7 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) {
write_callback_ = callback;
} else {
TRACE_EVENT_END("socket.connect", this, "");
- net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL);
}
return rv;
@@ -277,8 +277,8 @@ int TCPClientSocketLibevent::Read(IOBuffer* buf,
int nread = HANDLE_EINTR(read(socket_, buf->data(), buf_len));
if (nread >= 0) {
TRACE_EVENT_END("socket.read", this, StringPrintf("%d bytes", nread));
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
- "num_bytes", nread);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
+ new NetLogIntegerParameter("num_bytes", nread));
return nread;
}
if (errno != EAGAIN && errno != EWOULDBLOCK) {
@@ -313,8 +313,8 @@ int TCPClientSocketLibevent::Write(IOBuffer* buf,
int nwrite = HANDLE_EINTR(write(socket_, buf->data(), buf_len));
if (nwrite >= 0) {
TRACE_EVENT_END("socket.write", this, StringPrintf("%d bytes", nwrite));
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_SENT,
- "num_bytes", nwrite);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_SENT,
+ new NetLogIntegerParameter("num_bytes", nwrite));
return nwrite;
}
if (errno != EAGAIN && errno != EWOULDBLOCK)
@@ -408,7 +408,7 @@ void TCPClientSocketLibevent::DidCompleteConnect() {
Disconnect();
current_ai_ = next;
TRACE_EVENT_END("socket.connect", this, "");
- net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL);
result = Connect(write_callback_);
} else {
result = MapConnectError(os_error);
@@ -416,7 +416,7 @@ void TCPClientSocketLibevent::DidCompleteConnect() {
DCHECK(ok);
waiting_connect_ = false;
TRACE_EVENT_END("socket.connect", this, "");
- net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL);
}
if (result != ERR_IO_PENDING) {
@@ -434,8 +434,8 @@ void TCPClientSocketLibevent::DidCompleteRead() {
TRACE_EVENT_END("socket.read", this,
StringPrintf("%d bytes", bytes_transferred));
result = bytes_transferred;
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
- "num_bytes", result);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
+ new NetLogIntegerParameter("num_bytes", result));
} else {
result = MapPosixError(errno);
}
@@ -459,8 +459,8 @@ void TCPClientSocketLibevent::DidCompleteWrite() {
result = bytes_transferred;
TRACE_EVENT_END("socket.write", this,
StringPrintf("%d bytes", bytes_transferred));
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_SENT,
- "num_bytes", result);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_SENT,
+ new NetLogIntegerParameter("num_bytes", result));
} else {
result = MapPosixError(errno);
}
diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc
index ed75d0e..74841cf 100644
--- a/net/socket/tcp_client_socket_pool.cc
+++ b/net/socket/tcp_client_socket_pool.cc
@@ -201,12 +201,13 @@ int TCPClientSocketPool::RequestSocket(
if (net_log.HasListener()) {
// TODO(eroman): Split out the host and port parameters.
- net_log.AddEventWithString(
+ net_log.AddEvent(
NetLog::TYPE_TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKET,
- "host_and_port",
- StringPrintf("%s [port %d]",
- casted_params->destination().hostname().c_str(),
- casted_params->destination().port()));
+ new NetLogStringParameter(
+ "host_and_port",
+ StringPrintf("%s [port %d]",
+ casted_params->destination().hostname().c_str(),
+ casted_params->destination().port())));
}
return base_.RequestSocket(group_name, *casted_params, priority, handle,
diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc
index 95ec3a9..fffc37a 100644
--- a/net/socket/tcp_client_socket_win.cc
+++ b/net/socket/tcp_client_socket_win.cc
@@ -288,7 +288,7 @@ TCPClientSocketWin::TCPClientSocketWin(const AddressList& addresses,
TCPClientSocketWin::~TCPClientSocketWin() {
Disconnect();
- net_log_.AddEvent(NetLog::TYPE_TCP_SOCKET_DONE);
+ net_log_.AddEvent(NetLog::TYPE_TCP_SOCKET_DONE, NULL);
}
int TCPClientSocketWin::Connect(CompletionCallback* callback) {
@@ -301,7 +301,7 @@ int TCPClientSocketWin::Connect(CompletionCallback* callback) {
TRACE_EVENT_BEGIN("socket.connect", this, "");
- net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT, NULL);
int rv = DoConnect();
@@ -313,7 +313,7 @@ int TCPClientSocketWin::Connect(CompletionCallback* callback) {
read_callback_ = callback;
} else {
TRACE_EVENT_END("socket.connect", this, "");
- net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL);
if (rv == OK)
UpdateConnectionTypeHistograms(CONNECTION_ANY);
}
@@ -477,8 +477,8 @@ int TCPClientSocketWin::Read(IOBuffer* buf,
base::MemoryDebug::MarkAsInitialized(core_->read_buffer_.buf, num);
static StatsCounter read_bytes("tcp.read_bytes");
read_bytes.Add(num);
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
- "num_bytes", num);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
+ new NetLogIntegerParameter("num_bytes", num));
return static_cast<int>(num);
}
} else {
@@ -529,8 +529,8 @@ int TCPClientSocketWin::Write(IOBuffer* buf,
TRACE_EVENT_END("socket.write", this, StringPrintf("%d bytes", rv));
static StatsCounter write_bytes("tcp.write_bytes");
write_bytes.Add(rv);
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_SENT,
- "num_bytes", rv);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_SENT,
+ new NetLogIntegerParameter("num_bytes", rv));
return rv;
}
} else {
@@ -663,18 +663,18 @@ void TCPClientSocketWin::DidCompleteConnect() {
Disconnect();
current_ai_ = next;
TRACE_EVENT_END("socket.connect", this, "");
- net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL);
result = Connect(read_callback_);
} else {
result = MapConnectError(os_error);
TRACE_EVENT_END("socket.connect", this, "");
- net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL);
}
} else {
NOTREACHED();
result = ERR_UNEXPECTED;
TRACE_EVENT_END("socket.connect", this, "");
- net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL);
}
if (result != ERR_IO_PENDING) {
@@ -694,8 +694,8 @@ void TCPClientSocketWin::DidCompleteRead() {
waiting_read_ = false;
core_->read_iobuffer_ = NULL;
if (ok) {
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
- "num_bytes", num_bytes);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
+ new NetLogIntegerParameter("num_bytes", num_bytes));
}
DoReadCallback(ok ? num_bytes : MapWinsockError(WSAGetLastError()));
}
@@ -722,8 +722,8 @@ void TCPClientSocketWin::DidCompleteWrite() {
<< " bytes reported.";
rv = ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES;
} else {
- net_log_.AddEventWithInteger(NetLog::TYPE_SOCKET_BYTES_SENT,
- "num_bytes", rv);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_SENT,
+ new NetLogIntegerParameter("num_bytes", rv));
}
}
core_->write_iobuffer_ = NULL;
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index f3fb6d00..b957d8a 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -89,7 +89,7 @@ void SocketStream::set_context(URLRequestContext* context) {
context_ = context;
if (prev_context != context) {
- net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE);
+ net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE, NULL);
net_log_ = BoundNetLog();
if (context) {
@@ -97,7 +97,7 @@ void SocketStream::set_context(URLRequestContext* context) {
context->net_log(),
NetLog::SOURCE_SOCKET_STREAM);
- net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
+ net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE, NULL);
}
}
@@ -120,8 +120,9 @@ void SocketStream::Connect() {
// Open a connection asynchronously, so that delegate won't be called
// back before returning Connect().
next_state_ = STATE_RESOLVE_PROXY;
- net_log_.BeginEventWithString(NetLog::TYPE_SOCKET_STREAM_CONNECT,
- "url", url_.possibly_invalid_spec());
+ net_log_.BeginEvent(
+ NetLog::TYPE_SOCKET_STREAM_CONNECT,
+ new NetLogStringParameter("url", url_.possibly_invalid_spec()));
MessageLoop::current()->PostTask(
FROM_HERE,
NewRunnableMethod(this, &SocketStream::DoLoop, OK));
@@ -212,7 +213,7 @@ void SocketStream::DetachDelegate() {
if (!delegate_)
return;
delegate_ = NULL;
- net_log_.AddEvent(NetLog::TYPE_CANCELLED);
+ net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL);
Close();
}
@@ -261,7 +262,7 @@ int SocketStream::DidEstablishConnection() {
next_state_ = STATE_READ_WRITE;
metrics_->OnConnected();
- net_log_.EndEvent(NetLog::TYPE_SOCKET_STREAM_CONNECT);
+ net_log_.EndEvent(NetLog::TYPE_SOCKET_STREAM_CONNECT, NULL);
if (delegate_)
delegate_->OnConnected(this, max_pending_send_allowed_);
@@ -271,7 +272,7 @@ int SocketStream::DidEstablishConnection() {
int SocketStream::DidReceiveData(int result) {
DCHECK(read_buf_);
DCHECK_GT(result, 0);
- net_log_.AddEvent(NetLog::TYPE_SOCKET_STREAM_RECEIVED);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_STREAM_RECEIVED, NULL);
int len = result;
metrics_->OnRead(len);
if (delegate_) {
@@ -284,7 +285,7 @@ int SocketStream::DidReceiveData(int result) {
int SocketStream::DidSendData(int result) {
DCHECK_GT(result, 0);
- net_log_.AddEvent(NetLog::TYPE_SOCKET_STREAM_SENT);
+ net_log_.AddEvent(NetLog::TYPE_SOCKET_STREAM_SENT, NULL);
int len = result;
metrics_->OnWrite(len);
current_write_buf_ = NULL;
@@ -406,8 +407,8 @@ void SocketStream::DoLoop(int result) {
// close the connection.
if (state != STATE_READ_WRITE && result < ERR_IO_PENDING) {
DCHECK_EQ(next_state_, STATE_CLOSE);
- net_log_.EndEventWithInteger(NetLog::TYPE_SOCKET_STREAM_CONNECT,
- "net_error", result);
+ net_log_.EndEvent(NetLog::TYPE_SOCKET_STREAM_CONNECT,
+ new NetLogIntegerParameter("net_error", result));
}
} while (result != ERR_IO_PENDING);
}
diff --git a/net/spdy/spdy_network_transaction.cc b/net/spdy/spdy_network_transaction.cc
index 34b38fb..6a50fb2 100644
--- a/net/spdy/spdy_network_transaction.cc
+++ b/net/spdy/spdy_network_transaction.cc
@@ -159,38 +159,39 @@ int SpdyNetworkTransaction::DoLoop(int result) {
switch (state) {
case STATE_INIT_CONNECTION:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION,
+ NULL);
rv = DoInitConnection();
break;
case STATE_INIT_CONNECTION_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION, NULL);
rv = DoInitConnectionComplete(rv);
break;
case STATE_SEND_REQUEST:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST, NULL);
rv = DoSendRequest();
break;
case STATE_SEND_REQUEST_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST, NULL);
rv = DoSendRequestComplete(rv);
break;
case STATE_READ_HEADERS:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS, NULL);
rv = DoReadHeaders();
break;
case STATE_READ_HEADERS_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS, NULL);
rv = DoReadHeadersComplete(rv);
break;
case STATE_READ_BODY:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY, NULL);
rv = DoReadBody();
break;
case STATE_READ_BODY_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY, NULL);
rv = DoReadBodyComplete(rv);
break;
case STATE_NONE:
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 2b03425..d366fdf 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -331,7 +331,7 @@ scoped_refptr<SpdyStream> SpdySession::GetOrCreateStream(
DCHECK(!it->second);
// Server will assign a stream id when the push stream arrives. Use 0 for
// now.
- log.AddEvent(NetLog::TYPE_SPDY_STREAM_ADOPTED_PUSH_STREAM);
+ log.AddEvent(NetLog::TYPE_SPDY_STREAM_ADOPTED_PUSH_STREAM, NULL);
SpdyStream* stream = new SpdyStream(this, 0, true, log);
stream->SetRequestInfo(request);
stream->set_path(path);
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 5382f6c..f2ea36c 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -301,29 +301,29 @@ int SpdyStream::DoLoop(int result) {
// State machine 1: Send headers and wait for response headers.
case STATE_SEND_HEADERS:
CHECK_EQ(OK, result);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS, NULL);
result = DoSendHeaders();
break;
case STATE_SEND_HEADERS_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS, NULL);
result = DoSendHeadersComplete(result);
break;
case STATE_SEND_BODY:
CHECK_EQ(OK, result);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY, NULL);
result = DoSendBody();
break;
case STATE_SEND_BODY_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY, NULL);
result = DoSendBodyComplete(result);
break;
case STATE_READ_HEADERS:
CHECK_EQ(OK, result);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS, NULL);
result = DoReadHeaders();
break;
case STATE_READ_HEADERS_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS, NULL);
result = DoReadHeadersComplete(result);
break;
@@ -332,11 +332,11 @@ int SpdyStream::DoLoop(int result) {
// the OnDataReceived()/OnClose()/ReadResponseHeaders()/etc. Only reason
// to do this is for consistency with the Http code.
case STATE_READ_BODY:
- net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY, NULL);
result = DoReadBody();
break;
case STATE_READ_BODY_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY, NULL);
result = DoReadBodyComplete(result);
break;
case STATE_DONE:
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 589d81f..bf50655 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -259,8 +259,10 @@ void URLRequest::StartJob(URLRequestJob* job) {
DCHECK(!is_pending_);
DCHECK(!job_);
- net_log_.BeginEventWithString(net::NetLog::TYPE_URL_REQUEST_START,
- "url", original_url().possibly_invalid_spec());
+ net_log_.BeginEvent(
+ net::NetLog::TYPE_URL_REQUEST_START,
+ new net::NetLogStringParameter(
+ "url", original_url().possibly_invalid_spec()));
job_ = job;
job_->SetExtraRequestHeaders(extra_request_headers_);
@@ -367,10 +369,11 @@ void URLRequest::ReceivedRedirect(const GURL& location, bool* defer_redirect) {
void URLRequest::ResponseStarted() {
if (!status_.is_success()) {
- net_log_.EndEventWithInteger(net::NetLog::TYPE_URL_REQUEST_START,
- "net_error", status_.os_error());
+ net_log_.EndEvent(
+ net::NetLog::TYPE_URL_REQUEST_START,
+ new net::NetLogIntegerParameter("net_error", status_.os_error()));
} else {
- net_log_.EndEvent(net::NetLog::TYPE_URL_REQUEST_START);
+ net_log_.EndEvent(net::NetLog::TYPE_URL_REQUEST_START, NULL);
}
URLRequestJob* job = GetJobManager()->MaybeInterceptResponse(this);
@@ -445,8 +448,10 @@ std::string URLRequest::StripPostSpecificHeaders(const std::string& headers) {
int URLRequest::Redirect(const GURL& location, int http_status_code) {
if (net_log_.HasListener()) {
- net_log_.AddEventWithString(net::NetLog::TYPE_URL_REQUEST_REDIRECTED,
- "location", location.possibly_invalid_spec());
+ net_log_.AddEvent(
+ net::NetLog::TYPE_URL_REQUEST_REDIRECTED,
+ new net::NetLogStringParameter(
+ "location", location.possibly_invalid_spec()));
}
if (redirect_limit_ <= 0) {
DLOG(INFO) << "disallowing redirect: exceeds limit";
@@ -512,13 +517,13 @@ void URLRequest::set_context(URLRequestContext* context) {
// If the context this request belongs to has changed, update the tracker.
if (prev_context != context) {
- net_log_.EndEvent(net::NetLog::TYPE_REQUEST_ALIVE);
+ net_log_.EndEvent(net::NetLog::TYPE_REQUEST_ALIVE, NULL);
net_log_ = net::BoundNetLog();
if (context) {
net_log_ = net::BoundNetLog::Make(context->net_log(),
net::NetLog::SOURCE_URL_REQUEST);
- net_log_.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE);
+ net_log_.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE, NULL);
}
}
}