Chromium Code Reviews| 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" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 dict->SetString("proto", *proto); | 83 dict->SetString("proto", *proto); |
| 84 return dict.Pass(); | 84 return dict.Pass(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, | 87 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, |
| 88 HttpNetworkSession* session, | 88 HttpNetworkSession* session, |
| 89 const HttpRequestInfo& request_info, | 89 const HttpRequestInfo& request_info, |
| 90 RequestPriority priority, | 90 RequestPriority priority, |
| 91 const SSLConfig& server_ssl_config, | 91 const SSLConfig& server_ssl_config, |
| 92 const SSLConfig& proxy_ssl_config, | 92 const SSLConfig& proxy_ssl_config, |
| 93 HostPortPair server, | |
| 94 GURL origin_url, | |
| 93 NetLog* net_log) | 95 NetLog* net_log) |
| 94 : Job(stream_factory, | 96 : Job(stream_factory, |
| 95 session, | 97 session, |
| 96 request_info, | 98 request_info, |
| 97 priority, | 99 priority, |
| 98 server_ssl_config, | 100 server_ssl_config, |
| 99 proxy_ssl_config, | 101 proxy_ssl_config, |
| 102 server, | |
| 103 origin_url, | |
| 100 AlternativeService(), | 104 AlternativeService(), |
| 101 net_log) { | 105 net_log) {} |
| 102 } | |
| 103 | 106 |
| 104 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, | 107 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, |
| 105 HttpNetworkSession* session, | 108 HttpNetworkSession* session, |
| 106 const HttpRequestInfo& request_info, | 109 const HttpRequestInfo& request_info, |
| 107 RequestPriority priority, | 110 RequestPriority priority, |
| 108 const SSLConfig& server_ssl_config, | 111 const SSLConfig& server_ssl_config, |
| 109 const SSLConfig& proxy_ssl_config, | 112 const SSLConfig& proxy_ssl_config, |
| 113 HostPortPair server, | |
| 114 GURL origin_url, | |
| 110 AlternativeService alternative_service, | 115 AlternativeService alternative_service, |
| 111 NetLog* net_log) | 116 NetLog* net_log) |
| 112 : request_(NULL), | 117 : request_(NULL), |
| 113 request_info_(request_info), | 118 request_info_(request_info), |
| 114 priority_(priority), | 119 priority_(priority), |
| 115 server_ssl_config_(server_ssl_config), | 120 server_ssl_config_(server_ssl_config), |
| 116 proxy_ssl_config_(proxy_ssl_config), | 121 proxy_ssl_config_(proxy_ssl_config), |
| 117 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP_STREAM_JOB)), | 122 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP_STREAM_JOB)), |
| 118 io_callback_(base::Bind(&Job::OnIOComplete, base::Unretained(this))), | 123 io_callback_(base::Bind(&Job::OnIOComplete, base::Unretained(this))), |
| 119 connection_(new ClientSocketHandle), | 124 connection_(new ClientSocketHandle), |
| 120 session_(session), | 125 session_(session), |
| 121 stream_factory_(stream_factory), | 126 stream_factory_(stream_factory), |
| 122 next_state_(STATE_NONE), | 127 next_state_(STATE_NONE), |
| 123 pac_request_(NULL), | 128 pac_request_(NULL), |
| 129 server_(server), | |
| 130 origin_url_(origin_url), | |
| 124 alternative_service_(alternative_service), | 131 alternative_service_(alternative_service), |
| 125 blocking_job_(NULL), | 132 blocking_job_(NULL), |
| 126 waiting_job_(NULL), | 133 waiting_job_(NULL), |
| 127 using_ssl_(false), | 134 using_ssl_(false), |
| 128 using_spdy_(false), | 135 using_spdy_(false), |
| 129 using_quic_(false), | 136 using_quic_(false), |
| 130 quic_request_(session_->quic_stream_factory()), | 137 quic_request_(session_->quic_stream_factory()), |
| 131 using_existing_quic_session_(false), | 138 using_existing_quic_session_(false), |
| 132 spdy_certificate_error_(OK), | 139 spdy_certificate_error_(OK), |
| 133 establishing_tunnel_(false), | 140 establishing_tunnel_(false), |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 | 660 |
| 654 int HttpStreamFactoryImpl::Job::StartInternal() { | 661 int HttpStreamFactoryImpl::Job::StartInternal() { |
| 655 CHECK_EQ(STATE_NONE, next_state_); | 662 CHECK_EQ(STATE_NONE, next_state_); |
| 656 next_state_ = STATE_START; | 663 next_state_ = STATE_START; |
| 657 int rv = RunLoop(OK); | 664 int rv = RunLoop(OK); |
| 658 DCHECK_EQ(ERR_IO_PENDING, rv); | 665 DCHECK_EQ(ERR_IO_PENDING, rv); |
| 659 return rv; | 666 return rv; |
| 660 } | 667 } |
| 661 | 668 |
| 662 int HttpStreamFactoryImpl::Job::DoStart() { | 669 int HttpStreamFactoryImpl::Job::DoStart() { |
| 663 if (IsSpdyAlternative() || IsQuicAlternative()) { | |
| 664 server_ = alternative_service_.host_port_pair(); | |
| 665 } else { | |
| 666 server_ = HostPortPair::FromURL(request_info_.url); | |
| 667 } | |
| 668 origin_url_ = | 670 origin_url_ = |
| 669 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); | 671 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); |
|
Ryan Hamilton
2015/12/21 17:37:51
I think you can remove this line, right?
Zhongyi Shi
2015/12/28 22:43:22
Done.
| |
| 670 valid_spdy_session_pool_.reset(new ValidSpdySessionPool( | 672 valid_spdy_session_pool_.reset(new ValidSpdySessionPool( |
| 671 session_->spdy_session_pool(), origin_url_, IsSpdyAlternative())); | 673 session_->spdy_session_pool(), origin_url_, IsSpdyAlternative())); |
| 672 | 674 |
| 673 net_log_.BeginEvent( | 675 net_log_.BeginEvent( |
| 674 NetLog::TYPE_HTTP_STREAM_JOB, | 676 NetLog::TYPE_HTTP_STREAM_JOB, |
| 675 base::Bind(&NetLogHttpStreamJobCallback, | 677 base::Bind(&NetLogHttpStreamJobCallback, |
| 676 request_ ? request_->net_log().source() : NetLog::Source(), | 678 request_ ? request_->net_log().source() : NetLog::Source(), |
| 677 &request_info_.url, &origin_url_, &alternative_service_, | 679 &request_info_.url, &origin_url_, &alternative_service_, |
| 678 priority_)); | 680 priority_)); |
| 679 if (request_) { | 681 if (request_) { |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1615 if (connection_->socket()) { | 1617 if (connection_->socket()) { |
| 1616 ConnectionAttempts socket_attempts; | 1618 ConnectionAttempts socket_attempts; |
| 1617 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1619 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1618 request_->AddConnectionAttempts(socket_attempts); | 1620 request_->AddConnectionAttempts(socket_attempts); |
| 1619 } else { | 1621 } else { |
| 1620 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1622 request_->AddConnectionAttempts(connection_->connection_attempts()); |
| 1621 } | 1623 } |
| 1622 } | 1624 } |
| 1623 | 1625 |
| 1624 } // namespace net | 1626 } // namespace net |
| OLD | NEW |