| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "net/base/connection_type_histograms.h" | 18 #include "net/base/connection_type_histograms.h" |
| 19 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
| 20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| 21 #include "net/http/http_basic_stream.h" | 21 #include "net/http/http_basic_stream.h" |
| 22 #include "net/http/http_network_session.h" | 22 #include "net/http/http_network_session.h" |
| 23 #include "net/http/http_pipelined_connection.h" | |
| 24 #include "net/http/http_pipelined_host.h" | |
| 25 #include "net/http/http_pipelined_host_pool.h" | |
| 26 #include "net/http/http_pipelined_stream.h" | |
| 27 #include "net/http/http_proxy_client_socket.h" | 23 #include "net/http/http_proxy_client_socket.h" |
| 28 #include "net/http/http_proxy_client_socket_pool.h" | 24 #include "net/http/http_proxy_client_socket_pool.h" |
| 29 #include "net/http/http_request_info.h" | 25 #include "net/http/http_request_info.h" |
| 30 #include "net/http/http_server_properties.h" | 26 #include "net/http/http_server_properties.h" |
| 31 #include "net/http/http_stream_factory.h" | 27 #include "net/http/http_stream_factory.h" |
| 32 #include "net/http/http_stream_factory_impl_request.h" | 28 #include "net/http/http_stream_factory_impl_request.h" |
| 33 #include "net/quic/quic_http_stream.h" | 29 #include "net/quic/quic_http_stream.h" |
| 34 #include "net/socket/client_socket_handle.h" | 30 #include "net/socket/client_socket_handle.h" |
| 35 #include "net/socket/client_socket_pool.h" | 31 #include "net/socket/client_socket_pool.h" |
| 36 #include "net/socket/client_socket_pool_manager.h" | 32 #include "net/socket/client_socket_pool_manager.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 using_spdy_(false), | 94 using_spdy_(false), |
| 99 using_quic_(false), | 95 using_quic_(false), |
| 100 quic_request_(session_->quic_stream_factory()), | 96 quic_request_(session_->quic_stream_factory()), |
| 101 using_existing_quic_session_(false), | 97 using_existing_quic_session_(false), |
| 102 spdy_certificate_error_(OK), | 98 spdy_certificate_error_(OK), |
| 103 establishing_tunnel_(false), | 99 establishing_tunnel_(false), |
| 104 was_npn_negotiated_(false), | 100 was_npn_negotiated_(false), |
| 105 protocol_negotiated_(kProtoUnknown), | 101 protocol_negotiated_(kProtoUnknown), |
| 106 num_streams_(0), | 102 num_streams_(0), |
| 107 spdy_session_direct_(false), | 103 spdy_session_direct_(false), |
| 108 existing_available_pipeline_(false), | |
| 109 job_status_(STATUS_RUNNING), | 104 job_status_(STATUS_RUNNING), |
| 110 other_job_status_(STATUS_RUNNING), | 105 other_job_status_(STATUS_RUNNING), |
| 111 ptr_factory_(this) { | 106 ptr_factory_(this) { |
| 112 DCHECK(stream_factory); | 107 DCHECK(stream_factory); |
| 113 DCHECK(session); | 108 DCHECK(session); |
| 114 } | 109 } |
| 115 | 110 |
| 116 HttpStreamFactoryImpl::Job::~Job() { | 111 HttpStreamFactoryImpl::Job::~Job() { |
| 117 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_JOB); | 112 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_JOB); |
| 118 | 113 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 int rv = RunLoop(OK); | 611 int rv = RunLoop(OK); |
| 617 DCHECK_EQ(ERR_IO_PENDING, rv); | 612 DCHECK_EQ(ERR_IO_PENDING, rv); |
| 618 return rv; | 613 return rv; |
| 619 } | 614 } |
| 620 | 615 |
| 621 int HttpStreamFactoryImpl::Job::DoStart() { | 616 int HttpStreamFactoryImpl::Job::DoStart() { |
| 622 int port = request_info_.url.EffectiveIntPort(); | 617 int port = request_info_.url.EffectiveIntPort(); |
| 623 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); | 618 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); |
| 624 origin_url_ = stream_factory_->ApplyHostMappingRules( | 619 origin_url_ = stream_factory_->ApplyHostMappingRules( |
| 625 request_info_.url, &origin_); | 620 request_info_.url, &origin_); |
| 626 http_pipelining_key_.reset(new HttpPipelinedHost::Key(origin_)); | |
| 627 | 621 |
| 628 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, | 622 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, |
| 629 base::Bind(&NetLogHttpStreamJobCallback, | 623 base::Bind(&NetLogHttpStreamJobCallback, |
| 630 &request_info_.url, &origin_url_, | 624 &request_info_.url, &origin_url_, |
| 631 priority_)); | 625 priority_)); |
| 632 | 626 |
| 633 // Don't connect to restricted ports. | 627 // Don't connect to restricted ports. |
| 634 bool is_port_allowed = IsPortAllowedByDefault(port); | 628 bool is_port_allowed = IsPortAllowedByDefault(port); |
| 635 if (request_info_.url.SchemeIs("ftp")) { | 629 if (request_info_.url.SchemeIs("ftp")) { |
| 636 // Never share connection with other jobs for FTP requests. | 630 // Never share connection with other jobs for FTP requests. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 // actually need to preconnect any sockets, so we're done. | 780 // actually need to preconnect any sockets, so we're done. |
| 787 if (IsPreconnecting()) | 781 if (IsPreconnecting()) |
| 788 return OK; | 782 return OK; |
| 789 using_spdy_ = true; | 783 using_spdy_ = true; |
| 790 next_state_ = STATE_CREATE_STREAM; | 784 next_state_ = STATE_CREATE_STREAM; |
| 791 existing_spdy_session_ = spdy_session; | 785 existing_spdy_session_ = spdy_session; |
| 792 return OK; | 786 return OK; |
| 793 } else if (request_ && (using_ssl_ || ShouldForceSpdyWithoutSSL())) { | 787 } else if (request_ && (using_ssl_ || ShouldForceSpdyWithoutSSL())) { |
| 794 // Update the spdy session key for the request that launched this job. | 788 // Update the spdy session key for the request that launched this job. |
| 795 request_->SetSpdySessionKey(spdy_session_key); | 789 request_->SetSpdySessionKey(spdy_session_key); |
| 796 } else if (IsRequestEligibleForPipelining()) { | |
| 797 // TODO(simonjam): With pipelining, we might be better off using fewer | |
| 798 // connections and thus should make fewer preconnections. Explore | |
| 799 // preconnecting fewer than the requested num_connections. | |
| 800 // | |
| 801 // Separate note: A forced pipeline is always available if one exists for | |
| 802 // this key. This is different than normal pipelines, which may be | |
| 803 // unavailable or unusable. So, there is no need to worry about a race | |
| 804 // between when a pipeline becomes available and when this job blocks. | |
| 805 existing_available_pipeline_ = stream_factory_->http_pipelined_host_pool_. | |
| 806 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get()); | |
| 807 if (existing_available_pipeline_) { | |
| 808 return OK; | |
| 809 } else { | |
| 810 bool was_new_key = request_->SetHttpPipeliningKey( | |
| 811 *http_pipelining_key_.get()); | |
| 812 if (!was_new_key && session_->force_http_pipelining()) { | |
| 813 return ERR_IO_PENDING; | |
| 814 } | |
| 815 } | |
| 816 } | 790 } |
| 817 | 791 |
| 818 // OK, there's no available SPDY session. Let |waiting_job_| resume if it's | 792 // OK, there's no available SPDY session. Let |waiting_job_| resume if it's |
| 819 // paused. | 793 // paused. |
| 820 | 794 |
| 821 if (waiting_job_) { | 795 if (waiting_job_) { |
| 822 waiting_job_->Resume(this); | 796 waiting_job_->Resume(this); |
| 823 waiting_job_ = NULL; | 797 waiting_job_ = NULL; |
| 824 } | 798 } |
| 825 | 799 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 return OK; | 884 return OK; |
| 911 } | 885 } |
| 912 | 886 |
| 913 // TODO(willchan): Make this a bit more exact. Maybe there are recoverable | 887 // TODO(willchan): Make this a bit more exact. Maybe there are recoverable |
| 914 // errors, such as ignoring certificate errors for Alternate-Protocol. | 888 // errors, such as ignoring certificate errors for Alternate-Protocol. |
| 915 if (result < 0 && waiting_job_) { | 889 if (result < 0 && waiting_job_) { |
| 916 waiting_job_->Resume(this); | 890 waiting_job_->Resume(this); |
| 917 waiting_job_ = NULL; | 891 waiting_job_ = NULL; |
| 918 } | 892 } |
| 919 | 893 |
| 920 if (result < 0 && session_->force_http_pipelining()) { | |
| 921 stream_factory_->AbortPipelinedRequestsWithKey( | |
| 922 this, *http_pipelining_key_.get(), result, server_ssl_config_); | |
| 923 } | |
| 924 | |
| 925 // |result| may be the result of any of the stacked pools. The following | 894 // |result| may be the result of any of the stacked pools. The following |
| 926 // logic is used when determining how to interpret an error. | 895 // logic is used when determining how to interpret an error. |
| 927 // If |result| < 0: | 896 // If |result| < 0: |
| 928 // and connection_->socket() != NULL, then the SSL handshake ran and it | 897 // and connection_->socket() != NULL, then the SSL handshake ran and it |
| 929 // is a potentially recoverable error. | 898 // is a potentially recoverable error. |
| 930 // and connection_->socket == NULL and connection_->is_ssl_error() is true, | 899 // and connection_->socket == NULL and connection_->is_ssl_error() is true, |
| 931 // then the SSL handshake ran with an unrecoverable error. | 900 // then the SSL handshake ran with an unrecoverable error. |
| 932 // otherwise, the error came from one of the other pools. | 901 // otherwise, the error came from one of the other pools. |
| 933 bool ssl_started = using_ssl_ && (result == OK || connection_->socket() || | 902 bool ssl_started = using_ssl_ && (result == OK || connection_->socket() || |
| 934 connection_->is_ssl_error()); | 903 connection_->is_ssl_error()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 int HttpStreamFactoryImpl::Job::DoWaitingUserAction(int result) { | 1017 int HttpStreamFactoryImpl::Job::DoWaitingUserAction(int result) { |
| 1049 // This state indicates that the stream request is in a partially | 1018 // This state indicates that the stream request is in a partially |
| 1050 // completed state, and we've called back to the delegate for more | 1019 // completed state, and we've called back to the delegate for more |
| 1051 // information. | 1020 // information. |
| 1052 | 1021 |
| 1053 // We're always waiting here for the delegate to call us back. | 1022 // We're always waiting here for the delegate to call us back. |
| 1054 return ERR_IO_PENDING; | 1023 return ERR_IO_PENDING; |
| 1055 } | 1024 } |
| 1056 | 1025 |
| 1057 int HttpStreamFactoryImpl::Job::DoCreateStream() { | 1026 int HttpStreamFactoryImpl::Job::DoCreateStream() { |
| 1058 DCHECK(connection_->socket() || existing_spdy_session_.get() || | 1027 DCHECK(connection_->socket() || existing_spdy_session_.get() || using_quic_); |
| 1059 existing_available_pipeline_ || using_quic_); | |
| 1060 | 1028 |
| 1061 next_state_ = STATE_CREATE_STREAM_COMPLETE; | 1029 next_state_ = STATE_CREATE_STREAM_COMPLETE; |
| 1062 | 1030 |
| 1063 // We only set the socket motivation if we're the first to use | 1031 // We only set the socket motivation if we're the first to use |
| 1064 // this socket. Is there a race for two SPDY requests? We really | 1032 // this socket. Is there a race for two SPDY requests? We really |
| 1065 // need to plumb this through to the connect level. | 1033 // need to plumb this through to the connect level. |
| 1066 if (connection_->socket() && !connection_->is_reused()) | 1034 if (connection_->socket() && !connection_->is_reused()) |
| 1067 SetSocketMotivation(); | 1035 SetSocketMotivation(); |
| 1068 | 1036 |
| 1069 if (!using_spdy_) { | 1037 if (!using_spdy_) { |
| 1070 // We may get ftp scheme when fetching ftp resources through proxy. | 1038 // We may get ftp scheme when fetching ftp resources through proxy. |
| 1071 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && | 1039 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && |
| 1072 (request_info_.url.SchemeIs("http") || | 1040 (request_info_.url.SchemeIs("http") || |
| 1073 request_info_.url.SchemeIs("ftp")); | 1041 request_info_.url.SchemeIs("ftp")); |
| 1074 if (stream_factory_->http_pipelined_host_pool_. | 1042 if (stream_factory_->for_websockets_) { |
| 1075 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get())) { | |
| 1076 DCHECK(!stream_factory_->for_websockets_); | |
| 1077 stream_.reset(stream_factory_->http_pipelined_host_pool_. | |
| 1078 CreateStreamOnExistingPipeline( | |
| 1079 *http_pipelining_key_.get())); | |
| 1080 CHECK(stream_.get()); | |
| 1081 } else if (stream_factory_->for_websockets_) { | |
| 1082 DCHECK(request_); | 1043 DCHECK(request_); |
| 1083 DCHECK(request_->websocket_handshake_stream_create_helper()); | 1044 DCHECK(request_->websocket_handshake_stream_create_helper()); |
| 1084 websocket_stream_.reset( | 1045 websocket_stream_.reset( |
| 1085 request_->websocket_handshake_stream_create_helper() | 1046 request_->websocket_handshake_stream_create_helper() |
| 1086 ->CreateBasicStream(connection_.Pass(), using_proxy)); | 1047 ->CreateBasicStream(connection_.Pass(), using_proxy)); |
| 1087 } else if (!using_proxy && IsRequestEligibleForPipelining()) { | |
| 1088 // TODO(simonjam): Support proxies. | |
| 1089 stream_.reset( | |
| 1090 stream_factory_->http_pipelined_host_pool_.CreateStreamOnNewPipeline( | |
| 1091 *http_pipelining_key_.get(), | |
| 1092 connection_.release(), | |
| 1093 server_ssl_config_, | |
| 1094 proxy_info_, | |
| 1095 net_log_, | |
| 1096 was_npn_negotiated_, | |
| 1097 protocol_negotiated_)); | |
| 1098 CHECK(stream_.get()); | |
| 1099 } else { | 1048 } else { |
| 1100 stream_.reset(new HttpBasicStream(connection_.release(), using_proxy)); | 1049 stream_.reset(new HttpBasicStream(connection_.release(), using_proxy)); |
| 1101 } | 1050 } |
| 1102 return OK; | 1051 return OK; |
| 1103 } | 1052 } |
| 1104 | 1053 |
| 1105 CHECK(!stream_.get()); | 1054 CHECK(!stream_.get()); |
| 1106 | 1055 |
| 1107 bool direct = true; | 1056 bool direct = true; |
| 1108 const ProxyServer& proxy_server = proxy_info_.proxy_server(); | 1057 const ProxyServer& proxy_server = proxy_info_.proxy_server(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 | 1161 |
| 1213 return ReconsiderProxyAfterError(result); | 1162 return ReconsiderProxyAfterError(result); |
| 1214 } | 1163 } |
| 1215 | 1164 |
| 1216 void HttpStreamFactoryImpl::Job::ReturnToStateInitConnection( | 1165 void HttpStreamFactoryImpl::Job::ReturnToStateInitConnection( |
| 1217 bool close_connection) { | 1166 bool close_connection) { |
| 1218 if (close_connection && connection_->socket()) | 1167 if (close_connection && connection_->socket()) |
| 1219 connection_->socket()->Disconnect(); | 1168 connection_->socket()->Disconnect(); |
| 1220 connection_->Reset(); | 1169 connection_->Reset(); |
| 1221 | 1170 |
| 1222 if (request_) { | 1171 if (request_) |
| 1223 request_->RemoveRequestFromSpdySessionRequestMap(); | 1172 request_->RemoveRequestFromSpdySessionRequestMap(); |
| 1224 request_->RemoveRequestFromHttpPipeliningRequestMap(); | |
| 1225 } | |
| 1226 | 1173 |
| 1227 next_state_ = STATE_INIT_CONNECTION; | 1174 next_state_ = STATE_INIT_CONNECTION; |
| 1228 } | 1175 } |
| 1229 | 1176 |
| 1230 void HttpStreamFactoryImpl::Job::SetSocketMotivation() { | 1177 void HttpStreamFactoryImpl::Job::SetSocketMotivation() { |
| 1231 if (request_info_.motivation == HttpRequestInfo::PRECONNECT_MOTIVATED) | 1178 if (request_info_.motivation == HttpRequestInfo::PRECONNECT_MOTIVATED) |
| 1232 connection_->socket()->SetSubresourceSpeculation(); | 1179 connection_->socket()->SetSubresourceSpeculation(); |
| 1233 else if (request_info_.motivation == HttpRequestInfo::OMNIBOX_MOTIVATED) | 1180 else if (request_info_.motivation == HttpRequestInfo::OMNIBOX_MOTIVATED) |
| 1234 connection_->socket()->SetOmniboxSpeculation(); | 1181 connection_->socket()->SetOmniboxSpeculation(); |
| 1235 // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). | 1182 // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 } | 1314 } |
| 1368 | 1315 |
| 1369 int rv = session_->proxy_service()->ReconsiderProxyAfterError( | 1316 int rv = session_->proxy_service()->ReconsiderProxyAfterError( |
| 1370 request_info_.url, &proxy_info_, io_callback_, &pac_request_, net_log_); | 1317 request_info_.url, &proxy_info_, io_callback_, &pac_request_, net_log_); |
| 1371 if (rv == OK || rv == ERR_IO_PENDING) { | 1318 if (rv == OK || rv == ERR_IO_PENDING) { |
| 1372 // If the error was during connection setup, there is no socket to | 1319 // If the error was during connection setup, there is no socket to |
| 1373 // disconnect. | 1320 // disconnect. |
| 1374 if (connection_->socket()) | 1321 if (connection_->socket()) |
| 1375 connection_->socket()->Disconnect(); | 1322 connection_->socket()->Disconnect(); |
| 1376 connection_->Reset(); | 1323 connection_->Reset(); |
| 1377 if (request_) { | 1324 if (request_) |
| 1378 request_->RemoveRequestFromSpdySessionRequestMap(); | 1325 request_->RemoveRequestFromSpdySessionRequestMap(); |
| 1379 request_->RemoveRequestFromHttpPipeliningRequestMap(); | |
| 1380 } | |
| 1381 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; | 1326 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; |
| 1382 } else { | 1327 } else { |
| 1383 // If ReconsiderProxyAfterError() failed synchronously, it means | 1328 // If ReconsiderProxyAfterError() failed synchronously, it means |
| 1384 // there was nothing left to fall-back to, so fail the transaction | 1329 // there was nothing left to fall-back to, so fail the transaction |
| 1385 // with the last connection error we got. | 1330 // with the last connection error we got. |
| 1386 // TODO(eroman): This is a confusing contract, make it more obvious. | 1331 // TODO(eroman): This is a confusing contract, make it more obvious. |
| 1387 rv = error; | 1332 rv = error; |
| 1388 } | 1333 } |
| 1389 | 1334 |
| 1390 return rv; | 1335 return rv; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 alternate_protocol_experiment); | 1441 alternate_protocol_experiment); |
| 1497 } | 1442 } |
| 1498 } | 1443 } |
| 1499 | 1444 |
| 1500 void HttpStreamFactoryImpl::Job::MarkOtherJobComplete(const Job& job) { | 1445 void HttpStreamFactoryImpl::Job::MarkOtherJobComplete(const Job& job) { |
| 1501 DCHECK_EQ(STATUS_RUNNING, other_job_status_); | 1446 DCHECK_EQ(STATUS_RUNNING, other_job_status_); |
| 1502 other_job_status_ = job.job_status_; | 1447 other_job_status_ = job.job_status_; |
| 1503 MaybeMarkAlternateProtocolBroken(); | 1448 MaybeMarkAlternateProtocolBroken(); |
| 1504 } | 1449 } |
| 1505 | 1450 |
| 1506 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() { | |
| 1507 if (IsPreconnecting() || !request_) { | |
| 1508 return false; | |
| 1509 } | |
| 1510 if (stream_factory_->for_websockets_) { | |
| 1511 return false; | |
| 1512 } | |
| 1513 if (session_->force_http_pipelining()) { | |
| 1514 return true; | |
| 1515 } | |
| 1516 if (!session_->params().http_pipelining_enabled) { | |
| 1517 return false; | |
| 1518 } | |
| 1519 if (using_ssl_) { | |
| 1520 return false; | |
| 1521 } | |
| 1522 if (request_info_.method != "GET" && request_info_.method != "HEAD") { | |
| 1523 return false; | |
| 1524 } | |
| 1525 if (request_info_.load_flags & | |
| 1526 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | | |
| 1527 net::LOAD_IS_DOWNLOAD)) { | |
| 1528 // Avoid pipelining resources that may be streamed for a long time. | |
| 1529 return false; | |
| 1530 } | |
| 1531 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | |
| 1532 *http_pipelining_key_.get()); | |
| 1533 } | |
| 1534 | |
| 1535 void HttpStreamFactoryImpl::Job::MaybeMarkAlternateProtocolBroken() { | 1451 void HttpStreamFactoryImpl::Job::MaybeMarkAlternateProtocolBroken() { |
| 1536 if (job_status_ == STATUS_RUNNING || other_job_status_ == STATUS_RUNNING) | 1452 if (job_status_ == STATUS_RUNNING || other_job_status_ == STATUS_RUNNING) |
| 1537 return; | 1453 return; |
| 1538 | 1454 |
| 1539 bool is_alternate_protocol_job = original_url_.get() != NULL; | 1455 bool is_alternate_protocol_job = original_url_.get() != NULL; |
| 1540 if (is_alternate_protocol_job) { | 1456 if (is_alternate_protocol_job) { |
| 1541 if (job_status_ == STATUS_BROKEN && other_job_status_ == STATUS_SUCCEEDED) { | 1457 if (job_status_ == STATUS_BROKEN && other_job_status_ == STATUS_SUCCEEDED) { |
| 1542 HistogramBrokenAlternateProtocolLocation( | 1458 HistogramBrokenAlternateProtocolLocation( |
| 1543 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); | 1459 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); |
| 1544 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1460 session_->http_server_properties()->SetBrokenAlternateProtocol( |
| 1545 HostPortPair::FromURL(*original_url_)); | 1461 HostPortPair::FromURL(*original_url_)); |
| 1546 } | 1462 } |
| 1547 return; | 1463 return; |
| 1548 } | 1464 } |
| 1549 | 1465 |
| 1550 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1466 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
| 1551 HistogramBrokenAlternateProtocolLocation( | 1467 HistogramBrokenAlternateProtocolLocation( |
| 1552 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1468 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
| 1553 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1469 session_->http_server_properties()->SetBrokenAlternateProtocol( |
| 1554 HostPortPair::FromURL(request_info_.url)); | 1470 HostPortPair::FromURL(request_info_.url)); |
| 1555 } | 1471 } |
| 1556 } | 1472 } |
| 1557 | 1473 |
| 1558 } // namespace net | 1474 } // namespace net |
| OLD | NEW |