| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SOCKET_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/template_util.h" | 15 #include "base/template_util.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/host_resolver.h" | 17 #include "net/base/host_resolver.h" |
| 18 #include "net/base/load_states.h" | 18 #include "net/base/load_states.h" |
| 19 #include "net/base/net_api.h" | 19 #include "net/base/net_export.h" |
| 20 #include "net/base/request_priority.h" | 20 #include "net/base/request_priority.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class DictionaryValue; | 23 class DictionaryValue; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 | 27 |
| 28 class ClientSocketHandle; | 28 class ClientSocketHandle; |
| 29 class ClientSocketPoolHistograms; | 29 class ClientSocketPoolHistograms; |
| 30 class StreamSocket; | 30 class StreamSocket; |
| 31 | 31 |
| 32 // A ClientSocketPool is used to restrict the number of sockets open at a time. | 32 // A ClientSocketPool is used to restrict the number of sockets open at a time. |
| 33 // It also maintains a list of idle persistent sockets. | 33 // It also maintains a list of idle persistent sockets. |
| 34 // | 34 // |
| 35 class NET_API ClientSocketPool { | 35 class NET_EXPORT ClientSocketPool { |
| 36 public: | 36 public: |
| 37 // Requests a connected socket for a group_name. | 37 // Requests a connected socket for a group_name. |
| 38 // | 38 // |
| 39 // There are five possible results from calling this function: | 39 // There are five possible results from calling this function: |
| 40 // 1) RequestSocket returns OK and initializes |handle| with a reused socket. | 40 // 1) RequestSocket returns OK and initializes |handle| with a reused socket. |
| 41 // 2) RequestSocket returns OK with a newly connected socket. | 41 // 2) RequestSocket returns OK with a newly connected socket. |
| 42 // 3) RequestSocket returns ERR_IO_PENDING. The handle will be added to a | 42 // 3) RequestSocket returns ERR_IO_PENDING. The handle will be added to a |
| 43 // wait list until a socket is available to reuse or a new socket finishes | 43 // wait list until a socket is available to reuse or a new socket finishes |
| 44 // connecting. |priority| will determine the placement into the wait list. | 44 // connecting. |priority| will determine the placement into the wait list. |
| 45 // 4) An error occurred early on, so RequestSocket returns an error code. | 45 // 4) An error occurred early on, so RequestSocket returns an error code. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 const scoped_refptr<SocketParams>& params, | 187 const scoped_refptr<SocketParams>& params, |
| 188 int num_sockets, | 188 int num_sockets, |
| 189 const BoundNetLog& net_log) { | 189 const BoundNetLog& net_log) { |
| 190 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); | 190 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); |
| 191 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); | 191 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace net | 194 } // namespace net |
| 195 | 195 |
| 196 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 196 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |