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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 const SSLConfig& proxy_ssl_config, | 176 const SSLConfig& proxy_ssl_config, |
177 HostPortPair destination, | 177 HostPortPair destination, |
178 GURL origin_url, | 178 GURL origin_url, |
179 AlternativeService alternative_service, | 179 AlternativeService alternative_service, |
180 const ProxyServer& alternative_proxy_server, | 180 const ProxyServer& alternative_proxy_server, |
181 NetLog* net_log) | 181 NetLog* net_log) |
182 : request_info_(request_info), | 182 : request_info_(request_info), |
183 priority_(priority), | 183 priority_(priority), |
184 server_ssl_config_(server_ssl_config), | 184 server_ssl_config_(server_ssl_config), |
185 proxy_ssl_config_(proxy_ssl_config), | 185 proxy_ssl_config_(proxy_ssl_config), |
186 net_log_(BoundNetLog::Make(net_log, NetLogSourceType::HTTP_STREAM_JOB)), | 186 net_log_( |
| 187 NetLogWithSource::Make(net_log, NetLogSourceType::HTTP_STREAM_JOB)), |
187 io_callback_(base::Bind(&Job::OnIOComplete, base::Unretained(this))), | 188 io_callback_(base::Bind(&Job::OnIOComplete, base::Unretained(this))), |
188 connection_(new ClientSocketHandle), | 189 connection_(new ClientSocketHandle), |
189 session_(session), | 190 session_(session), |
190 next_state_(STATE_NONE), | 191 next_state_(STATE_NONE), |
191 pac_request_(NULL), | 192 pac_request_(NULL), |
192 destination_(destination), | 193 destination_(destination), |
193 origin_url_(origin_url), | 194 origin_url_(origin_url), |
194 alternative_service_(alternative_service), | 195 alternative_service_(alternative_service), |
195 alternative_proxy_server_(alternative_proxy_server), | 196 alternative_proxy_server_(alternative_proxy_server), |
196 delegate_(delegate), | 197 delegate_(delegate), |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 delegate_->OnPreconnectsComplete(this); | 484 delegate_->OnPreconnectsComplete(this); |
484 // |this| may be deleted after this call. | 485 // |this| may be deleted after this call. |
485 } | 486 } |
486 | 487 |
487 // static | 488 // static |
488 int HttpStreamFactoryImpl::Job::OnHostResolution( | 489 int HttpStreamFactoryImpl::Job::OnHostResolution( |
489 SpdySessionPool* spdy_session_pool, | 490 SpdySessionPool* spdy_session_pool, |
490 const SpdySessionKey& spdy_session_key, | 491 const SpdySessionKey& spdy_session_key, |
491 const GURL& origin_url, | 492 const GURL& origin_url, |
492 const AddressList& addresses, | 493 const AddressList& addresses, |
493 const BoundNetLog& net_log) { | 494 const NetLogWithSource& net_log) { |
494 // It is OK to dereference spdy_session_pool, because the | 495 // It is OK to dereference spdy_session_pool, because the |
495 // ClientSocketPoolManager will be destroyed in the same callback that | 496 // ClientSocketPoolManager will be destroyed in the same callback that |
496 // destroys the SpdySessionPool. | 497 // destroys the SpdySessionPool. |
497 return spdy_session_pool->FindAvailableSession(spdy_session_key, origin_url, | 498 return spdy_session_pool->FindAvailableSession(spdy_session_key, origin_url, |
498 net_log) | 499 net_log) |
499 ? ERR_SPDY_SESSION_ALREADY_EXISTS | 500 ? ERR_SPDY_SESSION_ALREADY_EXISTS |
500 : OK; | 501 : OK; |
501 } | 502 } |
502 | 503 |
503 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { | 504 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 677 |
677 int HttpStreamFactoryImpl::Job::StartInternal() { | 678 int HttpStreamFactoryImpl::Job::StartInternal() { |
678 CHECK_EQ(STATE_NONE, next_state_); | 679 CHECK_EQ(STATE_NONE, next_state_); |
679 next_state_ = STATE_START; | 680 next_state_ = STATE_START; |
680 int rv = RunLoop(OK); | 681 int rv = RunLoop(OK); |
681 DCHECK_EQ(ERR_IO_PENDING, rv); | 682 DCHECK_EQ(ERR_IO_PENDING, rv); |
682 return rv; | 683 return rv; |
683 } | 684 } |
684 | 685 |
685 int HttpStreamFactoryImpl::Job::DoStart() { | 686 int HttpStreamFactoryImpl::Job::DoStart() { |
686 const BoundNetLog* net_log = delegate_->GetNetLog(this); | 687 const NetLogWithSource* net_log = delegate_->GetNetLog(this); |
687 | 688 |
688 if (net_log) { | 689 if (net_log) { |
689 net_log_.BeginEvent( | 690 net_log_.BeginEvent( |
690 NetLogEventType::HTTP_STREAM_JOB, | 691 NetLogEventType::HTTP_STREAM_JOB, |
691 base::Bind(&NetLogHttpStreamJobCallback, net_log->source(), | 692 base::Bind(&NetLogHttpStreamJobCallback, net_log->source(), |
692 &request_info_.url, &origin_url_, &alternative_service_, | 693 &request_info_.url, &origin_url_, &alternative_service_, |
693 priority_)); | 694 priority_)); |
694 net_log->AddEvent(NetLogEventType::HTTP_STREAM_REQUEST_STARTED_JOB, | 695 net_log->AddEvent(NetLogEventType::HTTP_STREAM_REQUEST_STARTED_JOB, |
695 net_log_.source().ToEventParametersCallback()); | 696 net_log_.source().ToEventParametersCallback()); |
696 } | 697 } |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 | 1522 |
1522 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1523 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
1523 if (connection_->socket()) { | 1524 if (connection_->socket()) { |
1524 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1525 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1525 } | 1526 } |
1526 | 1527 |
1527 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1528 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
1528 } | 1529 } |
1529 | 1530 |
1530 } // namespace net | 1531 } // namespace net |
OLD | NEW |