OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // set of idle sockets to be used to satisfy future RequestSocket calls. | 108 // set of idle sockets to be used to satisfy future RequestSocket calls. |
109 // Otherwise, the StreamSocket is destroyed. |id| is used to differentiate | 109 // Otherwise, the StreamSocket is destroyed. |id| is used to differentiate |
110 // between updated versions of the same pool instance. The pool's id will | 110 // between updated versions of the same pool instance. The pool's id will |
111 // change when it flushes, so it can use this |id| to discard sockets with | 111 // change when it flushes, so it can use this |id| to discard sockets with |
112 // mismatched ids. | 112 // mismatched ids. |
113 virtual void ReleaseSocket(const std::string& group_name, | 113 virtual void ReleaseSocket(const std::string& group_name, |
114 StreamSocket* socket, | 114 StreamSocket* socket, |
115 int id) = 0; | 115 int id) = 0; |
116 | 116 |
117 // This flushes all state from the ClientSocketPool. This means that all | 117 // This flushes all state from the ClientSocketPool. This means that all |
118 // idle and connecting sockets are discarded. Active sockets being | 118 // idle and connecting sockets are discarded with the given |error|. |
119 // held by ClientSocketPool clients will be discarded when released back to | 119 // Active sockets being held by ClientSocketPool clients will be discarded |
120 // the pool. Does not flush any pools wrapped by |this|. | 120 // when released back to the pool. |
121 virtual void Flush() = 0; | 121 // Does not flush any pools wrapped by |this|. |
| 122 virtual void FlushWithError(int error) = 0; |
122 | 123 |
123 // Returns true if a there is currently a request blocked on the | 124 // Returns true if a there is currently a request blocked on the |
124 // per-pool (not per-host) max socket limit. | 125 // per-pool (not per-host) max socket limit. |
125 virtual bool IsStalled() const = 0; | 126 virtual bool IsStalled() const = 0; |
126 | 127 |
127 // Called to close any idle connections held by the connection manager. | 128 // Called to close any idle connections held by the connection manager. |
128 virtual void CloseIdleSockets() = 0; | 129 virtual void CloseIdleSockets() = 0; |
129 | 130 |
130 // The total number of idle sockets in the pool. | 131 // The total number of idle sockets in the pool. |
131 virtual int IdleSocketCount() const = 0; | 132 virtual int IdleSocketCount() const = 0; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 const scoped_refptr<SocketParams>& params, | 211 const scoped_refptr<SocketParams>& params, |
211 int num_sockets, | 212 int num_sockets, |
212 const BoundNetLog& net_log) { | 213 const BoundNetLog& net_log) { |
213 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); | 214 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); |
214 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); | 215 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); |
215 } | 216 } |
216 | 217 |
217 } // namespace net | 218 } // namespace net |
218 | 219 |
219 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 220 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |