| 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 <string> | 10 #include <string> |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 host_resolver_ = host_resolver; | 245 host_resolver_ = host_resolver; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void SocketStream::SetClientSocketFactory( | 248 void SocketStream::SetClientSocketFactory( |
| 249 ClientSocketFactory* factory) { | 249 ClientSocketFactory* factory) { |
| 250 DCHECK(factory); | 250 DCHECK(factory); |
| 251 factory_ = factory; | 251 factory_ = factory; |
| 252 } | 252 } |
| 253 | 253 |
| 254 void SocketStream::CopyAddrInfo(struct addrinfo* head) { | 254 void SocketStream::CopyAddrInfo(struct addrinfo* head) { |
| 255 addresses_.Copy(head); | 255 addresses_.Copy(head, true); |
| 256 } | 256 } |
| 257 | 257 |
| 258 int SocketStream::DidEstablishConnection() { | 258 int SocketStream::DidEstablishConnection() { |
| 259 if (!socket_.get() || !socket_->IsConnected()) { | 259 if (!socket_.get() || !socket_->IsConnected()) { |
| 260 next_state_ = STATE_CLOSE; | 260 next_state_ = STATE_CLOSE; |
| 261 return ERR_CONNECTION_FAILED; | 261 return ERR_CONNECTION_FAILED; |
| 262 } | 262 } |
| 263 next_state_ = STATE_READ_WRITE; | 263 next_state_ = STATE_READ_WRITE; |
| 264 metrics_->OnConnected(); | 264 metrics_->OnConnected(); |
| 265 | 265 |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 return context_->proxy_service(); | 949 return context_->proxy_service(); |
| 950 } | 950 } |
| 951 | 951 |
| 952 void SocketStream::GetInfoForTracker( | 952 void SocketStream::GetInfoForTracker( |
| 953 RequestTracker<SocketStream>::RecentRequestInfo* info) const { | 953 RequestTracker<SocketStream>::RecentRequestInfo* info) const { |
| 954 info->original_url = url_; | 954 info->original_url = url_; |
| 955 info->load_log = load_log_; | 955 info->load_log = load_log_; |
| 956 } | 956 } |
| 957 | 957 |
| 958 } // namespace net | 958 } // namespace net |
| OLD | NEW |