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