| 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> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 16 #include "net/base/load_states.h" | 16 #include "net/base/load_states.h" |
| 17 #include "net/base/load_timing_info.h" |
| 17 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
| 18 #include "net/base/request_priority.h" | 19 #include "net/base/request_priority.h" |
| 19 #include "net/dns/host_resolver.h" | 20 #include "net/dns/host_resolver.h" |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 class DictionaryValue; | 23 class DictionaryValue; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace net { | 26 namespace net { |
| 26 | 27 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // and go idle. | 132 // and go idle. |
| 132 virtual void CancelRequest(const std::string& group_name, | 133 virtual void CancelRequest(const std::string& group_name, |
| 133 ClientSocketHandle* handle) = 0; | 134 ClientSocketHandle* handle) = 0; |
| 134 | 135 |
| 135 // Called to release a socket once the socket is no longer needed. If the | 136 // 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 | 137 // socket still has an established connection, then it will be added to the |
| 137 // set of idle sockets to be used to satisfy future RequestSocket calls. | 138 // set of idle sockets to be used to satisfy future RequestSocket calls. |
| 138 // Otherwise, the StreamSocket is destroyed. |id| is used to differentiate | 139 // Otherwise, the StreamSocket is destroyed. |id| is used to differentiate |
| 139 // between updated versions of the same pool instance. The pool's id will | 140 // between updated versions of the same pool instance. The pool's id will |
| 140 // change when it flushes, so it can use this |id| to discard sockets with | 141 // change when it flushes, so it can use this |id| to discard sockets with |
| 141 // mismatched ids. | 142 // mismatched ids. |connect_timing| contains timing info of the connection |
| 142 virtual void ReleaseSocket(const std::string& group_name, | 143 // establishment. |
| 143 std::unique_ptr<StreamSocket> socket, | 144 virtual void ReleaseSocket( |
| 144 int id) = 0; | 145 const std::string& group_name, |
| 146 std::unique_ptr<StreamSocket> socket, |
| 147 int id, |
| 148 const LoadTimingInfo::ConnectTiming& connect_timing) = 0; |
| 145 | 149 |
| 146 // This flushes all state from the ClientSocketPool. This means that all | 150 // This flushes all state from the ClientSocketPool. This means that all |
| 147 // idle and connecting sockets are discarded with the given |error|. | 151 // idle and connecting sockets are discarded with the given |error|. |
| 148 // Active sockets being held by ClientSocketPool clients will be discarded | 152 // Active sockets being held by ClientSocketPool clients will be discarded |
| 149 // when released back to the pool. | 153 // when released back to the pool. |
| 150 // Does not flush any pools wrapped by |this|. | 154 // Does not flush any pools wrapped by |this|. |
| 151 virtual void FlushWithError(int error) = 0; | 155 virtual void FlushWithError(int error) = 0; |
| 152 | 156 |
| 153 // Called to close any idle connections held by the connection manager. | 157 // Called to close any idle connections held by the connection manager. |
| 154 virtual void CloseIdleSockets() = 0; | 158 virtual void CloseIdleSockets() = 0; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const std::string& group_name, | 202 const std::string& group_name, |
| 199 const scoped_refptr<typename PoolType::SocketParams>& params, | 203 const scoped_refptr<typename PoolType::SocketParams>& params, |
| 200 int num_sockets, | 204 int num_sockets, |
| 201 const NetLogWithSource& net_log) { | 205 const NetLogWithSource& net_log) { |
| 202 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); | 206 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); |
| 203 } | 207 } |
| 204 | 208 |
| 205 } // namespace net | 209 } // namespace net |
| 206 | 210 |
| 207 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 211 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |