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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 // Disable revocation checking for HTTPS proxies since the revocation | 759 // Disable revocation checking for HTTPS proxies since the revocation |
760 // requests are probably going to need to go through the proxy too. | 760 // requests are probably going to need to go through the proxy too. |
761 proxy_ssl_config_.rev_checking_enabled = false; | 761 proxy_ssl_config_.rev_checking_enabled = false; |
762 } | 762 } |
763 if (using_ssl_) { | 763 if (using_ssl_) { |
764 InitSSLConfig(origin_, &server_ssl_config_, | 764 InitSSLConfig(origin_, &server_ssl_config_, |
765 false /* not a proxy server */); | 765 false /* not a proxy server */); |
766 } | 766 } |
767 | 767 |
768 if (IsPreconnecting()) { | 768 if (IsPreconnecting()) { |
769 return PreconnectSocketsForHttpRequest( | 769 HttpRequestInfo::RequestMotivation motivation = request_info_.motivation; |
770 origin_url_, | 770 if(motivation == HttpRequestInfo::MOUSE_OVER_MOTIVATED || |
771 request_info_.extra_headers, | 771 motivation == HttpRequestInfo::MOUSE_DOWN_MOTIVATED || |
772 request_info_.load_flags, | 772 motivation == HttpRequestInfo::TAP_UNCONFIRMED_MOTIVATED || |
773 priority_, | 773 motivation == HttpRequestInfo::TAP_DOWN_MOTIVATED) { |
mmenke
2013/05/01 16:55:08
Different behaviors based on motivation really doe
| |
774 session_, | 774 int would_have_been_connected = |
775 proxy_info_, | 775 PretendToPreconnectSocketsForHttpRequest( |
776 ShouldForceSpdySSL(), | 776 origin_url_, |
777 want_spdy_over_npn, | 777 request_info_.extra_headers, |
778 server_ssl_config_, | 778 request_info_.load_flags, |
779 proxy_ssl_config_, | 779 priority_, |
780 net_log_, | 780 session_, |
781 num_streams_); | 781 proxy_info_, |
782 ShouldForceSpdySSL(), | |
783 want_spdy_over_npn, | |
784 server_ssl_config_, | |
785 proxy_ssl_config_, | |
786 net_log_, | |
787 num_streams_); | |
788 int key = motivation * 2 + (would_have_been_connected > 0 ? 1 : 0); | |
789 UMA_HISTOGRAM_ENUMERATION("Net.PretendToPreconnect", | |
790 key, HttpRequestInfo::MAX_MOTIVATED * 2); | |
791 return OK; | |
792 } else | |
793 return PreconnectSocketsForHttpRequest( | |
794 origin_url_, | |
795 request_info_.extra_headers, | |
796 request_info_.load_flags, | |
797 priority_, | |
798 session_, | |
799 proxy_info_, | |
800 ShouldForceSpdySSL(), | |
801 want_spdy_over_npn, | |
802 server_ssl_config_, | |
803 proxy_ssl_config_, | |
804 net_log_, | |
805 num_streams_); | |
782 } else { | 806 } else { |
783 // If we can't use a SPDY session, don't both checking for one after | 807 // If we can't use a SPDY session, don't both checking for one after |
784 // the hostname is resolved. | 808 // the hostname is resolved. |
785 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? | 809 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? |
786 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), | 810 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), |
787 GetSpdySessionKey()) : | 811 GetSpdySessionKey()) : |
788 OnHostResolutionCallback(); | 812 OnHostResolutionCallback(); |
789 return InitSocketHandleForHttpRequest( | 813 return InitSocketHandleForHttpRequest( |
790 origin_url_, request_info_.extra_headers, request_info_.load_flags, | 814 origin_url_, request_info_.extra_headers, request_info_.load_flags, |
791 priority_, session_, proxy_info_, ShouldForceSpdySSL(), | 815 priority_, session_, proxy_info_, ShouldForceSpdySSL(), |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1355 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | | 1379 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | |
1356 net::LOAD_IS_DOWNLOAD)) { | 1380 net::LOAD_IS_DOWNLOAD)) { |
1357 // Avoid pipelining resources that may be streamed for a long time. | 1381 // Avoid pipelining resources that may be streamed for a long time. |
1358 return false; | 1382 return false; |
1359 } | 1383 } |
1360 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | 1384 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( |
1361 *http_pipelining_key_.get()); | 1385 *http_pipelining_key_.get()); |
1362 } | 1386 } |
1363 | 1387 |
1364 } // namespace net | 1388 } // namespace net |
OLD | NEW |