| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void HttpStreamFactoryImpl::Job::Start(Request* request) { | 249 void HttpStreamFactoryImpl::Job::Start(Request* request) { |
| 250 DCHECK(request); | 250 DCHECK(request); |
| 251 request_ = request; | 251 request_ = request; |
| 252 // Saves |stream_type_|, since request is nulled when job is orphaned. | 252 // Saves |stream_type_|, since request is nulled when job is orphaned. |
| 253 stream_type_ = request_->stream_type(); | 253 stream_type_ = request_->stream_type(); |
| 254 StartInternal(); | 254 StartInternal(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) { | 257 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) { |
| 258 DCHECK_GT(num_streams, 0); | 258 DCHECK_GT(num_streams, 0); |
| 259 base::WeakPtr<HttpServerProperties> http_server_properties = | 259 HttpServerProperties* http_server_properties = |
| 260 session_->http_server_properties(); | 260 session_->http_server_properties(); |
| 261 if (http_server_properties && | 261 if (http_server_properties && |
| 262 http_server_properties->SupportsRequestPriority( | 262 http_server_properties->SupportsRequestPriority( |
| 263 url::SchemeHostPort(request_info_.url))) { | 263 url::SchemeHostPort(request_info_.url))) { |
| 264 num_streams_ = 1; | 264 num_streams_ = 1; |
| 265 } else { | 265 } else { |
| 266 num_streams_ = num_streams; | 266 num_streams_ = num_streams; |
| 267 } | 267 } |
| 268 return StartInternal(); | 268 return StartInternal(); |
| 269 } | 269 } |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 if (waiting_job_) { | 1069 if (waiting_job_) { |
| 1070 waiting_job_->Resume(this, base::TimeDelta()); | 1070 waiting_job_->Resume(this, base::TimeDelta()); |
| 1071 waiting_job_ = NULL; | 1071 waiting_job_ = NULL; |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 if (proxy_info_.is_http() || proxy_info_.is_https()) | 1074 if (proxy_info_.is_http() || proxy_info_.is_https()) |
| 1075 establishing_tunnel_ = using_ssl_; | 1075 establishing_tunnel_ = using_ssl_; |
| 1076 | 1076 |
| 1077 const bool expect_spdy = IsSpdyAlternative(); | 1077 const bool expect_spdy = IsSpdyAlternative(); |
| 1078 | 1078 |
| 1079 base::WeakPtr<HttpServerProperties> http_server_properties = | 1079 HttpServerProperties* http_server_properties = |
| 1080 session_->http_server_properties(); | 1080 session_->http_server_properties(); |
| 1081 if (http_server_properties) { | 1081 if (http_server_properties) { |
| 1082 http_server_properties->MaybeForceHTTP11(destination_, &server_ssl_config_); | 1082 http_server_properties->MaybeForceHTTP11(destination_, &server_ssl_config_); |
| 1083 if (proxy_info_.is_http() || proxy_info_.is_https()) { | 1083 if (proxy_info_.is_http() || proxy_info_.is_https()) { |
| 1084 http_server_properties->MaybeForceHTTP11( | 1084 http_server_properties->MaybeForceHTTP11( |
| 1085 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_); | 1085 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_); |
| 1086 } | 1086 } |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 if (IsPreconnecting()) { | 1089 if (IsPreconnecting()) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 } | 1420 } |
| 1421 | 1421 |
| 1422 new_spdy_session_ = spdy_session; | 1422 new_spdy_session_ = spdy_session; |
| 1423 spdy_session_direct_ = direct; | 1423 spdy_session_direct_ = direct; |
| 1424 const HostPortPair host_port_pair = spdy_session_key.host_port_pair(); | 1424 const HostPortPair host_port_pair = spdy_session_key.host_port_pair(); |
| 1425 bool is_https = ssl_info.is_valid(); | 1425 bool is_https = ssl_info.is_valid(); |
| 1426 url::SchemeHostPort scheme_host_port(is_https ? "https" : "http", | 1426 url::SchemeHostPort scheme_host_port(is_https ? "https" : "http", |
| 1427 host_port_pair.host(), | 1427 host_port_pair.host(), |
| 1428 host_port_pair.port()); | 1428 host_port_pair.port()); |
| 1429 | 1429 |
| 1430 base::WeakPtr<HttpServerProperties> http_server_properties = | 1430 HttpServerProperties* http_server_properties = |
| 1431 session_->http_server_properties(); | 1431 session_->http_server_properties(); |
| 1432 if (http_server_properties) | 1432 if (http_server_properties) |
| 1433 http_server_properties->SetSupportsSpdy(scheme_host_port, true); | 1433 http_server_properties->SetSupportsSpdy(scheme_host_port, true); |
| 1434 | 1434 |
| 1435 // Create a SpdyHttpStream or a BidirectionalStreamImpl attached to the | 1435 // Create a SpdyHttpStream or a BidirectionalStreamImpl attached to the |
| 1436 // session; OnNewSpdySessionReadyCallback is not called until an event loop | 1436 // session; OnNewSpdySessionReadyCallback is not called until an event loop |
| 1437 // iteration later, so if the SpdySession is closed between then, allow | 1437 // iteration later, so if the SpdySession is closed between then, allow |
| 1438 // reuse state from the underlying socket, sampled by SpdyHttpStream, | 1438 // reuse state from the underlying socket, sampled by SpdyHttpStream, |
| 1439 // bubble up to the request. | 1439 // bubble up to the request. |
| 1440 return SetSpdyHttpStreamOrBidirectionalStreamImpl(new_spdy_session_, | 1440 return SetSpdyHttpStreamOrBidirectionalStreamImpl(new_spdy_session_, |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 if (connection_->socket()) { | 1803 if (connection_->socket()) { |
| 1804 ConnectionAttempts socket_attempts; | 1804 ConnectionAttempts socket_attempts; |
| 1805 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1805 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1806 request_->AddConnectionAttempts(socket_attempts); | 1806 request_->AddConnectionAttempts(socket_attempts); |
| 1807 } else { | 1807 } else { |
| 1808 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1808 request_->AddConnectionAttempts(connection_->connection_attempts()); |
| 1809 } | 1809 } |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 } // namespace net | 1812 } // namespace net |
| OLD | NEW |