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

Side by Side Diff: net/socket/socks_client_socket_pool.cc

Issue 9760002: Revert 127717 - Revert 118788 - Revert 113405 - Revert 113305 - Revert 113300 - Revert 112134 - Rev… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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
« no previous file with comments | « net/socket/socks_client_socket_pool.h ('k') | net/socket/ssl_client_socket_pool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "net/socket/socks_client_socket_pool.h" 5 #include "net/socket/socks_client_socket_pool.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 HostResolver* host_resolver, 192 HostResolver* host_resolver,
193 TransportClientSocketPool* transport_pool, 193 TransportClientSocketPool* transport_pool,
194 NetLog* net_log) 194 NetLog* net_log)
195 : transport_pool_(transport_pool), 195 : transport_pool_(transport_pool),
196 base_(max_sockets, max_sockets_per_group, histograms, 196 base_(max_sockets, max_sockets_per_group, histograms,
197 ClientSocketPool::unused_idle_socket_timeout(), 197 ClientSocketPool::unused_idle_socket_timeout(),
198 ClientSocketPool::used_idle_socket_timeout(), 198 ClientSocketPool::used_idle_socket_timeout(),
199 new SOCKSConnectJobFactory(transport_pool, 199 new SOCKSConnectJobFactory(transport_pool,
200 host_resolver, 200 host_resolver,
201 net_log)) { 201 net_log)) {
202 // We should always have a |transport_pool_| except in unit tests.
203 if (transport_pool_)
204 transport_pool_->AddLayeredPool(this);
205 } 202 }
206 203
207 SOCKSClientSocketPool::~SOCKSClientSocketPool() { 204 SOCKSClientSocketPool::~SOCKSClientSocketPool() {}
208 // We should always have a |transport_pool_| except in unit tests.
209 if (transport_pool_)
210 transport_pool_->RemoveLayeredPool(this);
211 }
212 205
213 int SOCKSClientSocketPool::RequestSocket( 206 int SOCKSClientSocketPool::RequestSocket(
214 const std::string& group_name, const void* socket_params, 207 const std::string& group_name, const void* socket_params,
215 RequestPriority priority, ClientSocketHandle* handle, 208 RequestPriority priority, ClientSocketHandle* handle,
216 const CompletionCallback& callback, const BoundNetLog& net_log) { 209 const CompletionCallback& callback, const BoundNetLog& net_log) {
217 const scoped_refptr<SOCKSSocketParams>* casted_socket_params = 210 const scoped_refptr<SOCKSSocketParams>* casted_socket_params =
218 static_cast<const scoped_refptr<SOCKSSocketParams>*>(socket_params); 211 static_cast<const scoped_refptr<SOCKSSocketParams>*>(socket_params);
219 212
220 return base_.RequestSocket(group_name, *casted_socket_params, priority, 213 return base_.RequestSocket(group_name, *casted_socket_params, priority,
221 handle, callback, net_log); 214 handle, callback, net_log);
(...skipping 17 matching lines...) Expand all
239 232
240 void SOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, 233 void SOCKSClientSocketPool::ReleaseSocket(const std::string& group_name,
241 StreamSocket* socket, int id) { 234 StreamSocket* socket, int id) {
242 base_.ReleaseSocket(group_name, socket, id); 235 base_.ReleaseSocket(group_name, socket, id);
243 } 236 }
244 237
245 void SOCKSClientSocketPool::Flush() { 238 void SOCKSClientSocketPool::Flush() {
246 base_.Flush(); 239 base_.Flush();
247 } 240 }
248 241
249 bool SOCKSClientSocketPool::IsStalled() const {
250 return base_.IsStalled() || transport_pool_->IsStalled();
251 }
252
253 void SOCKSClientSocketPool::CloseIdleSockets() { 242 void SOCKSClientSocketPool::CloseIdleSockets() {
254 base_.CloseIdleSockets(); 243 base_.CloseIdleSockets();
255 } 244 }
256 245
257 int SOCKSClientSocketPool::IdleSocketCount() const { 246 int SOCKSClientSocketPool::IdleSocketCount() const {
258 return base_.idle_socket_count(); 247 return base_.idle_socket_count();
259 } 248 }
260 249
261 int SOCKSClientSocketPool::IdleSocketCountInGroup( 250 int SOCKSClientSocketPool::IdleSocketCountInGroup(
262 const std::string& group_name) const { 251 const std::string& group_name) const {
263 return base_.IdleSocketCountInGroup(group_name); 252 return base_.IdleSocketCountInGroup(group_name);
264 } 253 }
265 254
266 LoadState SOCKSClientSocketPool::GetLoadState( 255 LoadState SOCKSClientSocketPool::GetLoadState(
267 const std::string& group_name, const ClientSocketHandle* handle) const { 256 const std::string& group_name, const ClientSocketHandle* handle) const {
268 return base_.GetLoadState(group_name, handle); 257 return base_.GetLoadState(group_name, handle);
269 } 258 }
270 259
271 void SOCKSClientSocketPool::AddLayeredPool(LayeredPool* layered_pool) {
272 base_.AddLayeredPool(layered_pool);
273 }
274
275 void SOCKSClientSocketPool::RemoveLayeredPool(LayeredPool* layered_pool) {
276 base_.RemoveLayeredPool(layered_pool);
277 }
278
279 DictionaryValue* SOCKSClientSocketPool::GetInfoAsValue( 260 DictionaryValue* SOCKSClientSocketPool::GetInfoAsValue(
280 const std::string& name, 261 const std::string& name,
281 const std::string& type, 262 const std::string& type,
282 bool include_nested_pools) const { 263 bool include_nested_pools) const {
283 DictionaryValue* dict = base_.GetInfoAsValue(name, type); 264 DictionaryValue* dict = base_.GetInfoAsValue(name, type);
284 if (include_nested_pools) { 265 if (include_nested_pools) {
285 ListValue* list = new ListValue(); 266 ListValue* list = new ListValue();
286 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", 267 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool",
287 "transport_socket_pool", 268 "transport_socket_pool",
288 false)); 269 false));
289 dict->Set("nested_pools", list); 270 dict->Set("nested_pools", list);
290 } 271 }
291 return dict; 272 return dict;
292 } 273 }
293 274
294 base::TimeDelta SOCKSClientSocketPool::ConnectionTimeout() const { 275 base::TimeDelta SOCKSClientSocketPool::ConnectionTimeout() const {
295 return base_.ConnectionTimeout(); 276 return base_.ConnectionTimeout();
296 } 277 }
297 278
298 ClientSocketPoolHistograms* SOCKSClientSocketPool::histograms() const { 279 ClientSocketPoolHistograms* SOCKSClientSocketPool::histograms() const {
299 return base_.histograms(); 280 return base_.histograms();
300 }; 281 };
301 282
302 bool SOCKSClientSocketPool::CloseOneIdleConnection() {
303 if (base_.CloseOneIdleSocket())
304 return true;
305 return base_.CloseOneIdleConnectionInLayeredPool();
306 }
307
308 } // namespace net 283 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socks_client_socket_pool.h ('k') | net/socket/ssl_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698