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