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

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

Issue 8745007: Revert 112130 - Close idle connections / SPDY sessions when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/ssl_client_socket_pool.h ('k') | net/socket/transport_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) 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 #include "net/socket/ssl_client_socket_pool.h" 5 #include "net/socket/ssl_client_socket_pool.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 SSLClientSocketContext( 469 SSLClientSocketContext(
470 cert_verifier, 470 cert_verifier,
471 origin_bound_cert_service, 471 origin_bound_cert_service,
472 dnsrr_resolver, 472 dnsrr_resolver,
473 dns_cert_checker, 473 dns_cert_checker,
474 ssl_host_info_factory), 474 ssl_host_info_factory),
475 net_log)), 475 net_log)),
476 ssl_config_service_(ssl_config_service) { 476 ssl_config_service_(ssl_config_service) {
477 if (ssl_config_service_) 477 if (ssl_config_service_)
478 ssl_config_service_->AddObserver(this); 478 ssl_config_service_->AddObserver(this);
479 if (transport_pool_)
480 transport_pool_->AddLayeredPool(this);
481 if (socks_pool_)
482 socks_pool_->AddLayeredPool(this);
483 if (http_proxy_pool_)
484 http_proxy_pool_->AddLayeredPool(this);
485 } 479 }
486 480
487 SSLClientSocketPool::~SSLClientSocketPool() { 481 SSLClientSocketPool::~SSLClientSocketPool() {
488 if (http_proxy_pool_)
489 http_proxy_pool_->RemoveLayeredPool(this);
490 if (socks_pool_)
491 socks_pool_->RemoveLayeredPool(this);
492 if (transport_pool_)
493 transport_pool_->RemoveLayeredPool(this);
494 if (ssl_config_service_) 482 if (ssl_config_service_)
495 ssl_config_service_->RemoveObserver(this); 483 ssl_config_service_->RemoveObserver(this);
496 } 484 }
497 485
498 ConnectJob* SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( 486 ConnectJob* SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob(
499 const std::string& group_name, 487 const std::string& group_name,
500 const PoolBase::Request& request, 488 const PoolBase::Request& request,
501 ConnectJob::Delegate* delegate) const { 489 ConnectJob::Delegate* delegate) const {
502 return new SSLConnectJob(group_name, request.params(), ConnectionTimeout(), 490 return new SSLConnectJob(group_name, request.params(), ConnectionTimeout(),
503 transport_pool_, socks_pool_, http_proxy_pool_, 491 transport_pool_, socks_pool_, http_proxy_pool_,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 524
537 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name, 525 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name,
538 StreamSocket* socket, int id) { 526 StreamSocket* socket, int id) {
539 base_.ReleaseSocket(group_name, socket, id); 527 base_.ReleaseSocket(group_name, socket, id);
540 } 528 }
541 529
542 void SSLClientSocketPool::Flush() { 530 void SSLClientSocketPool::Flush() {
543 base_.Flush(); 531 base_.Flush();
544 } 532 }
545 533
546 bool SSLClientSocketPool::IsStalled() const {
547 return base_.IsStalled() ||
548 (transport_pool_ && transport_pool_->IsStalled()) ||
549 (socks_pool_ && socks_pool_->IsStalled()) ||
550 (http_proxy_pool_ && http_proxy_pool_->IsStalled());
551 }
552
553 void SSLClientSocketPool::CloseIdleSockets() { 534 void SSLClientSocketPool::CloseIdleSockets() {
554 base_.CloseIdleSockets(); 535 base_.CloseIdleSockets();
555 } 536 }
556 537
557 int SSLClientSocketPool::IdleSocketCount() const { 538 int SSLClientSocketPool::IdleSocketCount() const {
558 return base_.idle_socket_count(); 539 return base_.idle_socket_count();
559 } 540 }
560 541
561 int SSLClientSocketPool::IdleSocketCountInGroup( 542 int SSLClientSocketPool::IdleSocketCountInGroup(
562 const std::string& group_name) const { 543 const std::string& group_name) const {
563 return base_.IdleSocketCountInGroup(group_name); 544 return base_.IdleSocketCountInGroup(group_name);
564 } 545 }
565 546
566 LoadState SSLClientSocketPool::GetLoadState( 547 LoadState SSLClientSocketPool::GetLoadState(
567 const std::string& group_name, const ClientSocketHandle* handle) const { 548 const std::string& group_name, const ClientSocketHandle* handle) const {
568 return base_.GetLoadState(group_name, handle); 549 return base_.GetLoadState(group_name, handle);
569 } 550 }
570 551
571 void SSLClientSocketPool::AddLayeredPool(LayeredPool* layered_pool) {
572 base_.AddLayeredPool(layered_pool);
573 }
574
575 void SSLClientSocketPool::RemoveLayeredPool(LayeredPool* layered_pool) {
576 base_.RemoveLayeredPool(layered_pool);
577 }
578
579 DictionaryValue* SSLClientSocketPool::GetInfoAsValue( 552 DictionaryValue* SSLClientSocketPool::GetInfoAsValue(
580 const std::string& name, 553 const std::string& name,
581 const std::string& type, 554 const std::string& type,
582 bool include_nested_pools) const { 555 bool include_nested_pools) const {
583 DictionaryValue* dict = base_.GetInfoAsValue(name, type); 556 DictionaryValue* dict = base_.GetInfoAsValue(name, type);
584 if (include_nested_pools) { 557 if (include_nested_pools) {
585 ListValue* list = new ListValue(); 558 ListValue* list = new ListValue();
586 if (transport_pool_) { 559 if (transport_pool_) {
587 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", 560 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool",
588 "transport_socket_pool", 561 "transport_socket_pool",
(...skipping 19 matching lines...) Expand all
608 } 581 }
609 582
610 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const { 583 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const {
611 return base_.histograms(); 584 return base_.histograms();
612 } 585 }
613 586
614 void SSLClientSocketPool::OnSSLConfigChanged() { 587 void SSLClientSocketPool::OnSSLConfigChanged() {
615 Flush(); 588 Flush();
616 } 589 }
617 590
618 bool SSLClientSocketPool::CloseOneIdleConnection() {
619 if (base_.CloseOneIdleSocket())
620 return true;
621 return base_.CloseOneIdleConnectionInLayeredPool();
622 }
623
624 } // namespace net 591 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_pool.h ('k') | net/socket/transport_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698