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

Side by Side Diff: net/socket/socks_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_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
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 : 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();
119 120
120 // ClientSocketPool methods: 121 // ClientSocketPool methods:
121 virtual int RequestSocket(const std::string& group_name, 122 virtual int RequestSocket(const std::string& group_name,
122 const void* connect_params, 123 const void* connect_params,
123 RequestPriority priority, 124 RequestPriority priority,
124 ClientSocketHandle* handle, 125 ClientSocketHandle* handle,
125 OldCompletionCallback* callback, 126 OldCompletionCallback* callback,
126 const BoundNetLog& net_log); 127 const BoundNetLog& net_log) OVERRIDE;
127 128
128 virtual void RequestSockets(const std::string& group_name, 129 virtual void RequestSockets(const std::string& group_name,
129 const void* params, 130 const void* params,
130 int num_sockets, 131 int num_sockets,
131 const BoundNetLog& net_log); 132 const BoundNetLog& net_log) OVERRIDE;
132 133
133 virtual void CancelRequest(const std::string& group_name, 134 virtual void CancelRequest(const std::string& group_name,
134 ClientSocketHandle* handle); 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); 139 int id) OVERRIDE;
139 140
140 virtual void Flush(); 141 virtual void Flush() OVERRIDE;
141 142
142 virtual void CloseIdleSockets(); 143 virtual bool IsStalled() const OVERRIDE;
143 144
144 virtual int IdleSocketCount() const; 145 virtual void CloseIdleSockets() OVERRIDE;
145 146
146 virtual int IdleSocketCountInGroup(const std::string& group_name) const; 147 virtual int IdleSocketCount() const OVERRIDE;
147 148
148 virtual LoadState GetLoadState(const std::string& group_name, 149 virtual int IdleSocketCountInGroup(
149 const ClientSocketHandle* handle) const; 150 const std::string& group_name) const OVERRIDE;
151
152 virtual LoadState GetLoadState(
153 const std::string& group_name,
154 const ClientSocketHandle* handle) const OVERRIDE;
155
156 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE;
157
158 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE;
150 159
151 virtual base::DictionaryValue* GetInfoAsValue( 160 virtual base::DictionaryValue* GetInfoAsValue(
152 const std::string& name, 161 const std::string& name,
153 const std::string& type, 162 const std::string& type,
154 bool include_nested_pools) const; 163 bool include_nested_pools) const OVERRIDE;
155 164
156 virtual base::TimeDelta ConnectionTimeout() const; 165 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE;
157 166
158 virtual ClientSocketPoolHistograms* histograms() const; 167 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE;
168
169 // LayeredPool methods:
170 virtual bool CloseOneIdleConnection() OVERRIDE;
159 171
160 private: 172 private:
161 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase; 173 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase;
162 174
163 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory { 175 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory {
164 public: 176 public:
165 SOCKSConnectJobFactory(TransportClientSocketPool* transport_pool, 177 SOCKSConnectJobFactory(TransportClientSocketPool* transport_pool,
166 HostResolver* host_resolver, 178 HostResolver* host_resolver,
167 NetLog* net_log) 179 NetLog* net_log)
168 : transport_pool_(transport_pool), 180 : transport_pool_(transport_pool),
(...skipping 22 matching lines...) Expand all
191 PoolBase base_; 203 PoolBase base_;
192 204
193 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); 205 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool);
194 }; 206 };
195 207
196 REGISTER_SOCKET_PARAMS_FOR_POOL(SOCKSClientSocketPool, SOCKSSocketParams); 208 REGISTER_SOCKET_PARAMS_FOR_POOL(SOCKSClientSocketPool, SOCKSSocketParams);
197 209
198 } // namespace net 210 } // namespace net
199 211
200 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ 212 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698