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

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 6592027: Update NetLog in preparation for late binding of HttpStream jobs to requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits. Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_stream_factory_impl_job.h ('k') | net/http/http_stream_factory_impl_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_stream_factory_impl_job.h" 5 #include "net/http/http_stream_factory_impl_job.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/values.h"
12 #include "net/base/connection_type_histograms.h" 13 #include "net/base/connection_type_histograms.h"
13 #include "net/base/net_log.h" 14 #include "net/base/net_log.h"
14 #include "net/base/net_util.h" 15 #include "net/base/net_util.h"
15 #include "net/base/ssl_cert_request_info.h" 16 #include "net/base/ssl_cert_request_info.h"
16 #include "net/http/http_basic_stream.h" 17 #include "net/http/http_basic_stream.h"
17 #include "net/http/http_network_session.h" 18 #include "net/http/http_network_session.h"
18 #include "net/http/http_proxy_client_socket.h" 19 #include "net/http/http_proxy_client_socket.h"
19 #include "net/http/http_proxy_client_socket_pool.h" 20 #include "net/http/http_proxy_client_socket_pool.h"
20 #include "net/http/http_request_info.h" 21 #include "net/http/http_request_info.h"
21 #include "net/http/http_stream_factory_impl_request.h" 22 #include "net/http/http_stream_factory_impl_request.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { 70 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
70 DCHECK(stream_factory); 71 DCHECK(stream_factory);
71 DCHECK(session); 72 DCHECK(session);
72 if (HttpStreamFactory::use_alternate_protocols()) 73 if (HttpStreamFactory::use_alternate_protocols())
73 alternate_protocol_mode_ = kUnspecified; 74 alternate_protocol_mode_ = kUnspecified;
74 else 75 else
75 alternate_protocol_mode_ = kDoNotUseAlternateProtocol; 76 alternate_protocol_mode_ = kDoNotUseAlternateProtocol;
76 } 77 }
77 78
78 HttpStreamFactoryImpl::Job::~Job() { 79 HttpStreamFactoryImpl::Job::~Job() {
80 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_JOB, NULL);
81
79 // When we're in a partially constructed state, waiting for the user to 82 // When we're in a partially constructed state, waiting for the user to
80 // provide certificate handling information or authentication, we can't reuse 83 // provide certificate handling information or authentication, we can't reuse
81 // this stream at all. 84 // this stream at all.
82 if (next_state_ == STATE_WAITING_USER_ACTION) { 85 if (next_state_ == STATE_WAITING_USER_ACTION) {
83 connection_->socket()->Disconnect(); 86 connection_->socket()->Disconnect();
84 connection_.reset(); 87 connection_.reset();
85 } 88 }
86 89
87 if (pac_request_) 90 if (pac_request_)
88 session_->proxy_service()->CancelPacRequest(pac_request_); 91 session_->proxy_service()->CancelPacRequest(pac_request_);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DCHECK(connection_.get() && connection_->socket()); 160 DCHECK(connection_.get() && connection_->socket());
158 SSLClientSocket* ssl_socket = 161 SSLClientSocket* ssl_socket =
159 static_cast<SSLClientSocket*>(connection_->socket()); 162 static_cast<SSLClientSocket*>(connection_->socket());
160 ssl_socket->GetSSLInfo(&ssl_info_); 163 ssl_socket->GetSSLInfo(&ssl_info_);
161 } 164 }
162 165
163 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { 166 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() {
164 DCHECK(stream_.get()); 167 DCHECK(stream_.get());
165 request_->Complete(was_alternate_protocol_available(), 168 request_->Complete(was_alternate_protocol_available(),
166 was_npn_negotiated(), 169 was_npn_negotiated(),
167 using_spdy()); 170 using_spdy(),
171 net_log_.source());
168 request_->OnStreamReady(ssl_config_, proxy_info_, stream_.release()); 172 request_->OnStreamReady(ssl_config_, proxy_info_, stream_.release());
169 // |this| may be deleted after this call. 173 // |this| may be deleted after this call.
170 } 174 }
171 175
172 void HttpStreamFactoryImpl::Job::OnSpdySessionReadyCallback() { 176 void HttpStreamFactoryImpl::Job::OnSpdySessionReadyCallback() {
173 DCHECK(!stream_.get()); 177 DCHECK(!stream_.get());
174 DCHECK(using_spdy()); 178 DCHECK(using_spdy());
175 DCHECK(new_spdy_session_); 179 DCHECK(new_spdy_session_);
176 scoped_refptr<SpdySession> spdy_session = new_spdy_session_; 180 scoped_refptr<SpdySession> spdy_session = new_spdy_session_;
177 new_spdy_session_ = NULL; 181 new_spdy_session_ = NULL;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 return rv; 372 return rv;
369 } 373 }
370 374
371 int HttpStreamFactoryImpl::Job::StartInternal( 375 int HttpStreamFactoryImpl::Job::StartInternal(
372 const HttpRequestInfo& request_info, 376 const HttpRequestInfo& request_info,
373 const SSLConfig& ssl_config, 377 const SSLConfig& ssl_config,
374 const BoundNetLog& net_log) { 378 const BoundNetLog& net_log) {
375 CHECK_EQ(STATE_NONE, next_state_); 379 CHECK_EQ(STATE_NONE, next_state_);
376 request_info_ = request_info; 380 request_info_ = request_info;
377 ssl_config_ = ssl_config; 381 ssl_config_ = ssl_config;
378 net_log_ = net_log; 382 net_log_ = BoundNetLog::Make(net_log.net_log(),
383 NetLog::SOURCE_HTTP_STREAM_JOB);
384 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB,
385 make_scoped_refptr(new NetLogStringParameter(
386 "url", request_info.url.GetOrigin().spec())));
379 next_state_ = STATE_RESOLVE_PROXY; 387 next_state_ = STATE_RESOLVE_PROXY;
380 int rv = RunLoop(OK); 388 int rv = RunLoop(OK);
381 DCHECK_EQ(ERR_IO_PENDING, rv); 389 DCHECK_EQ(ERR_IO_PENDING, rv);
382 return rv; 390 return rv;
383 } 391 }
384 392
385 int HttpStreamFactoryImpl::Job::DoResolveProxy() { 393 int HttpStreamFactoryImpl::Job::DoResolveProxy() {
386 DCHECK(!pac_request_); 394 DCHECK(!pac_request_);
387 395
388 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; 396 next_state_ = STATE_RESOLVE_PROXY_COMPLETE;
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 break; 1128 break;
1121 } 1129 }
1122 } 1130 }
1123 1131
1124 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const { 1132 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const {
1125 DCHECK_GE(num_streams_, 0); 1133 DCHECK_GE(num_streams_, 0);
1126 return num_streams_ > 0; 1134 return num_streams_ > 0;
1127 } 1135 }
1128 1136
1129 } // namespace net 1137 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.h ('k') | net/http/http_stream_factory_impl_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698