Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: net/http/http_proxy_client_socket_pool.h

Issue 8340012: Close idle connections / SPDY sessions when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OVERRIDE Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ 5 #ifndef NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_
6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ 6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 scoped_ptr<ProxyClientSocket> transport_socket_; 160 scoped_ptr<ProxyClientSocket> transport_socket_;
161 bool using_spdy_; 161 bool using_spdy_;
162 162
163 HttpResponseInfo error_response_info_; 163 HttpResponseInfo error_response_info_;
164 164
165 scoped_refptr<SpdyStream> spdy_stream_; 165 scoped_refptr<SpdyStream> spdy_stream_;
166 166
167 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJob); 167 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJob);
168 }; 168 };
169 169
170 class NET_EXPORT_PRIVATE HttpProxyClientSocketPool : public ClientSocketPool { 170 class NET_EXPORT_PRIVATE HttpProxyClientSocketPool
171 : public ClientSocketPool, public LayeredPool {
171 public: 172 public:
172 HttpProxyClientSocketPool( 173 HttpProxyClientSocketPool(
173 int max_sockets, 174 int max_sockets,
174 int max_sockets_per_group, 175 int max_sockets_per_group,
175 ClientSocketPoolHistograms* histograms, 176 ClientSocketPoolHistograms* histograms,
176 HostResolver* host_resolver, 177 HostResolver* host_resolver,
177 TransportClientSocketPool* transport_pool, 178 TransportClientSocketPool* transport_pool,
178 SSLClientSocketPool* ssl_pool, 179 SSLClientSocketPool* ssl_pool,
179 NetLog* net_log); 180 NetLog* net_log);
180 181
181 virtual ~HttpProxyClientSocketPool(); 182 virtual ~HttpProxyClientSocketPool();
182 183
183 // ClientSocketPool methods: 184 // ClientSocketPool methods:
184 virtual int RequestSocket(const std::string& group_name, 185 virtual int RequestSocket(const std::string& group_name,
185 const void* connect_params, 186 const void* connect_params,
186 RequestPriority priority, 187 RequestPriority priority,
187 ClientSocketHandle* handle, 188 ClientSocketHandle* handle,
188 OldCompletionCallback* callback, 189 OldCompletionCallback* callback,
189 const BoundNetLog& net_log); 190 const BoundNetLog& net_log) OVERRIDE;
190 191
191 virtual void RequestSockets(const std::string& group_name, 192 virtual void RequestSockets(const std::string& group_name,
192 const void* params, 193 const void* params,
193 int num_sockets, 194 int num_sockets,
194 const BoundNetLog& net_log); 195 const BoundNetLog& net_log) OVERRIDE;
195 196
196 virtual void CancelRequest(const std::string& group_name, 197 virtual void CancelRequest(const std::string& group_name,
197 ClientSocketHandle* handle); 198 ClientSocketHandle* handle) OVERRIDE;
198 199
199 virtual void ReleaseSocket(const std::string& group_name, 200 virtual void ReleaseSocket(const std::string& group_name,
200 StreamSocket* socket, 201 StreamSocket* socket,
201 int id); 202 int id) OVERRIDE;
202 203
203 virtual void Flush(); 204 virtual void Flush() OVERRIDE;
204 205
205 virtual void CloseIdleSockets(); 206 virtual bool IsStalled() const OVERRIDE;
206 207
207 virtual int IdleSocketCount() const; 208 virtual void CloseIdleSockets() OVERRIDE;
208 209
209 virtual int IdleSocketCountInGroup(const std::string& group_name) const; 210 virtual int IdleSocketCount() const OVERRIDE;
210 211
211 virtual LoadState GetLoadState(const std::string& group_name, 212 virtual int IdleSocketCountInGroup(
212 const ClientSocketHandle* handle) const; 213 const std::string& group_name) const OVERRIDE;
214
215 virtual LoadState GetLoadState(
216 const std::string& group_name,
217 const ClientSocketHandle* handle) const OVERRIDE;
218
219 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE;
220
221 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE;
213 222
214 virtual base::DictionaryValue* GetInfoAsValue( 223 virtual base::DictionaryValue* GetInfoAsValue(
215 const std::string& name, 224 const std::string& name,
216 const std::string& type, 225 const std::string& type,
217 bool include_nested_pools) const; 226 bool include_nested_pools) const OVERRIDE;
218 227
219 virtual base::TimeDelta ConnectionTimeout() const; 228 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE;
220 229
221 virtual ClientSocketPoolHistograms* histograms() const; 230 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE;
231
232 // LayeredPool methods:
233 virtual bool CloseOneIdleConnection() OVERRIDE;
222 234
223 private: 235 private:
224 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; 236 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase;
225 237
226 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { 238 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory {
227 public: 239 public:
228 HttpProxyConnectJobFactory( 240 HttpProxyConnectJobFactory(
229 TransportClientSocketPool* transport_pool, 241 TransportClientSocketPool* transport_pool,
230 SSLClientSocketPool* ssl_pool, 242 SSLClientSocketPool* ssl_pool,
231 HostResolver* host_resolver, 243 HostResolver* host_resolver,
(...skipping 22 matching lines...) Expand all
254 266
255 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); 267 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool);
256 }; 268 };
257 269
258 REGISTER_SOCKET_PARAMS_FOR_POOL(HttpProxyClientSocketPool, 270 REGISTER_SOCKET_PARAMS_FOR_POOL(HttpProxyClientSocketPool,
259 HttpProxySocketParams); 271 HttpProxySocketParams);
260 272
261 } // namespace net 273 } // namespace net
262 274
263 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ 275 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698