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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 base_.AddLowerLayeredPool(socks_pool_); | 544 base_.AddLowerLayeredPool(socks_pool_); |
545 if (http_proxy_pool_) | 545 if (http_proxy_pool_) |
546 base_.AddLowerLayeredPool(http_proxy_pool_); | 546 base_.AddLowerLayeredPool(http_proxy_pool_); |
547 } | 547 } |
548 | 548 |
549 SSLClientSocketPool::~SSLClientSocketPool() { | 549 SSLClientSocketPool::~SSLClientSocketPool() { |
550 if (ssl_config_service_.get()) | 550 if (ssl_config_service_.get()) |
551 ssl_config_service_->RemoveObserver(this); | 551 ssl_config_service_->RemoveObserver(this); |
552 } | 552 } |
553 | 553 |
554 scoped_ptr<ConnectJob> SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( | 554 std::unique_ptr<ConnectJob> |
| 555 SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( |
555 const std::string& group_name, | 556 const std::string& group_name, |
556 const PoolBase::Request& request, | 557 const PoolBase::Request& request, |
557 ConnectJob::Delegate* delegate) const { | 558 ConnectJob::Delegate* delegate) const { |
558 return scoped_ptr<ConnectJob>(new SSLConnectJob( | 559 return std::unique_ptr<ConnectJob>(new SSLConnectJob( |
559 group_name, request.priority(), request.respect_limits(), | 560 group_name, request.priority(), request.respect_limits(), |
560 request.params(), ConnectionTimeout(), transport_pool_, socks_pool_, | 561 request.params(), ConnectionTimeout(), transport_pool_, socks_pool_, |
561 http_proxy_pool_, client_socket_factory_, context_, delegate, net_log_)); | 562 http_proxy_pool_, client_socket_factory_, context_, delegate, net_log_)); |
562 } | 563 } |
563 | 564 |
564 base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout() | 565 base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout() |
565 const { | 566 const { |
566 return timeout_; | 567 return timeout_; |
567 } | 568 } |
568 | 569 |
(...skipping 21 matching lines...) Expand all Loading... |
590 | 591 |
591 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); | 592 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); |
592 } | 593 } |
593 | 594 |
594 void SSLClientSocketPool::CancelRequest(const std::string& group_name, | 595 void SSLClientSocketPool::CancelRequest(const std::string& group_name, |
595 ClientSocketHandle* handle) { | 596 ClientSocketHandle* handle) { |
596 base_.CancelRequest(group_name, handle); | 597 base_.CancelRequest(group_name, handle); |
597 } | 598 } |
598 | 599 |
599 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name, | 600 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name, |
600 scoped_ptr<StreamSocket> socket, | 601 std::unique_ptr<StreamSocket> socket, |
601 int id) { | 602 int id) { |
602 base_.ReleaseSocket(group_name, std::move(socket), id); | 603 base_.ReleaseSocket(group_name, std::move(socket), id); |
603 } | 604 } |
604 | 605 |
605 void SSLClientSocketPool::FlushWithError(int error) { | 606 void SSLClientSocketPool::FlushWithError(int error) { |
606 base_.FlushWithError(error); | 607 base_.FlushWithError(error); |
607 } | 608 } |
608 | 609 |
609 void SSLClientSocketPool::CloseIdleSockets() { | 610 void SSLClientSocketPool::CloseIdleSockets() { |
610 base_.CloseIdleSockets(); | 611 base_.CloseIdleSockets(); |
611 } | 612 } |
612 | 613 |
613 int SSLClientSocketPool::IdleSocketCount() const { | 614 int SSLClientSocketPool::IdleSocketCount() const { |
614 return base_.idle_socket_count(); | 615 return base_.idle_socket_count(); |
615 } | 616 } |
616 | 617 |
617 int SSLClientSocketPool::IdleSocketCountInGroup( | 618 int SSLClientSocketPool::IdleSocketCountInGroup( |
618 const std::string& group_name) const { | 619 const std::string& group_name) const { |
619 return base_.IdleSocketCountInGroup(group_name); | 620 return base_.IdleSocketCountInGroup(group_name); |
620 } | 621 } |
621 | 622 |
622 LoadState SSLClientSocketPool::GetLoadState( | 623 LoadState SSLClientSocketPool::GetLoadState( |
623 const std::string& group_name, const ClientSocketHandle* handle) const { | 624 const std::string& group_name, const ClientSocketHandle* handle) const { |
624 return base_.GetLoadState(group_name, handle); | 625 return base_.GetLoadState(group_name, handle); |
625 } | 626 } |
626 | 627 |
627 scoped_ptr<base::DictionaryValue> SSLClientSocketPool::GetInfoAsValue( | 628 std::unique_ptr<base::DictionaryValue> SSLClientSocketPool::GetInfoAsValue( |
628 const std::string& name, | 629 const std::string& name, |
629 const std::string& type, | 630 const std::string& type, |
630 bool include_nested_pools) const { | 631 bool include_nested_pools) const { |
631 scoped_ptr<base::DictionaryValue> dict(base_.GetInfoAsValue(name, type)); | 632 std::unique_ptr<base::DictionaryValue> dict(base_.GetInfoAsValue(name, type)); |
632 if (include_nested_pools) { | 633 if (include_nested_pools) { |
633 base::ListValue* list = new base::ListValue(); | 634 base::ListValue* list = new base::ListValue(); |
634 if (transport_pool_) { | 635 if (transport_pool_) { |
635 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", | 636 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", |
636 "transport_socket_pool", | 637 "transport_socket_pool", |
637 false)); | 638 false)); |
638 } | 639 } |
639 if (socks_pool_) { | 640 if (socks_pool_) { |
640 list->Append(socks_pool_->GetInfoAsValue("socks_pool", | 641 list->Append(socks_pool_->GetInfoAsValue("socks_pool", |
641 "socks_pool", | 642 "socks_pool", |
(...skipping 30 matching lines...) Expand all Loading... |
672 if (base_.CloseOneIdleSocket()) | 673 if (base_.CloseOneIdleSocket()) |
673 return true; | 674 return true; |
674 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 675 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
675 } | 676 } |
676 | 677 |
677 void SSLClientSocketPool::OnSSLConfigChanged() { | 678 void SSLClientSocketPool::OnSSLConfigChanged() { |
678 FlushWithError(ERR_NETWORK_CHANGED); | 679 FlushWithError(ERR_NETWORK_CHANGED); |
679 } | 680 } |
680 | 681 |
681 } // namespace net | 682 } // namespace net |
OLD | NEW |