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

Side by Side Diff: net/socket/client_socket_pool_base.h

Issue 384873002: This CL changes the lifespan of SSLConnectJobMessengers so that they are created only when needed, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@useloop
Patch Set: Removed FormatSessionCacheKey function. Created 6 years, 5 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
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 // A ClientSocketPoolBase is used to restrict the number of sockets open at 5 // A ClientSocketPoolBase is used to restrict the number of sockets open at
6 // a time. It also maintains a list of idle persistent sockets for reuse. 6 // a time. It also maintains a list of idle persistent sockets for reuse.
7 // Subclasses of ClientSocketPool should compose ClientSocketPoolBase to handle 7 // Subclasses of ClientSocketPool should compose ClientSocketPoolBase to handle
8 // the core logic of (1) restricting the number of active (connected or 8 // the core logic of (1) restricting the number of active (connected or
9 // connecting) sockets per "group" (generally speaking, the hostname), (2) 9 // connecting) sockets per "group" (generally speaking, the hostname), (2)
10 // maintaining a per-group list of idle, persistent sockets for reuse, and (3) 10 // maintaining a per-group list of idle, persistent sockets for reuse, and (3)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 }; 196 };
197 197
198 class ConnectJobFactory { 198 class ConnectJobFactory {
199 public: 199 public:
200 ConnectJobFactory() {} 200 ConnectJobFactory() {}
201 virtual ~ConnectJobFactory() {} 201 virtual ~ConnectJobFactory() {}
202 202
203 virtual scoped_ptr<ConnectJob> NewConnectJob( 203 virtual scoped_ptr<ConnectJob> NewConnectJob(
204 const std::string& group_name, 204 const std::string& group_name,
205 const Request& request, 205 const Request& request,
206 ConnectJob::Delegate* delegate) const = 0; 206 ConnectJob::Delegate* delegate) = 0;
207 207
208 virtual base::TimeDelta ConnectionTimeout() const = 0; 208 virtual base::TimeDelta ConnectionTimeout() const = 0;
209 209
210 private: 210 private:
211 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory); 211 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory);
212 }; 212 };
213 213
214 ClientSocketPoolBaseHelper( 214 ClientSocketPoolBaseHelper(
215 HigherLayeredPool* pool, 215 HigherLayeredPool* pool,
216 int max_sockets, 216 int max_sockets,
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 }; 679 };
680 680
681 class ConnectJobFactory { 681 class ConnectJobFactory {
682 public: 682 public:
683 ConnectJobFactory() {} 683 ConnectJobFactory() {}
684 virtual ~ConnectJobFactory() {} 684 virtual ~ConnectJobFactory() {}
685 685
686 virtual scoped_ptr<ConnectJob> NewConnectJob( 686 virtual scoped_ptr<ConnectJob> NewConnectJob(
687 const std::string& group_name, 687 const std::string& group_name,
688 const Request& request, 688 const Request& request,
689 ConnectJob::Delegate* delegate) const = 0; 689 ConnectJob::Delegate* delegate) = 0;
690 690
691 virtual base::TimeDelta ConnectionTimeout() const = 0; 691 virtual base::TimeDelta ConnectionTimeout() const = 0;
692 692
693 private: 693 private:
694 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory); 694 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory);
695 }; 695 };
696 696
697 // |max_sockets| is the maximum number of sockets to be maintained by this 697 // |max_sockets| is the maximum number of sockets to be maintained by this
698 // ClientSocketPool. |max_sockets_per_group| specifies the maximum number of 698 // ClientSocketPool. |max_sockets_per_group| specifies the maximum number of
699 // sockets a "group" can have. |unused_idle_socket_timeout| specifies how 699 // sockets a "group" can have. |unused_idle_socket_timeout| specifies how
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 typedef typename ClientSocketPoolBase<SocketParams>::ConnectJobFactory 849 typedef typename ClientSocketPoolBase<SocketParams>::ConnectJobFactory
850 ConnectJobFactory; 850 ConnectJobFactory;
851 851
852 explicit ConnectJobFactoryAdaptor(ConnectJobFactory* connect_job_factory) 852 explicit ConnectJobFactoryAdaptor(ConnectJobFactory* connect_job_factory)
853 : connect_job_factory_(connect_job_factory) {} 853 : connect_job_factory_(connect_job_factory) {}
854 virtual ~ConnectJobFactoryAdaptor() {} 854 virtual ~ConnectJobFactoryAdaptor() {}
855 855
856 virtual scoped_ptr<ConnectJob> NewConnectJob( 856 virtual scoped_ptr<ConnectJob> NewConnectJob(
857 const std::string& group_name, 857 const std::string& group_name,
858 const internal::ClientSocketPoolBaseHelper::Request& request, 858 const internal::ClientSocketPoolBaseHelper::Request& request,
859 ConnectJob::Delegate* delegate) const OVERRIDE { 859 ConnectJob::Delegate* delegate) OVERRIDE {
860 const Request& casted_request = static_cast<const Request&>(request); 860 const Request& casted_request = static_cast<const Request&>(request);
861 return connect_job_factory_->NewConnectJob( 861 return connect_job_factory_->NewConnectJob(
862 group_name, casted_request, delegate); 862 group_name, casted_request, delegate);
863 } 863 }
864 864
865 virtual base::TimeDelta ConnectionTimeout() const { 865 virtual base::TimeDelta ConnectionTimeout() const {
866 return connect_job_factory_->ConnectionTimeout(); 866 return connect_job_factory_->ConnectionTimeout();
867 } 867 }
868 868
869 const scoped_ptr<ConnectJobFactory> connect_job_factory_; 869 const scoped_ptr<ConnectJobFactory> connect_job_factory_;
870 }; 870 };
871 871
872 // Histograms for the pool 872 // Histograms for the pool
873 ClientSocketPoolHistograms* const histograms_; 873 ClientSocketPoolHistograms* const histograms_;
874 internal::ClientSocketPoolBaseHelper helper_; 874 internal::ClientSocketPoolBaseHelper helper_;
875 875
876 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); 876 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase);
877 }; 877 };
878 878
879 } // namespace net 879 } // namespace net
880 880
881 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ 881 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698