| 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 #ifndef NET_BASE_TCP_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_BASE_TCP_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/timer.h" | 13 #include "base/timer.h" |
| 14 #include "net/base/address_list.h" | 14 #include "net/base/address_list.h" |
| 15 #include "net/base/client_socket_pool.h" | |
| 16 #include "net/base/host_resolver.h" | 15 #include "net/base/host_resolver.h" |
| 16 #include "net/socket/client_socket_pool.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class ClientSocketFactory; | 20 class ClientSocketFactory; |
| 21 class ClientSocketPoolBase; | 21 class ClientSocketPoolBase; |
| 22 | 22 |
| 23 // ConnectingSocket provides an abstract interface for "connecting" a socket. | 23 // ConnectingSocket provides an abstract interface for "connecting" a socket. |
| 24 // The connection may involve host resolution, tcp connection, ssl connection, | 24 // The connection may involve host resolution, tcp connection, ssl connection, |
| 25 // etc. | 25 // etc. |
| 26 class ConnectingSocket { | 26 class ConnectingSocket { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return idle_socket_count_; | 152 return idle_socket_count_; |
| 153 } | 153 } |
| 154 | 154 |
| 155 int IdleSocketCountInGroup(const std::string& group_name) const; | 155 int IdleSocketCountInGroup(const std::string& group_name) const; |
| 156 | 156 |
| 157 LoadState GetLoadState(const std::string& group_name, | 157 LoadState GetLoadState(const std::string& group_name, |
| 158 const ClientSocketHandle* handle) const; | 158 const ClientSocketHandle* handle) const; |
| 159 | 159 |
| 160 // Used by ConnectingSocket until we remove the coupling between a specific | 160 // Used by ConnectingSocket until we remove the coupling between a specific |
| 161 // ConnectingSocket and a ClientSocketHandle: | 161 // ConnectingSocket and a ClientSocketHandle: |
| 162 | 162 |
| 163 // Returns NULL if not found. Otherwise it returns the Request* | 163 // Returns NULL if not found. Otherwise it returns the Request* |
| 164 // corresponding to the ConnectingSocket (keyed by |group_name| and |handle|. | 164 // corresponding to the ConnectingSocket (keyed by |group_name| and |handle|. |
| 165 // Note that this pointer may be invalidated after any call that might mutate | 165 // Note that this pointer may be invalidated after any call that might mutate |
| 166 // the RequestMap or GroupMap, so the user should not hold onto the pointer | 166 // the RequestMap or GroupMap, so the user should not hold onto the pointer |
| 167 // for long. | 167 // for long. |
| 168 Request* GetConnectingRequest(const std::string& group_name, | 168 Request* GetConnectingRequest(const std::string& group_name, |
| 169 const ClientSocketHandle* handle); | 169 const ClientSocketHandle* handle); |
| 170 | 170 |
| 171 // Handles the completed Request corresponding to the ConnectingSocket (keyed | 171 // Handles the completed Request corresponding to the ConnectingSocket (keyed |
| 172 // by |group_name| and |handle|. |deactivate| indicates whether or not to | 172 // by |group_name| and |handle|. |deactivate| indicates whether or not to |
| 173 // deactivate the socket, making the socket slot available for a new socket | 173 // deactivate the socket, making the socket slot available for a new socket |
| 174 // connection. If |deactivate| is false, then set |socket| into |handle|. | 174 // connection. If |deactivate| is false, then set |socket| into |handle|. |
| 175 // Returns the callback to run. | 175 // Returns the callback to run. |
| 176 CompletionCallback* OnConnectingRequestComplete( | 176 CompletionCallback* OnConnectingRequestComplete( |
| 177 const std::string& group_name, | 177 const std::string& group_name, |
| 178 const ClientSocketHandle* handle, | 178 const ClientSocketHandle* handle, |
| 179 bool deactivate, | 179 bool deactivate, |
| 180 ClientSocket* socket); | 180 ClientSocket* socket); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // DoReleaseSocket() posts a task. If ClientSocketPool gets deleted between | 330 // DoReleaseSocket() posts a task. If ClientSocketPool gets deleted between |
| 331 // the posting of the task and the execution, then we'll hit the DCHECK that | 331 // the posting of the task and the execution, then we'll hit the DCHECK that |
| 332 // |ClientSocketPoolBase::group_map_| is empty. | 332 // |ClientSocketPoolBase::group_map_| is empty. |
| 333 scoped_refptr<ClientSocketPoolBase> base_; | 333 scoped_refptr<ClientSocketPoolBase> base_; |
| 334 | 334 |
| 335 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); | 335 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); |
| 336 }; | 336 }; |
| 337 | 337 |
| 338 } // namespace net | 338 } // namespace net |
| 339 | 339 |
| 340 #endif // NET_BASE_TCP_CLIENT_SOCKET_POOL_H_ | 340 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |