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

Unified Diff: net/http/http_network_transaction.cc

Issue 848006: Generalize the net module's LoadLog facility from a passive container, to an event stream (NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Split up RequestTracker into ConnectJobTracker+RequestTracker+RequestTrackerBase, address comments Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction.cc
===================================================================
--- net/http/http_network_transaction.cc (revision 41560)
+++ net/http/http_network_transaction.cc (working copy)
@@ -240,10 +240,10 @@
int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info,
CompletionCallback* callback,
- LoadLog* load_log) {
+ const BoundNetLog& net_log) {
SIMPLE_STATS_COUNTER("HttpNetworkTransaction.Count");
- load_log_ = load_log;
+ net_log_ = net_log;
request_ = request_info;
start_time_ = base::Time::Now();
@@ -542,97 +542,83 @@
case STATE_SEND_REQUEST:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.send_request", request_, request_->url.spec());
- LoadLog::BeginEvent(load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST);
rv = DoSendRequest();
break;
case STATE_SEND_REQUEST_COMPLETE:
rv = DoSendRequestComplete(rv);
TRACE_EVENT_END("http.send_request", request_, request_->url.spec());
- LoadLog::EndEvent(load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST);
break;
case STATE_READ_HEADERS:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec());
- LoadLog::BeginEvent(load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_READ_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS);
rv = DoReadHeaders();
break;
case STATE_READ_HEADERS_COMPLETE:
rv = DoReadHeadersComplete(rv);
TRACE_EVENT_END("http.read_headers", request_, request_->url.spec());
- LoadLog::EndEvent(load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_READ_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS);
break;
case STATE_READ_BODY:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_body", request_, request_->url.spec());
- LoadLog::BeginEvent(load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY);
rv = DoReadBody();
break;
case STATE_READ_BODY_COMPLETE:
rv = DoReadBodyComplete(rv);
TRACE_EVENT_END("http.read_body", request_, request_->url.spec());
- LoadLog::EndEvent(load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY);
+ net_log_.EndEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY);
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());
- LoadLog::BeginEvent(
- load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART);
+ net_log_.BeginEvent(
+ NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART);
rv = DoDrainBodyForAuthRestart();
break;
case STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE:
rv = DoDrainBodyForAuthRestartComplete(rv);
TRACE_EVENT_END("http.drain_body_for_auth_restart",
request_, request_->url.spec());
- LoadLog::EndEvent(
- load_log_,
- LoadLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART);
+ net_log_.EndEvent(
+ NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART);
break;
case STATE_SPDY_SEND_REQUEST:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.send_request", request_, request_->url.spec());
- LoadLog::BeginEvent(load_log_,
- LoadLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
rv = DoSpdySendRequest();
break;
case STATE_SPDY_SEND_REQUEST_COMPLETE:
rv = DoSpdySendRequestComplete(rv);
TRACE_EVENT_END("http.send_request", request_, request_->url.spec());
- LoadLog::EndEvent(load_log_,
- LoadLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST);
break;
case STATE_SPDY_READ_HEADERS:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec());
- LoadLog::BeginEvent(load_log_,
- LoadLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
rv = DoSpdyReadHeaders();
break;
case STATE_SPDY_READ_HEADERS_COMPLETE:
rv = DoSpdyReadHeadersComplete(rv);
TRACE_EVENT_END("http.read_headers", request_, request_->url.spec());
- LoadLog::EndEvent(load_log_,
- LoadLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS);
break;
case STATE_SPDY_READ_BODY:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.read_body", request_, request_->url.spec());
- LoadLog::BeginEvent(load_log_,
- LoadLog::TYPE_SPDY_TRANSACTION_READ_BODY);
+ net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY);
rv = DoSpdyReadBody();
break;
case STATE_SPDY_READ_BODY_COMPLETE:
rv = DoSpdyReadBodyComplete(rv);
TRACE_EVENT_END("http.read_body", request_, request_->url.spec());
- LoadLog::EndEvent(load_log_,
- LoadLog::TYPE_SPDY_TRANSACTION_READ_BODY);
+ net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY);
break;
default:
NOTREACHED() << "bad state";
@@ -655,7 +641,7 @@
}
return session_->proxy_service()->ResolveProxy(
- request_->url, &proxy_info_, &io_callback_, &pac_request_, load_log_);
+ request_->url, &proxy_info_, &io_callback_, &pac_request_, net_log_);
}
int HttpNetworkTransaction::DoResolveProxyComplete(int result) {
@@ -761,7 +747,7 @@
int rv = connection_->Init(connection_group, tcp_params, request_->priority,
&io_callback_, session_->tcp_socket_pool(),
- load_log_);
+ net_log_);
return rv;
}
@@ -827,7 +813,7 @@
else
s = new SOCKSClientSocket(s, req_info, session_->host_resolver());
connection_->set_socket(s);
- return connection_->socket()->Connect(&io_callback_, load_log_);
+ return connection_->socket()->Connect(&io_callback_, net_log_);
}
int HttpNetworkTransaction::DoSOCKSConnectComplete(int result) {
@@ -858,7 +844,7 @@
s = session_->socket_factory()->CreateSSLClientSocket(
s, request_->url.HostNoBrackets(), ssl_config_);
connection_->set_socket(s);
- return connection_->socket()->Connect(&io_callback_, load_log_);
+ return connection_->socket()->Connect(&io_callback_, net_log_);
}
int HttpNetworkTransaction::DoSSLConnectComplete(int result) {
@@ -969,7 +955,7 @@
}
headers_valid_ = false;
- http_stream_.reset(new HttpBasicStream(connection_.get(), load_log_));
+ http_stream_.reset(new HttpBasicStream(connection_.get(), net_log_));
return http_stream_->SendRequest(request_, request_headers_,
request_body, &response_, &io_callback_);
@@ -1069,7 +1055,7 @@
next_state_ = STATE_SSL_CONNECT;
// Reset for the real request and response headers.
request_headers_.clear();
- http_stream_.reset(new HttpBasicStream(connection_.get(), load_log_));
+ http_stream_.reset(new HttpBasicStream(connection_.get(), net_log_));
headers_valid_ = false;
establishing_tunnel_ = false;
return OK;
@@ -1235,7 +1221,7 @@
new UploadDataStream(request_->upload_data) : NULL;
headers_valid_ = false;
spdy_stream_ = spdy_session->GetOrCreateStream(
- *request_, upload_data, load_log_);
+ *request_, upload_data, net_log_);
return spdy_stream_->SendRequest(upload_data, &response_, &io_callback_);
}
@@ -1621,7 +1607,7 @@
}
int rv = session_->proxy_service()->ReconsiderProxyAfterError(
- request_->url, &proxy_info_, &io_callback_, &pac_request_, load_log_);
+ request_->url, &proxy_info_, &io_callback_, &pac_request_, net_log_);
if (rv == OK || rv == ERR_IO_PENDING) {
// If the error was during connection setup, there is no socket to
// disconnect.
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698