| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // group. It uses |params| to control how to connect the sockets. The | 117 // group. It uses |params| to control how to connect the sockets. The |
| 118 // ClientSocketPool will assign a priority to the new connections, if any. | 118 // ClientSocketPool will assign a priority to the new connections, if any. |
| 119 // This priority will probably be lower than all others, since this method | 119 // This priority will probably be lower than all others, since this method |
| 120 // is intended to make sure ahead of time that |num_sockets| sockets are | 120 // is intended to make sure ahead of time that |num_sockets| sockets are |
| 121 // available to talk to a host. | 121 // available to talk to a host. |
| 122 virtual void RequestSockets(const std::string& group_name, | 122 virtual void RequestSockets(const std::string& group_name, |
| 123 const void* params, | 123 const void* params, |
| 124 int num_sockets, | 124 int num_sockets, |
| 125 const NetLogWithSource& net_log) = 0; | 125 const NetLogWithSource& net_log) = 0; |
| 126 | 126 |
| 127 // Called to change the priority of a RequestSocket call that returned |
| 128 // ERR_IO_PENDING and has not yet asynchronously completed. The same handle |
| 129 // parameter must be passed to this method as was passed to the |
| 130 // RequestSocket call being modified. |
| 131 // This function is a no-op if |priority| is the same as the current |
| 132 // request priority. |
| 133 virtual void SetPriority(const std::string& group_name, |
| 134 ClientSocketHandle* handle, |
| 135 RequestPriority priority) = 0; |
| 136 |
| 127 // Called to cancel a RequestSocket call that returned ERR_IO_PENDING. The | 137 // Called to cancel a RequestSocket call that returned ERR_IO_PENDING. The |
| 128 // same handle parameter must be passed to this method as was passed to the | 138 // same handle parameter must be passed to this method as was passed to the |
| 129 // RequestSocket call being cancelled. The associated CompletionCallback is | 139 // RequestSocket call being cancelled. The associated CompletionCallback is |
| 130 // not run. However, for performance, we will let one ConnectJob complete | 140 // not run. However, for performance, we will let one ConnectJob complete |
| 131 // and go idle. | 141 // and go idle. |
| 132 virtual void CancelRequest(const std::string& group_name, | 142 virtual void CancelRequest(const std::string& group_name, |
| 133 ClientSocketHandle* handle) = 0; | 143 ClientSocketHandle* handle) = 0; |
| 134 | 144 |
| 135 // Called to release a socket once the socket is no longer needed. If the | 145 // Called to release a socket once the socket is no longer needed. If the |
| 136 // socket still has an established connection, then it will be added to the | 146 // socket still has an established connection, then it will be added to the |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const std::string& group_name, | 208 const std::string& group_name, |
| 199 const scoped_refptr<typename PoolType::SocketParams>& params, | 209 const scoped_refptr<typename PoolType::SocketParams>& params, |
| 200 int num_sockets, | 210 int num_sockets, |
| 201 const NetLogWithSource& net_log) { | 211 const NetLogWithSource& net_log) { |
| 202 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); | 212 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); |
| 203 } | 213 } |
| 204 | 214 |
| 205 } // namespace net | 215 } // namespace net |
| 206 | 216 |
| 207 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 217 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |