| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 89   dict->SetString("proto", *proto); | 89   dict->SetString("proto", *proto); | 
| 90   return std::move(dict); | 90   return std::move(dict); | 
| 91 } | 91 } | 
| 92 | 92 | 
| 93 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, | 93 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, | 
| 94                                 HttpNetworkSession* session, | 94                                 HttpNetworkSession* session, | 
| 95                                 const HttpRequestInfo& request_info, | 95                                 const HttpRequestInfo& request_info, | 
| 96                                 RequestPriority priority, | 96                                 RequestPriority priority, | 
| 97                                 const SSLConfig& server_ssl_config, | 97                                 const SSLConfig& server_ssl_config, | 
| 98                                 const SSLConfig& proxy_ssl_config, | 98                                 const SSLConfig& proxy_ssl_config, | 
|  | 99                                 HostPortPair server, | 
|  | 100                                 GURL origin_url, | 
| 99                                 NetLog* net_log) | 101                                 NetLog* net_log) | 
| 100     : Job(stream_factory, | 102     : Job(stream_factory, | 
| 101           session, | 103           session, | 
| 102           request_info, | 104           request_info, | 
| 103           priority, | 105           priority, | 
| 104           server_ssl_config, | 106           server_ssl_config, | 
| 105           proxy_ssl_config, | 107           proxy_ssl_config, | 
|  | 108           server, | 
|  | 109           origin_url, | 
| 106           AlternativeService(), | 110           AlternativeService(), | 
| 107           net_log) { | 111           net_log) {} | 
| 108 } |  | 
| 109 | 112 | 
| 110 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, | 113 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, | 
| 111                                 HttpNetworkSession* session, | 114                                 HttpNetworkSession* session, | 
| 112                                 const HttpRequestInfo& request_info, | 115                                 const HttpRequestInfo& request_info, | 
| 113                                 RequestPriority priority, | 116                                 RequestPriority priority, | 
| 114                                 const SSLConfig& server_ssl_config, | 117                                 const SSLConfig& server_ssl_config, | 
| 115                                 const SSLConfig& proxy_ssl_config, | 118                                 const SSLConfig& proxy_ssl_config, | 
|  | 119                                 HostPortPair server, | 
|  | 120                                 GURL origin_url, | 
| 116                                 AlternativeService alternative_service, | 121                                 AlternativeService alternative_service, | 
| 117                                 NetLog* net_log) | 122                                 NetLog* net_log) | 
| 118     : request_(NULL), | 123     : request_(NULL), | 
| 119       request_info_(request_info), | 124       request_info_(request_info), | 
| 120       priority_(priority), | 125       priority_(priority), | 
| 121       server_ssl_config_(server_ssl_config), | 126       server_ssl_config_(server_ssl_config), | 
| 122       proxy_ssl_config_(proxy_ssl_config), | 127       proxy_ssl_config_(proxy_ssl_config), | 
| 123       net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP_STREAM_JOB)), | 128       net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP_STREAM_JOB)), | 
| 124       io_callback_(base::Bind(&Job::OnIOComplete, base::Unretained(this))), | 129       io_callback_(base::Bind(&Job::OnIOComplete, base::Unretained(this))), | 
| 125       connection_(new ClientSocketHandle), | 130       connection_(new ClientSocketHandle), | 
| 126       session_(session), | 131       session_(session), | 
| 127       stream_factory_(stream_factory), | 132       stream_factory_(stream_factory), | 
| 128       next_state_(STATE_NONE), | 133       next_state_(STATE_NONE), | 
| 129       pac_request_(NULL), | 134       pac_request_(NULL), | 
|  | 135       server_(server), | 
|  | 136       origin_url_(origin_url), | 
| 130       alternative_service_(alternative_service), | 137       alternative_service_(alternative_service), | 
| 131       blocking_job_(NULL), | 138       blocking_job_(NULL), | 
| 132       waiting_job_(NULL), | 139       waiting_job_(NULL), | 
| 133       using_ssl_(false), | 140       using_ssl_(false), | 
| 134       using_spdy_(false), | 141       using_spdy_(false), | 
| 135       using_quic_(false), | 142       using_quic_(false), | 
| 136       quic_request_(session_->quic_stream_factory()), | 143       quic_request_(session_->quic_stream_factory()), | 
| 137       using_existing_quic_session_(false), | 144       using_existing_quic_session_(false), | 
| 138       spdy_certificate_error_(OK), | 145       spdy_certificate_error_(OK), | 
| 139       establishing_tunnel_(false), | 146       establishing_tunnel_(false), | 
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 715 | 722 | 
| 716 int HttpStreamFactoryImpl::Job::StartInternal() { | 723 int HttpStreamFactoryImpl::Job::StartInternal() { | 
| 717   CHECK_EQ(STATE_NONE, next_state_); | 724   CHECK_EQ(STATE_NONE, next_state_); | 
| 718   next_state_ = STATE_START; | 725   next_state_ = STATE_START; | 
| 719   int rv = RunLoop(OK); | 726   int rv = RunLoop(OK); | 
| 720   DCHECK_EQ(ERR_IO_PENDING, rv); | 727   DCHECK_EQ(ERR_IO_PENDING, rv); | 
| 721   return rv; | 728   return rv; | 
| 722 } | 729 } | 
| 723 | 730 | 
| 724 int HttpStreamFactoryImpl::Job::DoStart() { | 731 int HttpStreamFactoryImpl::Job::DoStart() { | 
| 725   if (IsSpdyAlternative() || IsQuicAlternative()) { |  | 
| 726     server_ = alternative_service_.host_port_pair(); |  | 
| 727   } else { |  | 
| 728     server_ = HostPortPair::FromURL(request_info_.url); |  | 
| 729   } |  | 
| 730   origin_url_ = |  | 
| 731       stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); |  | 
| 732   valid_spdy_session_pool_.reset(new ValidSpdySessionPool( | 732   valid_spdy_session_pool_.reset(new ValidSpdySessionPool( | 
| 733       session_->spdy_session_pool(), origin_url_, IsSpdyAlternative())); | 733       session_->spdy_session_pool(), origin_url_, IsSpdyAlternative())); | 
| 734 | 734 | 
| 735   net_log_.BeginEvent( | 735   net_log_.BeginEvent( | 
| 736       NetLog::TYPE_HTTP_STREAM_JOB, | 736       NetLog::TYPE_HTTP_STREAM_JOB, | 
| 737       base::Bind(&NetLogHttpStreamJobCallback, | 737       base::Bind(&NetLogHttpStreamJobCallback, | 
| 738                  request_ ? request_->net_log().source() : NetLog::Source(), | 738                  request_ ? request_->net_log().source() : NetLog::Source(), | 
| 739                  &request_info_.url, &origin_url_, &alternative_service_, | 739                  &request_info_.url, &origin_url_, &alternative_service_, | 
| 740                  priority_)); | 740                  priority_)); | 
| 741   if (request_) { | 741   if (request_) { | 
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1690   if (connection_->socket()) { | 1690   if (connection_->socket()) { | 
| 1691     ConnectionAttempts socket_attempts; | 1691     ConnectionAttempts socket_attempts; | 
| 1692     connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1692     connection_->socket()->GetConnectionAttempts(&socket_attempts); | 
| 1693     request_->AddConnectionAttempts(socket_attempts); | 1693     request_->AddConnectionAttempts(socket_attempts); | 
| 1694   } else { | 1694   } else { | 
| 1695     request_->AddConnectionAttempts(connection_->connection_attempts()); | 1695     request_->AddConnectionAttempts(connection_->connection_attempts()); | 
| 1696   } | 1696   } | 
| 1697 } | 1697 } | 
| 1698 | 1698 | 
| 1699 }  // namespace net | 1699 }  // namespace net | 
| OLD | NEW | 
|---|