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

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

Issue 10026024: Attempting to re-land a small portion of this change... Simply add links from (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix willchan's nit Created 8 years, 8 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/http/http_proxy_client_socket_pool.h ('k') | net/socket/client_socket_handle.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/http/http_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 SSLClientSocketPool* ssl_pool, 390 SSLClientSocketPool* ssl_pool,
391 NetLog* net_log) 391 NetLog* net_log)
392 : transport_pool_(transport_pool), 392 : transport_pool_(transport_pool),
393 ssl_pool_(ssl_pool), 393 ssl_pool_(ssl_pool),
394 base_(max_sockets, max_sockets_per_group, histograms, 394 base_(max_sockets, max_sockets_per_group, histograms,
395 ClientSocketPool::unused_idle_socket_timeout(), 395 ClientSocketPool::unused_idle_socket_timeout(),
396 ClientSocketPool::used_idle_socket_timeout(), 396 ClientSocketPool::used_idle_socket_timeout(),
397 new HttpProxyConnectJobFactory(transport_pool, 397 new HttpProxyConnectJobFactory(transport_pool,
398 ssl_pool, 398 ssl_pool,
399 host_resolver, 399 host_resolver,
400 net_log)) {} 400 net_log)) {
401 // We should always have a |transport_pool_| except in unit tests.
402 if (transport_pool_)
403 transport_pool_->AddLayeredPool(this);
404 if (ssl_pool_)
405 ssl_pool_->AddLayeredPool(this);
406 }
401 407
402 HttpProxyClientSocketPool::~HttpProxyClientSocketPool() {} 408 HttpProxyClientSocketPool::~HttpProxyClientSocketPool() {
409 if (ssl_pool_)
410 ssl_pool_->RemoveLayeredPool(this);
411 // We should always have a |transport_pool_| except in unit tests.
412 if (transport_pool_)
413 transport_pool_->RemoveLayeredPool(this);
414 }
403 415
404 int HttpProxyClientSocketPool::RequestSocket( 416 int HttpProxyClientSocketPool::RequestSocket(
405 const std::string& group_name, const void* socket_params, 417 const std::string& group_name, const void* socket_params,
406 RequestPriority priority, ClientSocketHandle* handle, 418 RequestPriority priority, ClientSocketHandle* handle,
407 const CompletionCallback& callback, const BoundNetLog& net_log) { 419 const CompletionCallback& callback, const BoundNetLog& net_log) {
408 const scoped_refptr<HttpProxySocketParams>* casted_socket_params = 420 const scoped_refptr<HttpProxySocketParams>* casted_socket_params =
409 static_cast<const scoped_refptr<HttpProxySocketParams>*>(socket_params); 421 static_cast<const scoped_refptr<HttpProxySocketParams>*>(socket_params);
410 422
411 return base_.RequestSocket(group_name, *casted_socket_params, priority, 423 return base_.RequestSocket(group_name, *casted_socket_params, priority,
412 handle, callback, net_log); 424 handle, callback, net_log);
(...skipping 18 matching lines...) Expand all
431 443
432 void HttpProxyClientSocketPool::ReleaseSocket(const std::string& group_name, 444 void HttpProxyClientSocketPool::ReleaseSocket(const std::string& group_name,
433 StreamSocket* socket, int id) { 445 StreamSocket* socket, int id) {
434 base_.ReleaseSocket(group_name, socket, id); 446 base_.ReleaseSocket(group_name, socket, id);
435 } 447 }
436 448
437 void HttpProxyClientSocketPool::Flush() { 449 void HttpProxyClientSocketPool::Flush() {
438 base_.Flush(); 450 base_.Flush();
439 } 451 }
440 452
453 bool HttpProxyClientSocketPool::IsStalled() const {
454 return base_.IsStalled() ||
455 (transport_pool_ && transport_pool_->IsStalled()) ||
456 (ssl_pool_ && ssl_pool_->IsStalled());
457 }
458
441 void HttpProxyClientSocketPool::CloseIdleSockets() { 459 void HttpProxyClientSocketPool::CloseIdleSockets() {
442 base_.CloseIdleSockets(); 460 base_.CloseIdleSockets();
443 } 461 }
444 462
445 int HttpProxyClientSocketPool::IdleSocketCount() const { 463 int HttpProxyClientSocketPool::IdleSocketCount() const {
446 return base_.idle_socket_count(); 464 return base_.idle_socket_count();
447 } 465 }
448 466
449 int HttpProxyClientSocketPool::IdleSocketCountInGroup( 467 int HttpProxyClientSocketPool::IdleSocketCountInGroup(
450 const std::string& group_name) const { 468 const std::string& group_name) const {
451 return base_.IdleSocketCountInGroup(group_name); 469 return base_.IdleSocketCountInGroup(group_name);
452 } 470 }
453 471
454 LoadState HttpProxyClientSocketPool::GetLoadState( 472 LoadState HttpProxyClientSocketPool::GetLoadState(
455 const std::string& group_name, const ClientSocketHandle* handle) const { 473 const std::string& group_name, const ClientSocketHandle* handle) const {
456 return base_.GetLoadState(group_name, handle); 474 return base_.GetLoadState(group_name, handle);
457 } 475 }
458 476
477 void HttpProxyClientSocketPool::AddLayeredPool(LayeredPool* layered_pool) {
478 base_.AddLayeredPool(layered_pool);
479 }
480
481 void HttpProxyClientSocketPool::RemoveLayeredPool(LayeredPool* layered_pool) {
482 base_.RemoveLayeredPool(layered_pool);
483 }
484
459 DictionaryValue* HttpProxyClientSocketPool::GetInfoAsValue( 485 DictionaryValue* HttpProxyClientSocketPool::GetInfoAsValue(
460 const std::string& name, 486 const std::string& name,
461 const std::string& type, 487 const std::string& type,
462 bool include_nested_pools) const { 488 bool include_nested_pools) const {
463 DictionaryValue* dict = base_.GetInfoAsValue(name, type); 489 DictionaryValue* dict = base_.GetInfoAsValue(name, type);
464 if (include_nested_pools) { 490 if (include_nested_pools) {
465 ListValue* list = new ListValue(); 491 ListValue* list = new ListValue();
466 if (transport_pool_) { 492 if (transport_pool_) {
467 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", 493 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool",
468 "transport_socket_pool", 494 "transport_socket_pool",
(...skipping 10 matching lines...) Expand all
479 } 505 }
480 506
481 base::TimeDelta HttpProxyClientSocketPool::ConnectionTimeout() const { 507 base::TimeDelta HttpProxyClientSocketPool::ConnectionTimeout() const {
482 return base_.ConnectionTimeout(); 508 return base_.ConnectionTimeout();
483 } 509 }
484 510
485 ClientSocketPoolHistograms* HttpProxyClientSocketPool::histograms() const { 511 ClientSocketPoolHistograms* HttpProxyClientSocketPool::histograms() const {
486 return base_.histograms(); 512 return base_.histograms();
487 } 513 }
488 514
515 bool HttpProxyClientSocketPool::CloseOneIdleConnection() {
516 if (base_.CloseOneIdleSocket())
517 return true;
518 return base_.CloseOneIdleConnectionInLayeredPool();
519 }
520
489 } // namespace net 521 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_pool.h ('k') | net/socket/client_socket_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698