| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/socket/tcp_client_socket_pool.h" | 5 #include "net/socket/tcp_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 break; | 82 break; |
| 83 } | 83 } |
| 84 } while (rv != ERR_IO_PENDING && next_state_ != kStateNone); | 84 } while (rv != ERR_IO_PENDING && next_state_ != kStateNone); |
| 85 | 85 |
| 86 return rv; | 86 return rv; |
| 87 } | 87 } |
| 88 | 88 |
| 89 int TCPConnectJob::DoResolveHost() { | 89 int TCPConnectJob::DoResolveHost() { |
| 90 set_load_state(LOAD_STATE_RESOLVING_HOST); | 90 set_load_state(LOAD_STATE_RESOLVING_HOST); |
| 91 next_state_ = kStateResolveHostComplete; | 91 next_state_ = kStateResolveHostComplete; |
| 92 return resolver_.Resolve(resolve_info_, &addresses_, &callback_); | 92 return resolver_.Resolve(NULL, resolve_info_, &addresses_, &callback_); |
| 93 } | 93 } |
| 94 | 94 |
| 95 int TCPConnectJob::DoResolveHostComplete(int result) { | 95 int TCPConnectJob::DoResolveHostComplete(int result) { |
| 96 DCHECK_EQ(LOAD_STATE_RESOLVING_HOST, load_state()); | 96 DCHECK_EQ(LOAD_STATE_RESOLVING_HOST, load_state()); |
| 97 if (result == OK) | 97 if (result == OK) |
| 98 next_state_ = kStateTCPConnect; | 98 next_state_ = kStateTCPConnect; |
| 99 return result; | 99 return result; |
| 100 } | 100 } |
| 101 | 101 |
| 102 int TCPConnectJob::DoTCPConnect() { | 102 int TCPConnectJob::DoTCPConnect() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 int max_sockets_per_group, | 142 int max_sockets_per_group, |
| 143 HostResolver* host_resolver, | 143 HostResolver* host_resolver, |
| 144 ClientSocketFactory* client_socket_factory) | 144 ClientSocketFactory* client_socket_factory) |
| 145 : base_(new ClientSocketPoolBase( | 145 : base_(new ClientSocketPoolBase( |
| 146 max_sockets, max_sockets_per_group, | 146 max_sockets, max_sockets_per_group, |
| 147 new TCPConnectJobFactory(client_socket_factory, host_resolver))) {} | 147 new TCPConnectJobFactory(client_socket_factory, host_resolver))) {} |
| 148 | 148 |
| 149 TCPClientSocketPool::~TCPClientSocketPool() {} | 149 TCPClientSocketPool::~TCPClientSocketPool() {} |
| 150 | 150 |
| 151 int TCPClientSocketPool::RequestSocket( | 151 int TCPClientSocketPool::RequestSocket( |
| 152 LoadLog* load_log, |
| 152 const std::string& group_name, | 153 const std::string& group_name, |
| 153 const HostResolver::RequestInfo& resolve_info, | 154 const HostResolver::RequestInfo& resolve_info, |
| 154 int priority, | 155 int priority, |
| 155 ClientSocketHandle* handle, | 156 ClientSocketHandle* handle, |
| 156 CompletionCallback* callback) { | 157 CompletionCallback* callback) { |
| 157 return base_->RequestSocket( | 158 return base_->RequestSocket( |
| 158 group_name, resolve_info, priority, handle, callback); | 159 load_log, group_name, resolve_info, priority, handle, callback); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void TCPClientSocketPool::CancelRequest( | 162 void TCPClientSocketPool::CancelRequest( |
| 162 const std::string& group_name, | 163 const std::string& group_name, |
| 163 const ClientSocketHandle* handle) { | 164 const ClientSocketHandle* handle) { |
| 164 base_->CancelRequest(group_name, handle); | 165 base_->CancelRequest(group_name, handle); |
| 165 } | 166 } |
| 166 | 167 |
| 167 void TCPClientSocketPool::ReleaseSocket( | 168 void TCPClientSocketPool::ReleaseSocket( |
| 168 const std::string& group_name, | 169 const std::string& group_name, |
| 169 ClientSocket* socket) { | 170 ClientSocket* socket) { |
| 170 base_->ReleaseSocket(group_name, socket); | 171 base_->ReleaseSocket(group_name, socket); |
| 171 } | 172 } |
| 172 | 173 |
| 173 void TCPClientSocketPool::CloseIdleSockets() { | 174 void TCPClientSocketPool::CloseIdleSockets() { |
| 174 base_->CloseIdleSockets(); | 175 base_->CloseIdleSockets(); |
| 175 } | 176 } |
| 176 | 177 |
| 177 int TCPClientSocketPool::IdleSocketCountInGroup( | 178 int TCPClientSocketPool::IdleSocketCountInGroup( |
| 178 const std::string& group_name) const { | 179 const std::string& group_name) const { |
| 179 return base_->IdleSocketCountInGroup(group_name); | 180 return base_->IdleSocketCountInGroup(group_name); |
| 180 } | 181 } |
| 181 | 182 |
| 182 LoadState TCPClientSocketPool::GetLoadState( | 183 LoadState TCPClientSocketPool::GetLoadState( |
| 183 const std::string& group_name, const ClientSocketHandle* handle) const { | 184 const std::string& group_name, const ClientSocketHandle* handle) const { |
| 184 return base_->GetLoadState(group_name, handle); | 185 return base_->GetLoadState(group_name, handle); |
| 185 } | 186 } |
| 186 | 187 |
| 187 } // namespace net | 188 } // namespace net |
| OLD | NEW |