diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 19:16:43 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 19:16:43 +0000 |
commit | d7fd17806126d4998ea0ac36eac95ea031761219 (patch) | |
tree | 363a1689a60dcf968281827d2128eb3546c7c605 | |
parent | 243b4f0b3c3aa4e48064ae01337ba2554d367074 (diff) | |
download | chromium_src-d7fd17806126d4998ea0ac36eac95ea031761219.zip chromium_src-d7fd17806126d4998ea0ac36eac95ea031761219.tar.gz chromium_src-d7fd17806126d4998ea0ac36eac95ea031761219.tar.bz2 |
NetLog: Log net error codes on a lot of EndEvents.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6349083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74143 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/base/net_log.h | 2 | ||||
-rw-r--r-- | net/http/http_network_transaction.cc | 13 | ||||
-rw-r--r-- | net/http/http_proxy_client_socket.cc | 16 | ||||
-rw-r--r-- | net/http/http_stream_parser.cc | 3 | ||||
-rw-r--r-- | net/proxy/init_proxy_resolver.cc | 25 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base.cc | 28 | ||||
-rw-r--r-- | net/socket/socks5_client_socket.cc | 12 | ||||
-rw-r--r-- | net/socket/socks_client_socket.cc | 4 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_mac.cc | 6 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_nss.cc | 10 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_openssl.cc | 9 | ||||
-rw-r--r-- | net/socket/ssl_server_socket_nss.cc | 8 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_libevent.cc | 7 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_win.cc | 7 | ||||
-rw-r--r-- | net/socket_stream/socket_stream.cc | 5 | ||||
-rw-r--r-- | net/spdy/spdy_proxy_client_socket.cc | 12 |
16 files changed, 78 insertions, 89 deletions
diff --git a/net/base/net_log.h b/net/base/net_log.h index 1d37129..eb88038 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -34,8 +34,6 @@ namespace net { // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods. // TODO(eroman): Start a new Source each time net::URLRequest redirects // (simpler to reason about each as a separate entity). -// TODO(mmenke): Replace EndEvent calls with EndEventWithNetErrorCode, where -// appropriate. class NetLog { public: diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index e0967c6..128497f 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -500,7 +500,8 @@ int HttpNetworkTransaction::DoLoop(int result) { break; case STATE_SEND_REQUEST_COMPLETE: rv = DoSendRequestComplete(rv); - net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, rv); break; case STATE_READ_HEADERS: DCHECK_EQ(OK, rv); @@ -509,7 +510,8 @@ int HttpNetworkTransaction::DoLoop(int result) { break; case STATE_READ_HEADERS_COMPLETE: rv = DoReadHeadersComplete(rv); - net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, rv); break; case STATE_READ_BODY: DCHECK_EQ(OK, rv); @@ -518,7 +520,8 @@ int HttpNetworkTransaction::DoLoop(int result) { break; case STATE_READ_BODY_COMPLETE: rv = DoReadBodyComplete(rv); - net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, rv); break; case STATE_DRAIN_BODY_FOR_AUTH_RESTART: DCHECK_EQ(OK, rv); @@ -528,8 +531,8 @@ int HttpNetworkTransaction::DoLoop(int result) { break; case STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE: rv = DoDrainBodyForAuthRestartComplete(rv); - net_log_.EndEvent( - NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART, NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART, rv); break; default: NOTREACHED() << "bad state"; diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc index 692a6e3..23efcb9 100644 --- a/net/http/http_proxy_client_socket.cc +++ b/net/http/http_proxy_client_socket.cc @@ -299,25 +299,25 @@ int HttpProxyClientSocket::DoLoop(int last_io_result) { break; case STATE_SEND_REQUEST: DCHECK_EQ(OK, rv); - net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, - NULL); + net_log_.BeginEvent( + NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, NULL); rv = DoSendRequest(); break; case STATE_SEND_REQUEST_COMPLETE: rv = DoSendRequestComplete(rv); - net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, - NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, rv); break; case STATE_READ_HEADERS: DCHECK_EQ(OK, rv); - net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS, - NULL); + net_log_.BeginEvent( + NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS, NULL); rv = DoReadHeaders(); break; case STATE_READ_HEADERS_COMPLETE: rv = DoReadHeadersComplete(rv); - net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS, - NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS, rv); break; case STATE_DRAIN_BODY: DCHECK_EQ(OK, rv); diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 460d9b7..20ebd87 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -184,7 +184,8 @@ int HttpStreamParser::DoLoop(int result) { break; case STATE_READ_HEADERS_COMPLETE: result = DoReadHeadersComplete(result); - net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, result); break; case STATE_BODY_PENDING: DCHECK(result != ERR_IO_PENDING); diff --git a/net/proxy/init_proxy_resolver.cc b/net/proxy/init_proxy_resolver.cc index 4bf250e..c60dd21 100644 --- a/net/proxy/init_proxy_resolver.cc +++ b/net/proxy/init_proxy_resolver.cc @@ -151,8 +151,10 @@ int InitProxyResolver::DoWait() { int InitProxyResolver::DoWaitComplete(int result) { DCHECK_EQ(OK, result); - if (wait_delay_.ToInternalValue() != 0) - net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_WAIT, NULL); + if (wait_delay_.ToInternalValue() != 0) { + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_INIT_PROXY_RESOLVER_WAIT, + result); + } next_state_ = GetStartState(); return OK; } @@ -185,14 +187,10 @@ int InitProxyResolver::DoFetchPacScript() { int InitProxyResolver::DoFetchPacScriptComplete(int result) { DCHECK(resolver_->expects_pac_bytes()); - if (result == OK) { - net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, NULL); - } else { - net_log_.EndEvent( - NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, - make_scoped_refptr(new NetLogIntegerParameter("net_error", result))); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, result); + if (result != OK) return TryToFallbackPacUrl(result); - } next_state_ = STATE_SET_PAC_SCRIPT; return result; @@ -219,12 +217,10 @@ int InitProxyResolver::DoSetPacScript() { } int InitProxyResolver::DoSetPacScriptComplete(int result) { - if (result != OK) { - net_log_.EndEvent( - NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, - make_scoped_refptr(new NetLogIntegerParameter("net_error", result))); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, result); + if (result != OK) return TryToFallbackPacUrl(result); - } // Let the caller know which automatic setting we ended up initializing the // resolver for (there may have been multiple fallbacks to choose from.) @@ -240,7 +236,6 @@ int InitProxyResolver::DoSetPacScriptComplete(int result) { } } - net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, NULL); return result; } diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 816ecc9..64fb831 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -114,10 +114,8 @@ void ConnectJob::LogConnectStart() { } void ConnectJob::LogConnectCompletion(int net_error) { - scoped_refptr<NetLog::EventParameters> params; - if (net_error != OK) - params = new NetLogIntegerParameter("net_error", net_error); - net_log().EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, params); + net_log().EndEventWithNetErrorCode( + NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, net_error); } void ConnectJob::OnTimeout() { @@ -216,7 +214,7 @@ int ClientSocketPoolBaseHelper::RequestSocket( int rv = RequestSocketInternal(group_name, request); if (rv != ERR_IO_PENDING) { - request->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL); + request->net_log().EndEventWithNetErrorCode(NetLog::TYPE_SOCKET_POOL, rv); CHECK(!request->handle()->is_initialized()); delete request; } else { @@ -246,12 +244,11 @@ void ClientSocketPoolBaseHelper::RequestSockets( // RequestSocketsInternal() may delete the group. bool deleted_group = false; + int rv = OK; for (int num_iterations_left = num_sockets; group->NumActiveSocketSlots() < num_sockets && num_iterations_left > 0 ; num_iterations_left--) { - int rv = RequestSocketInternal(group_name, &request); - // TODO(willchan): Possibly check for ERR_PRECONNECT_MAX_SOCKET_LIMIT so we - // can log it into the NetLog. + rv = RequestSocketInternal(group_name, &request); if (rv < 0 && rv != ERR_IO_PENDING) { // We're encountering a synchronous error. Give up. if (!ContainsKey(group_map_, group_name)) @@ -270,8 +267,10 @@ void ClientSocketPoolBaseHelper::RequestSockets( if (!deleted_group && group->IsEmpty()) RemoveGroup(group_name); - request.net_log().EndEvent( - NetLog::TYPE_SOCKET_POOL_CONNECTING_N_SOCKETS, NULL); + if (rv == ERR_IO_PENDING) + rv = OK; + request.net_log().EndEventWithNetErrorCode( + NetLog::TYPE_SOCKET_POOL_CONNECTING_N_SOCKETS, rv); } int ClientSocketPoolBaseHelper::RequestSocketInternal( @@ -784,8 +783,8 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete( HandOutSocket(socket.release(), false /* unused socket */, r->handle(), base::TimeDelta(), group, r->net_log()); } - r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, make_scoped_refptr( - new NetLogIntegerParameter("net_error", result))); + r->net_log().EndEventWithNetErrorCode(NetLog::TYPE_SOCKET_POOL, + result); InvokeUserCallbackLater(r->handle(), r->callback(), result); } else { RemoveConnectJob(job, group); @@ -845,10 +844,7 @@ void ClientSocketPoolBaseHelper::ProcessPendingRequest( if (group->IsEmpty()) RemoveGroup(group_name); - scoped_refptr<NetLog::EventParameters> params; - if (rv != OK) - params = new NetLogIntegerParameter("net_error", rv); - request->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, params); + request->net_log().EndEventWithNetErrorCode(NetLog::TYPE_SOCKET_POOL, rv); InvokeUserCallbackLater( request->handle(), request->callback(), rv); } diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc index f2d2efe..42c8603 100644 --- a/net/socket/socks5_client_socket.cc +++ b/net/socket/socks5_client_socket.cc @@ -83,7 +83,7 @@ int SOCKS5ClientSocket::Connect(CompletionCallback* callback) { if (rv == ERR_IO_PENDING) { user_callback_ = callback; } else { - net_log_.EndEvent(NetLog::TYPE_SOCKS5_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SOCKS5_CONNECT, rv); } return rv; } @@ -206,7 +206,7 @@ int SOCKS5ClientSocket::DoLoop(int last_io_result) { break; case STATE_GREET_WRITE_COMPLETE: rv = DoGreetWriteComplete(rv); - net_log_.EndEvent(NetLog::TYPE_SOCKS5_GREET_WRITE, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SOCKS5_GREET_WRITE, rv); break; case STATE_GREET_READ: DCHECK_EQ(OK, rv); @@ -215,7 +215,7 @@ int SOCKS5ClientSocket::DoLoop(int last_io_result) { break; case STATE_GREET_READ_COMPLETE: rv = DoGreetReadComplete(rv); - net_log_.EndEvent(NetLog::TYPE_SOCKS5_GREET_READ, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SOCKS5_GREET_READ, rv); break; case STATE_HANDSHAKE_WRITE: DCHECK_EQ(OK, rv); @@ -224,7 +224,8 @@ int SOCKS5ClientSocket::DoLoop(int last_io_result) { break; case STATE_HANDSHAKE_WRITE_COMPLETE: rv = DoHandshakeWriteComplete(rv); - net_log_.EndEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_WRITE, NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_SOCKS5_HANDSHAKE_WRITE, rv); break; case STATE_HANDSHAKE_READ: DCHECK_EQ(OK, rv); @@ -233,7 +234,8 @@ int SOCKS5ClientSocket::DoLoop(int last_io_result) { break; case STATE_HANDSHAKE_READ_COMPLETE: rv = DoHandshakeReadComplete(rv); - net_log_.EndEvent(NetLog::TYPE_SOCKS5_HANDSHAKE_READ, NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_SOCKS5_HANDSHAKE_READ, rv); break; default: NOTREACHED() << "bad state"; diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc index a8da6c4..3626492 100644 --- a/net/socket/socks_client_socket.cc +++ b/net/socket/socks_client_socket.cc @@ -116,7 +116,7 @@ int SOCKSClientSocket::Connect(CompletionCallback* callback) { if (rv == ERR_IO_PENDING) { user_callback_ = callback; } else { - net_log_.EndEvent(NetLog::TYPE_SOCKS_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SOCKS_CONNECT, rv); } return rv; } @@ -223,7 +223,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, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SOCKS_CONNECT, rv); DoCallback(rv); } } diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc index add3321..73bf8da 100644 --- a/net/socket/ssl_client_socket_mac.cc +++ b/net/socket/ssl_client_socket_mac.cc @@ -563,7 +563,7 @@ int SSLClientSocketMac::Connect(CompletionCallback* callback) { int rv = InitializeSSLContext(); if (rv != OK) { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); return rv; } @@ -572,7 +572,7 @@ int SSLClientSocketMac::Connect(CompletionCallback* callback) { if (rv == ERR_IO_PENDING) { user_connect_callback_ = callback; } else { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); } return rv; } @@ -906,7 +906,7 @@ void SSLClientSocketMac::OnHandshakeIOComplete(int result) { DoReadCallback(rv); return; } - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); DoConnectCallback(rv); } } diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index 384fa9d..90aa5d5 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -594,13 +594,13 @@ int SSLClientSocketNSS::Connect(CompletionCallback* callback) { int rv = Init(); if (rv != OK) { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); return rv; } rv = InitializeSSLOptions(); if (rv != OK) { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); return rv; } @@ -609,7 +609,7 @@ int SSLClientSocketNSS::Connect(CompletionCallback* callback) { if (!UsingTCPFastOpen()) { rv = InitializeSSLPeerName(); if (rv != OK) { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); return rv; } } @@ -629,7 +629,7 @@ int SSLClientSocketNSS::Connect(CompletionCallback* callback) { user_connect_callback_ = callback; } } else { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); } LeaveFunction(""); @@ -1210,7 +1210,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, NULL); + net_log_.EndEventWithNetErrorCode(net::NetLog::TYPE_SSL_CONNECT, rv); // If we pseudo connected for Snap Start, then we won't have a connect // callback. if (user_connect_callback_) diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index 169776a..e0534d0 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -625,8 +625,9 @@ int SSLClientSocketOpenSSL::Connect(CompletionCallback* callback) { // Set up new ssl object. if (!Init()) { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); - return ERR_UNEXPECTED; + int result = ERR_UNEXPECTED; + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, result); + return result; } // Set SSL to client mode. Handshake happens in the loop below. @@ -637,7 +638,7 @@ int SSLClientSocketOpenSSL::Connect(CompletionCallback* callback) { if (rv == ERR_IO_PENDING) { user_connect_callback_ = callback; } else { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); } return rv > OK ? OK : rv; @@ -989,7 +990,7 @@ void SSLClientSocketOpenSSL::DoConnectCallback(int rv) { void SSLClientSocketOpenSSL::OnHandshakeIOComplete(int result) { int rv = DoHandshakeLoop(result); if (rv != ERR_IO_PENDING) { - net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); DoConnectCallback(rv); } } diff --git a/net/socket/ssl_server_socket_nss.cc b/net/socket/ssl_server_socket_nss.cc index 61284fb..4d33863 100644 --- a/net/socket/ssl_server_socket_nss.cc +++ b/net/socket/ssl_server_socket_nss.cc @@ -96,14 +96,14 @@ int SSLServerSocketNSS::Accept(CompletionCallback* callback) { int rv = Init(); if (rv != OK) { LOG(ERROR) << "Failed to initialize NSS"; - net_log_.EndEvent(NetLog::TYPE_SSL_ACCEPT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_ACCEPT, rv); return rv; } rv = InitializeSSLOptions(); if (rv != OK) { LOG(ERROR) << "Failed to initialize SSL options"; - net_log_.EndEvent(NetLog::TYPE_SSL_ACCEPT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_ACCEPT, rv); return rv; } @@ -118,7 +118,7 @@ int SSLServerSocketNSS::Accept(CompletionCallback* callback) { if (rv == ERR_IO_PENDING) { user_accept_callback_ = callback; } else { - net_log_.EndEvent(NetLog::TYPE_SSL_ACCEPT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_ACCEPT, rv); } return rv > OK ? OK : rv; @@ -385,7 +385,7 @@ void SSLServerSocketNSS::OnRecvComplete(int result) { void SSLServerSocketNSS::OnHandshakeIOComplete(int result) { int rv = DoHandshakeLoop(result); if (rv != ERR_IO_PENDING) { - net_log_.EndEvent(net::NetLog::TYPE_SSL_ACCEPT, NULL); + net_log_.EndEventWithNetErrorCode(net::NetLog::TYPE_SSL_ACCEPT, rv); if (user_accept_callback_) DoAcceptCallback(rv); } diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index 83528dd..7282fd4 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -527,9 +527,7 @@ void TCPClientSocketLibevent::LogConnectCompletion(int net_error) { UpdateConnectionTypeHistograms(CONNECTION_ANY); if (net_error != OK) { - net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, - make_scoped_refptr( - new NetLogIntegerParameter("net_error", net_error))); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_CONNECT, net_error); return; } @@ -540,8 +538,7 @@ void TCPClientSocketLibevent::LogConnectCompletion(int net_error) { if (rv != 0) { PLOG(ERROR) << "getsockname() [rv: " << rv << "] error: "; NOTREACHED(); - scoped_refptr<NetLog::EventParameters> params; - net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_CONNECT, rv); return; } diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index d98485e..6027003 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -761,9 +761,7 @@ void TCPClientSocketWin::LogConnectCompletion(int net_error) { UpdateConnectionTypeHistograms(CONNECTION_ANY); if (net_error != OK) { - net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, - make_scoped_refptr( - new NetLogIntegerParameter("net_error", net_error))); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_CONNECT, net_error); return; } @@ -775,8 +773,7 @@ void TCPClientSocketWin::LogConnectCompletion(int net_error) { LOG(ERROR) << "getsockname() [rv: " << rv << "] error: " << WSAGetLastError(); NOTREACHED(); - scoped_refptr<NetLog::EventParameters> params; - net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT, NULL); + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_CONNECT, rv); return; } diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index b65fa6e..7733c5d 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -455,9 +455,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_.EndEvent( - NetLog::TYPE_SOCKET_STREAM_CONNECT, - make_scoped_refptr(new NetLogIntegerParameter("net_error", result))); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_SOCKET_STREAM_CONNECT, result); } } while (result != ERR_IO_PENDING); } diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index 845ac38..452ee3b 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -271,19 +271,19 @@ int SpdyProxyClientSocket::DoLoop(int last_io_result) { break; case STATE_SEND_REQUEST: DCHECK_EQ(OK, rv); - net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, - NULL); + net_log_.BeginEvent( + NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, NULL); rv = DoSendRequest(); break; case STATE_SEND_REQUEST_COMPLETE: + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, rv); rv = DoSendRequestComplete(rv); - net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST, - NULL); break; case STATE_READ_REPLY_COMPLETE: rv = DoReadReplyComplete(rv); - net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS, - NULL); + net_log_.EndEventWithNetErrorCode( + NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS, rv); break; default: NOTREACHED() << "bad state"; |