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