OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // TODO(ukai): code is similar with http_network_transaction.cc. We should | 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should |
6 // think about ways to share code, if possible. | 6 // think about ways to share code, if possible. |
7 | 7 |
8 #include "net/socket_stream/socket_stream.h" | 8 #include "net/socket_stream/socket_stream.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 522 |
523 HostResolver::RequestInfo resolve_info(host, port); | 523 HostResolver::RequestInfo resolve_info(host, port); |
524 | 524 |
525 DCHECK(host_resolver_.get()); | 525 DCHECK(host_resolver_.get()); |
526 resolver_.reset(new SingleRequestHostResolver(host_resolver_.get())); | 526 resolver_.reset(new SingleRequestHostResolver(host_resolver_.get())); |
527 return resolver_->Resolve(resolve_info, &addresses_, &io_callback_, | 527 return resolver_->Resolve(resolve_info, &addresses_, &io_callback_, |
528 net_log_); | 528 net_log_); |
529 } | 529 } |
530 | 530 |
531 int SocketStream::DoResolveHostComplete(int result) { | 531 int SocketStream::DoResolveHostComplete(int result) { |
532 if (result == OK) { | 532 if (result == OK && delegate_) { |
533 next_state_ = STATE_TCP_CONNECT; | 533 next_state_ = STATE_TCP_CONNECT; |
534 result = delegate_->OnStartOpenConnection(this, &io_callback_); | 534 result = delegate_->OnStartOpenConnection(this, &io_callback_); |
535 if (result == net::ERR_IO_PENDING) | 535 if (result == net::ERR_IO_PENDING) |
536 metrics_->OnWaitConnection(); | 536 metrics_->OnWaitConnection(); |
537 } else { | 537 } else { |
538 next_state_ = STATE_CLOSE; | 538 next_state_ = STATE_CLOSE; |
539 } | 539 } |
540 // TODO(ukai): if error occured, reconsider proxy after error. | 540 // TODO(ukai): if error occured, reconsider proxy after error. |
541 return result; | 541 return result; |
542 } | 542 } |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 | 1019 |
1020 SSLConfigService* SocketStream::ssl_config_service() const { | 1020 SSLConfigService* SocketStream::ssl_config_service() const { |
1021 return context_->ssl_config_service(); | 1021 return context_->ssl_config_service(); |
1022 } | 1022 } |
1023 | 1023 |
1024 ProxyService* SocketStream::proxy_service() const { | 1024 ProxyService* SocketStream::proxy_service() const { |
1025 return context_->proxy_service(); | 1025 return context_->proxy_service(); |
1026 } | 1026 } |
1027 | 1027 |
1028 } // namespace net | 1028 } // namespace net |
OLD | NEW |