Chromium Code Reviews| Index: net/socket/ssl_client_socket_pool.h |
| diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h |
| index f895d7c42788df8d05ca7e4bbf7d5a053a402956..ae7036ba430d007edab92a4d411da16f7835acec 100644 |
| --- a/net/socket/ssl_client_socket_pool.h |
| +++ b/net/socket/ssl_client_socket_pool.h |
| @@ -5,9 +5,7 @@ |
| #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| -#include <map> |
| #include <string> |
| -#include <vector> |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -96,89 +94,10 @@ class NET_EXPORT_PRIVATE SSLSocketParams |
| DISALLOW_COPY_AND_ASSIGN(SSLSocketParams); |
| }; |
| -// SSLConnectJobMessenger handles communication between concurrent |
| -// SSLConnectJobs that share the same SSL session cache key. |
| -// |
| -// SSLConnectJobMessengers tell the session cache when a certain |
| -// connection should be monitored for success or failure, and |
| -// tell SSLConnectJobs when to pause or resume their connections. |
| -class SSLConnectJobMessenger { |
| - public: |
| - struct SocketAndCallback { |
| - SocketAndCallback(SSLClientSocket* ssl_socket, |
| - const base::Closure& job_resumption_callback); |
| - ~SocketAndCallback(); |
| - |
| - SSLClientSocket* socket; |
| - base::Closure callback; |
| - }; |
| - |
| - typedef std::vector<SocketAndCallback> SSLPendingSocketsAndCallbacks; |
| - |
| - // |messenger_finished_callback| is run when a connection monitored by the |
| - // SSLConnectJobMessenger has completed and we are finished with the |
| - // SSLConnectJobMessenger. |
| - explicit SSLConnectJobMessenger( |
| - const base::Closure& messenger_finished_callback); |
| - ~SSLConnectJobMessenger(); |
| - |
| - // Removes |socket| from the set of sockets being monitored. This |
| - // guarantees that |job_resumption_callback| will not be called for |
| - // the socket. |
| - void RemovePendingSocket(SSLClientSocket* ssl_socket); |
| - |
| - // Returns true if |ssl_socket|'s Connect() method should be called. |
| - bool CanProceed(SSLClientSocket* ssl_socket); |
| - |
| - // Configures the SSLConnectJobMessenger to begin monitoring |ssl_socket|'s |
| - // connection status. After a successful connection, or an error, |
| - // the messenger will determine which sockets that have been added |
| - // via AddPendingSocket() to allow to proceed. |
| - void MonitorConnectionResult(SSLClientSocket* ssl_socket); |
| - |
| - // Adds |socket| to the list of sockets waiting to Connect(). When |
| - // the messenger has determined that it's an appropriate time for |socket| |
| - // to connect, it will invoke |callback|. |
| - // |
| - // Note: It is an error to call AddPendingSocket() without having first |
| - // called MonitorConnectionResult() and configuring a socket that WILL |
| - // have Connect() called on it. |
| - void AddPendingSocket(SSLClientSocket* ssl_socket, |
| - const base::Closure& callback); |
| - |
| - private: |
| - // Processes pending callbacks when a socket completes its SSL handshake -- |
| - // either successfully or unsuccessfully. |
| - void OnSSLHandshakeCompleted(); |
| - |
| - // Runs all callbacks stored in |pending_sockets_and_callbacks_|. |
| - void RunAllCallbacks( |
| - const SSLPendingSocketsAndCallbacks& pending_socket_and_callbacks); |
| - |
| - SSLPendingSocketsAndCallbacks pending_sockets_and_callbacks_; |
| - // Note: this field is a vector to allow for future design changes. Currently, |
| - // this vector should only ever have one entry. |
| - std::vector<SSLClientSocket*> connecting_sockets_; |
| - |
| - base::Closure messenger_finished_callback_; |
| - |
| - base::WeakPtrFactory<SSLConnectJobMessenger> weak_factory_; |
| -}; |
| - |
| // SSLConnectJob handles the SSL handshake after setting up the underlying |
| // connection as specified in the params. |
| class SSLConnectJob : public ConnectJob { |
| public: |
| - // Callback to allow the SSLConnectJob to obtain an SSLConnectJobMessenger to |
| - // coordinate connecting. The SSLConnectJob will supply a unique identifer |
| - // (ex: the SSL session cache key), with the expectation that the same |
| - // Messenger will be returned for all such ConnectJobs. |
| - // |
| - // Note: It will only be called for situations where the SSL session cache |
| - // does not already have a candidate session to resume. |
| - typedef base::Callback<SSLConnectJobMessenger*(const std::string&)> |
| - GetMessengerCallback; |
| - |
| // Note: the SSLConnectJob does not own |messenger| so it must outlive the |
| // job. |
| SSLConnectJob(const std::string& group_name, |
| @@ -190,7 +109,6 @@ class SSLConnectJob : public ConnectJob { |
| HttpProxyClientSocketPool* http_proxy_pool, |
| ClientSocketFactory* client_socket_factory, |
| const SSLClientSocketContext& context, |
| - const GetMessengerCallback& get_messenger_callback, |
| Delegate* delegate, |
| NetLog* net_log); |
| ~SSLConnectJob() override; |
| @@ -208,8 +126,6 @@ class SSLConnectJob : public ConnectJob { |
| STATE_SOCKS_CONNECT_COMPLETE, |
| STATE_TUNNEL_CONNECT, |
| STATE_TUNNEL_CONNECT_COMPLETE, |
| - STATE_CREATE_SSL_SOCKET, |
| - STATE_CHECK_FOR_RESUME, |
| STATE_SSL_CONNECT, |
| STATE_SSL_CONNECT_COMPLETE, |
| STATE_NONE, |
| @@ -226,14 +142,9 @@ class SSLConnectJob : public ConnectJob { |
| int DoSOCKSConnectComplete(int result); |
| int DoTunnelConnect(); |
| int DoTunnelConnectComplete(int result); |
| - int DoCreateSSLSocket(); |
| - int DoCheckForResume(); |
| int DoSSLConnect(); |
| int DoSSLConnectComplete(int result); |
| - // Tells a waiting SSLConnectJob to resume its SSL connection. |
| - void ResumeSSLConnection(); |
| - |
| // Returns the initial state for the state machine based on the |
| // |connection_type|. |
| static State GetInitialState(SSLSocketParams::ConnectionType connection_type); |
| @@ -252,17 +163,12 @@ class SSLConnectJob : public ConnectJob { |
| const SSLClientSocketContext context_; |
| State next_state_; |
| - CompletionCallback io_callback_; |
| + CompletionCallback callback_; |
|
davidben
2015/03/09 18:02:36
FYI, this part of the revert is just a rename. (I'
|
| scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
| scoped_ptr<SSLClientSocket> ssl_socket_; |
| - SSLConnectJobMessenger* messenger_; |
| HttpResponseInfo error_response_info_; |
| - GetMessengerCallback get_messenger_callback_; |
| - |
| - base::WeakPtrFactory<SSLConnectJob> weak_factory_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); |
| }; |
| @@ -289,7 +195,6 @@ class NET_EXPORT_PRIVATE SSLClientSocketPool |
| SOCKSClientSocketPool* socks_pool, |
| HttpProxyClientSocketPool* http_proxy_pool, |
| SSLConfigService* ssl_config_service, |
| - bool enable_ssl_connect_job_waiting, |
| NetLog* net_log); |
| ~SSLClientSocketPool() override; |
| @@ -344,16 +249,8 @@ class NET_EXPORT_PRIVATE SSLClientSocketPool |
| // HigherLayeredPool implementation. |
| bool CloseOneIdleConnection() override; |
| - // Gets the SSLConnectJobMessenger for the given ssl session |cache_key|. If |
| - // none exits, it creates one and stores it in |messenger_map_|. |
| - SSLConnectJobMessenger* GetOrCreateSSLConnectJobMessenger( |
| - const std::string& cache_key); |
| - void DeleteSSLConnectJobMessenger(const std::string& cache_key); |
| - |
| private: |
| typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; |
| - // Maps SSLConnectJob cache keys to SSLConnectJobMessenger objects. |
| - typedef std::map<std::string, SSLConnectJobMessenger*> MessengerMap; |
| // SSLConfigService::Observer implementation. |
| @@ -369,7 +266,6 @@ class NET_EXPORT_PRIVATE SSLClientSocketPool |
| HttpProxyClientSocketPool* http_proxy_pool, |
| ClientSocketFactory* client_socket_factory, |
| const SSLClientSocketContext& context, |
| - const SSLConnectJob::GetMessengerCallback& get_messenger_callback, |
| NetLog* net_log); |
| ~SSLConnectJobFactory() override; |
| @@ -389,7 +285,6 @@ class NET_EXPORT_PRIVATE SSLClientSocketPool |
| ClientSocketFactory* const client_socket_factory_; |
| const SSLClientSocketContext context_; |
| base::TimeDelta timeout_; |
| - SSLConnectJob::GetMessengerCallback get_messenger_callback_; |
| NetLog* net_log_; |
| DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); |
| @@ -400,8 +295,6 @@ class NET_EXPORT_PRIVATE SSLClientSocketPool |
| HttpProxyClientSocketPool* const http_proxy_pool_; |
| PoolBase base_; |
| const scoped_refptr<SSLConfigService> ssl_config_service_; |
| - MessengerMap messenger_map_; |
| - bool enable_ssl_connect_job_waiting_; |
| DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
| }; |