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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 // this socket. Is there a race for two SPDY requests? We really | 895 // this socket. Is there a race for two SPDY requests? We really |
896 // need to plumb this through to the connect level. | 896 // need to plumb this through to the connect level. |
897 if (connection_->socket() && !connection_->is_reused()) | 897 if (connection_->socket() && !connection_->is_reused()) |
898 SetSocketMotivation(); | 898 SetSocketMotivation(); |
899 | 899 |
900 const ProxyServer& proxy_server = proxy_info_.proxy_server(); | 900 const ProxyServer& proxy_server = proxy_info_.proxy_server(); |
901 | 901 |
902 if (!using_spdy_) { | 902 if (!using_spdy_) { |
903 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && | 903 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && |
904 request_info_.url.SchemeIs("http"); | 904 request_info_.url.SchemeIs("http"); |
905 // TODO(simonjam): Support proxies. | |
906 if (stream_factory_->http_pipelined_host_pool_. | 905 if (stream_factory_->http_pipelined_host_pool_. |
907 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get())) { | 906 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get())) { |
908 stream_.reset(stream_factory_->http_pipelined_host_pool_. | 907 stream_.reset(stream_factory_->http_pipelined_host_pool_. |
909 CreateStreamOnExistingPipeline( | 908 CreateStreamOnExistingPipeline( |
910 *http_pipelining_key_.get())); | 909 *http_pipelining_key_.get())); |
911 CHECK(stream_.get()); | 910 CHECK(stream_.get()); |
912 } else if (!using_proxy && IsRequestEligibleForPipelining()) { | 911 } else if (!using_proxy && IsRequestEligibleForPipelining()) { |
| 912 // TODO(simonjam): Support proxies. |
913 stream_.reset( | 913 stream_.reset( |
914 stream_factory_->http_pipelined_host_pool_.CreateStreamOnNewPipeline( | 914 stream_factory_->http_pipelined_host_pool_.CreateStreamOnNewPipeline( |
915 *http_pipelining_key_.get(), | 915 *http_pipelining_key_.get(), |
916 connection_.release(), | 916 connection_.release(), |
917 server_ssl_config_, | 917 server_ssl_config_, |
918 proxy_info_, | 918 proxy_info_, |
919 net_log_, | 919 net_log_, |
920 was_npn_negotiated_, | 920 was_npn_negotiated_, |
921 protocol_negotiated_)); | 921 protocol_negotiated_)); |
922 CHECK(stream_.get()); | 922 CHECK(stream_.get()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 } | 1239 } |
1240 if (!HttpStreamFactory::http_pipelining_enabled()) { | 1240 if (!HttpStreamFactory::http_pipelining_enabled()) { |
1241 return false; | 1241 return false; |
1242 } | 1242 } |
1243 if (using_ssl_) { | 1243 if (using_ssl_) { |
1244 return false; | 1244 return false; |
1245 } | 1245 } |
1246 if (request_info_.method != "GET" && request_info_.method != "HEAD") { | 1246 if (request_info_.method != "GET" && request_info_.method != "HEAD") { |
1247 return false; | 1247 return false; |
1248 } | 1248 } |
| 1249 if (request_info_.load_flags & |
| 1250 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | |
| 1251 net::LOAD_IS_DOWNLOAD)) { |
| 1252 // Avoid pipelining resources that may be streamed for a long time. |
| 1253 return false; |
| 1254 } |
1249 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | 1255 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( |
1250 *http_pipelining_key_.get()); | 1256 *http_pipelining_key_.get()); |
1251 } | 1257 } |
1252 | 1258 |
1253 } // namespace net | 1259 } // namespace net |
OLD | NEW |