summaryrefslogtreecommitdiffstats
path: root/net/socket
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/socket
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/socket')
-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
9 files changed, 115 insertions, 106 deletions
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;