| OLD | NEW | 
|---|
| 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/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_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/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" | 
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" | 
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 471                                      SSLClientSocketContext( | 471                                      SSLClientSocketContext( | 
| 472                                          cert_verifier, | 472                                          cert_verifier, | 
| 473                                          server_bound_cert_service, | 473                                          server_bound_cert_service, | 
| 474                                          transport_security_state, | 474                                          transport_security_state, | 
| 475                                          ssl_host_info_factory, | 475                                          ssl_host_info_factory, | 
| 476                                          ssl_session_cache_shard), | 476                                          ssl_session_cache_shard), | 
| 477                                      net_log)), | 477                                      net_log)), | 
| 478       ssl_config_service_(ssl_config_service) { | 478       ssl_config_service_(ssl_config_service) { | 
| 479   if (ssl_config_service_) | 479   if (ssl_config_service_) | 
| 480     ssl_config_service_->AddObserver(this); | 480     ssl_config_service_->AddObserver(this); | 
|  | 481   if (transport_pool_) | 
|  | 482     transport_pool_->AddLayeredPool(this); | 
|  | 483   if (socks_pool_) | 
|  | 484     socks_pool_->AddLayeredPool(this); | 
|  | 485   if (http_proxy_pool_) | 
|  | 486     http_proxy_pool_->AddLayeredPool(this); | 
| 481 } | 487 } | 
| 482 | 488 | 
| 483 SSLClientSocketPool::~SSLClientSocketPool() { | 489 SSLClientSocketPool::~SSLClientSocketPool() { | 
|  | 490   if (http_proxy_pool_) | 
|  | 491     http_proxy_pool_->RemoveLayeredPool(this); | 
|  | 492   if (socks_pool_) | 
|  | 493     socks_pool_->RemoveLayeredPool(this); | 
|  | 494   if (transport_pool_) | 
|  | 495     transport_pool_->RemoveLayeredPool(this); | 
| 484   if (ssl_config_service_) | 496   if (ssl_config_service_) | 
| 485     ssl_config_service_->RemoveObserver(this); | 497     ssl_config_service_->RemoveObserver(this); | 
| 486 } | 498 } | 
| 487 | 499 | 
| 488 ConnectJob* SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( | 500 ConnectJob* SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( | 
| 489     const std::string& group_name, | 501     const std::string& group_name, | 
| 490     const PoolBase::Request& request, | 502     const PoolBase::Request& request, | 
| 491     ConnectJob::Delegate* delegate) const { | 503     ConnectJob::Delegate* delegate) const { | 
| 492   return new SSLConnectJob(group_name, request.params(), ConnectionTimeout(), | 504   return new SSLConnectJob(group_name, request.params(), ConnectionTimeout(), | 
| 493                            transport_pool_, socks_pool_, http_proxy_pool_, | 505                            transport_pool_, socks_pool_, http_proxy_pool_, | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 526 | 538 | 
| 527 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name, | 539 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name, | 
| 528                                         StreamSocket* socket, int id) { | 540                                         StreamSocket* socket, int id) { | 
| 529   base_.ReleaseSocket(group_name, socket, id); | 541   base_.ReleaseSocket(group_name, socket, id); | 
| 530 } | 542 } | 
| 531 | 543 | 
| 532 void SSLClientSocketPool::Flush() { | 544 void SSLClientSocketPool::Flush() { | 
| 533   base_.Flush(); | 545   base_.Flush(); | 
| 534 } | 546 } | 
| 535 | 547 | 
|  | 548 bool SSLClientSocketPool::IsStalled() const { | 
|  | 549   return base_.IsStalled() || | 
|  | 550       (transport_pool_ && transport_pool_->IsStalled()) || | 
|  | 551       (socks_pool_ && socks_pool_->IsStalled()) || | 
|  | 552       (http_proxy_pool_ && http_proxy_pool_->IsStalled()); | 
|  | 553 } | 
|  | 554 | 
| 536 void SSLClientSocketPool::CloseIdleSockets() { | 555 void SSLClientSocketPool::CloseIdleSockets() { | 
| 537   base_.CloseIdleSockets(); | 556   base_.CloseIdleSockets(); | 
| 538 } | 557 } | 
| 539 | 558 | 
| 540 int SSLClientSocketPool::IdleSocketCount() const { | 559 int SSLClientSocketPool::IdleSocketCount() const { | 
| 541   return base_.idle_socket_count(); | 560   return base_.idle_socket_count(); | 
| 542 } | 561 } | 
| 543 | 562 | 
| 544 int SSLClientSocketPool::IdleSocketCountInGroup( | 563 int SSLClientSocketPool::IdleSocketCountInGroup( | 
| 545     const std::string& group_name) const { | 564     const std::string& group_name) const { | 
| 546   return base_.IdleSocketCountInGroup(group_name); | 565   return base_.IdleSocketCountInGroup(group_name); | 
| 547 } | 566 } | 
| 548 | 567 | 
| 549 LoadState SSLClientSocketPool::GetLoadState( | 568 LoadState SSLClientSocketPool::GetLoadState( | 
| 550     const std::string& group_name, const ClientSocketHandle* handle) const { | 569     const std::string& group_name, const ClientSocketHandle* handle) const { | 
| 551   return base_.GetLoadState(group_name, handle); | 570   return base_.GetLoadState(group_name, handle); | 
| 552 } | 571 } | 
| 553 | 572 | 
|  | 573 void SSLClientSocketPool::AddLayeredPool(LayeredPool* layered_pool) { | 
|  | 574   base_.AddLayeredPool(layered_pool); | 
|  | 575 } | 
|  | 576 | 
|  | 577 void SSLClientSocketPool::RemoveLayeredPool(LayeredPool* layered_pool) { | 
|  | 578   base_.RemoveLayeredPool(layered_pool); | 
|  | 579 } | 
|  | 580 | 
| 554 DictionaryValue* SSLClientSocketPool::GetInfoAsValue( | 581 DictionaryValue* SSLClientSocketPool::GetInfoAsValue( | 
| 555     const std::string& name, | 582     const std::string& name, | 
| 556     const std::string& type, | 583     const std::string& type, | 
| 557     bool include_nested_pools) const { | 584     bool include_nested_pools) const { | 
| 558   DictionaryValue* dict = base_.GetInfoAsValue(name, type); | 585   DictionaryValue* dict = base_.GetInfoAsValue(name, type); | 
| 559   if (include_nested_pools) { | 586   if (include_nested_pools) { | 
| 560     ListValue* list = new ListValue(); | 587     ListValue* list = new ListValue(); | 
| 561     if (transport_pool_) { | 588     if (transport_pool_) { | 
| 562       list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", | 589       list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", | 
| 563                                                    "transport_socket_pool", | 590                                                    "transport_socket_pool", | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 583 } | 610 } | 
| 584 | 611 | 
| 585 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const { | 612 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const { | 
| 586   return base_.histograms(); | 613   return base_.histograms(); | 
| 587 } | 614 } | 
| 588 | 615 | 
| 589 void SSLClientSocketPool::OnSSLConfigChanged() { | 616 void SSLClientSocketPool::OnSSLConfigChanged() { | 
| 590   Flush(); | 617   Flush(); | 
| 591 } | 618 } | 
| 592 | 619 | 
|  | 620 bool SSLClientSocketPool::CloseOneIdleConnection() { | 
|  | 621   if (base_.CloseOneIdleSocket()) | 
|  | 622     return true; | 
|  | 623   return base_.CloseOneIdleConnectionInLayeredPool(); | 
|  | 624 } | 
|  | 625 | 
| 593 }  // namespace net | 626 }  // namespace net | 
| OLD | NEW | 
|---|