| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { | 319 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { |
| 320 DCHECK(stream_.get()); | 320 DCHECK(stream_.get()); |
| 321 DCHECK(!IsPreconnecting()); | 321 DCHECK(!IsPreconnecting()); |
| 322 DCHECK(!stream_factory_->for_websockets_); | 322 DCHECK(!stream_factory_->for_websockets_); |
| 323 | 323 |
| 324 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 324 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
| 325 | 325 |
| 326 if (IsOrphaned()) { | 326 if (IsOrphaned()) { |
| 327 stream_factory_->OnOrphanedJobComplete(this); | 327 stream_factory_->OnOrphanedJobComplete(this); |
| 328 } else { | 328 } else { |
| 329 request_->Complete(was_npn_negotiated(), | 329 request_->Complete(was_npn_negotiated(), protocol_negotiated(), |
| 330 protocol_negotiated(), | 330 using_spdy()); |
| 331 using_spdy(), | |
| 332 net_log_); | |
| 333 request_->OnStreamReady(this, server_ssl_config_, proxy_info_, | 331 request_->OnStreamReady(this, server_ssl_config_, proxy_info_, |
| 334 stream_.release()); | 332 stream_.release()); |
| 335 } | 333 } |
| 336 // |this| may be deleted after this call. | 334 // |this| may be deleted after this call. |
| 337 } | 335 } |
| 338 | 336 |
| 339 void HttpStreamFactoryImpl::Job::OnWebSocketHandshakeStreamReadyCallback() { | 337 void HttpStreamFactoryImpl::Job::OnWebSocketHandshakeStreamReadyCallback() { |
| 340 DCHECK(websocket_stream_); | 338 DCHECK(websocket_stream_); |
| 341 DCHECK(!IsPreconnecting()); | 339 DCHECK(!IsPreconnecting()); |
| 342 DCHECK(stream_factory_->for_websockets_); | 340 DCHECK(stream_factory_->for_websockets_); |
| 343 // An orphaned WebSocket job will be closed immediately and | 341 // An orphaned WebSocket job will be closed immediately and |
| 344 // never be ready. | 342 // never be ready. |
| 345 DCHECK(!IsOrphaned()); | 343 DCHECK(!IsOrphaned()); |
| 346 | 344 |
| 347 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 345 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
| 348 | 346 |
| 349 request_->Complete(was_npn_negotiated(), | 347 request_->Complete(was_npn_negotiated(), protocol_negotiated(), using_spdy()); |
| 350 protocol_negotiated(), | |
| 351 using_spdy(), | |
| 352 net_log_); | |
| 353 request_->OnWebSocketHandshakeStreamReady(this, | 348 request_->OnWebSocketHandshakeStreamReady(this, |
| 354 server_ssl_config_, | 349 server_ssl_config_, |
| 355 proxy_info_, | 350 proxy_info_, |
| 356 websocket_stream_.release()); | 351 websocket_stream_.release()); |
| 357 // |this| may be deleted after this call. | 352 // |this| may be deleted after this call. |
| 358 } | 353 } |
| 359 | 354 |
| 360 void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() { | 355 void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() { |
| 361 DCHECK(stream_.get()); | 356 DCHECK(stream_.get()); |
| 362 DCHECK(!IsPreconnecting()); | 357 DCHECK(!IsPreconnecting()); |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 if (connection_->socket()) { | 1578 if (connection_->socket()) { |
| 1584 ConnectionAttempts socket_attempts; | 1579 ConnectionAttempts socket_attempts; |
| 1585 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1580 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1586 request_->AddConnectionAttempts(socket_attempts); | 1581 request_->AddConnectionAttempts(socket_attempts); |
| 1587 } else { | 1582 } else { |
| 1588 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1583 request_->AddConnectionAttempts(connection_->connection_attempts()); |
| 1589 } | 1584 } |
| 1590 } | 1585 } |
| 1591 | 1586 |
| 1592 } // namespace net | 1587 } // namespace net |
| OLD | NEW |