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_SOCKS_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 State next_state_; | 101 State next_state_; |
102 CompletionCallback callback_; | 102 CompletionCallback callback_; |
103 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 103 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
104 scoped_ptr<StreamSocket> socket_; | 104 scoped_ptr<StreamSocket> socket_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob); | 106 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob); |
107 }; | 107 }; |
108 | 108 |
109 class NET_EXPORT_PRIVATE SOCKSClientSocketPool | 109 class NET_EXPORT_PRIVATE SOCKSClientSocketPool |
110 : public ClientSocketPool, public LayeredPool { | 110 : public ClientSocketPool, public HigherLayeredPool { |
111 public: | 111 public: |
112 typedef SOCKSSocketParams SocketParams; | 112 typedef SOCKSSocketParams SocketParams; |
113 | 113 |
114 SOCKSClientSocketPool( | 114 SOCKSClientSocketPool( |
115 int max_sockets, | 115 int max_sockets, |
116 int max_sockets_per_group, | 116 int max_sockets_per_group, |
117 ClientSocketPoolHistograms* histograms, | 117 ClientSocketPoolHistograms* histograms, |
118 HostResolver* host_resolver, | 118 HostResolver* host_resolver, |
119 TransportClientSocketPool* transport_pool, | 119 TransportClientSocketPool* transport_pool, |
120 NetLog* net_log); | 120 NetLog* net_log); |
(...skipping 15 matching lines...) Expand all Loading... |
136 | 136 |
137 virtual void CancelRequest(const std::string& group_name, | 137 virtual void CancelRequest(const std::string& group_name, |
138 ClientSocketHandle* handle) OVERRIDE; | 138 ClientSocketHandle* handle) OVERRIDE; |
139 | 139 |
140 virtual void ReleaseSocket(const std::string& group_name, | 140 virtual void ReleaseSocket(const std::string& group_name, |
141 scoped_ptr<StreamSocket> socket, | 141 scoped_ptr<StreamSocket> socket, |
142 int id) OVERRIDE; | 142 int id) OVERRIDE; |
143 | 143 |
144 virtual void FlushWithError(int error) OVERRIDE; | 144 virtual void FlushWithError(int error) OVERRIDE; |
145 | 145 |
146 virtual bool IsStalled() const OVERRIDE; | |
147 | |
148 virtual void CloseIdleSockets() OVERRIDE; | 146 virtual void CloseIdleSockets() OVERRIDE; |
149 | 147 |
150 virtual int IdleSocketCount() const OVERRIDE; | 148 virtual int IdleSocketCount() const OVERRIDE; |
151 | 149 |
152 virtual int IdleSocketCountInGroup( | 150 virtual int IdleSocketCountInGroup( |
153 const std::string& group_name) const OVERRIDE; | 151 const std::string& group_name) const OVERRIDE; |
154 | 152 |
155 virtual LoadState GetLoadState( | 153 virtual LoadState GetLoadState( |
156 const std::string& group_name, | 154 const std::string& group_name, |
157 const ClientSocketHandle* handle) const OVERRIDE; | 155 const ClientSocketHandle* handle) const OVERRIDE; |
158 | 156 |
159 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE; | |
160 | |
161 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE; | |
162 | |
163 virtual base::DictionaryValue* GetInfoAsValue( | 157 virtual base::DictionaryValue* GetInfoAsValue( |
164 const std::string& name, | 158 const std::string& name, |
165 const std::string& type, | 159 const std::string& type, |
166 bool include_nested_pools) const OVERRIDE; | 160 bool include_nested_pools) const OVERRIDE; |
167 | 161 |
168 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; | 162 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; |
169 | 163 |
170 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; | 164 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; |
171 | 165 |
172 // LayeredPool implementation. | 166 // LowerLayeredPool implementation. |
| 167 virtual bool IsStalled() const OVERRIDE; |
| 168 |
| 169 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; |
| 170 |
| 171 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; |
| 172 |
| 173 // HigherLayeredPool implementation. |
173 virtual bool CloseOneIdleConnection() OVERRIDE; | 174 virtual bool CloseOneIdleConnection() OVERRIDE; |
174 | 175 |
175 private: | 176 private: |
176 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase; | 177 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase; |
177 | 178 |
178 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory { | 179 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory { |
179 public: | 180 public: |
180 SOCKSConnectJobFactory(TransportClientSocketPool* transport_pool, | 181 SOCKSConnectJobFactory(TransportClientSocketPool* transport_pool, |
181 HostResolver* host_resolver, | 182 HostResolver* host_resolver, |
182 NetLog* net_log) | 183 NetLog* net_log) |
(...skipping 21 matching lines...) Expand all Loading... |
204 | 205 |
205 TransportClientSocketPool* const transport_pool_; | 206 TransportClientSocketPool* const transport_pool_; |
206 PoolBase base_; | 207 PoolBase base_; |
207 | 208 |
208 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); | 209 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); |
209 }; | 210 }; |
210 | 211 |
211 } // namespace net | 212 } // namespace net |
212 | 213 |
213 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ | 214 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |