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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 SSLClientSocket* socket; | 109 SSLClientSocket* socket; |
110 base::Closure callback; | 110 base::Closure callback; |
111 | 111 |
112 SocketAndCallback(SSLClientSocket* ssl_socket, | 112 SocketAndCallback(SSLClientSocket* ssl_socket, |
113 base::Closure job_resumption_callback) | 113 base::Closure job_resumption_callback) |
114 : socket(ssl_socket), callback(job_resumption_callback) {} | 114 : socket(ssl_socket), callback(job_resumption_callback) {} |
115 }; | 115 }; |
116 | 116 |
117 typedef std::vector<SocketAndCallback> SSLPendingSocketsAndCallbacks; | 117 typedef std::vector<SocketAndCallback> SSLPendingSocketsAndCallbacks; |
118 | 118 |
119 SSLConnectJobMessenger(); | |
120 | |
119 // Returns true if the given |ssl_socket| should continue its | 121 // Returns true if the given |ssl_socket| should continue its |
120 // SSL connection. | 122 // SSL connection. |
Ryan Sleevi
2014/07/10 20:30:45
unrelated to this CL: (not sure which CL is the ma
mshelley
2014/07/10 22:49:59
Done.
| |
121 bool CanProceed(SSLClientSocket* ssl_socket); | 123 bool CanProceed(SSLClientSocket* ssl_socket); |
122 | 124 |
123 // Informs the session cache that it should notify the SSLConnectJobMessenger | 125 // Informs the session cache that it should notify the SSLConnectJobMessenger |
124 // upon the completion of |ssl_socket|'s connection. | 126 // upon the completion of |ssl_socket|'s connection. |
Ryan Sleevi
2014/07/10 20:30:45
unrelated to this CL:
// Configure the SSLConnect
mshelley
2014/07/10 22:49:59
Done.
| |
125 void MonitorConnectionResult(SSLClientSocket* ssl_socket); | 127 void MonitorConnectionResult(SSLClientSocket* ssl_socket); |
126 | 128 |
127 // Adds the socket and its associated callback to the SSLConnectJobMessenger's | 129 // Adds the socket and its associated callback to the SSLConnectJobMessenger's |
128 // list of pending sockets and callbacks. | 130 // list of pending sockets and callbacks. |
129 void AddPendingSocket(SSLClientSocket* socket, const base::Closure& callback); | 131 void AddPendingSocket(SSLClientSocket* socket, const base::Closure& callback); |
Ryan Sleevi
2014/07/10 20:30:45
// Adds |socket| to the list of sockets waiting to
mshelley
2014/07/10 22:49:59
Done.
| |
130 | 132 |
131 // Processes pending callbacks when a socket successfully completes | 133 // Processes pending callbacks when a socket successfully completes |
132 // its connection. | 134 // its connection. |
133 void OnJobSucceeded(); | 135 void OnJobSucceeded(); |
134 | 136 |
135 // Processes pending callbacks when a socket encounters an error | 137 // Posts a task to process pending callbacks when a socket encounters an error |
136 // while completing its connection. | 138 // while completing its connection. |
137 void OnJobFailed(); | 139 void OnJobFailed(); |
Ryan Sleevi
2014/07/10 20:30:45
note: OnJobSucceeded and OnJobFailed both seem to
mshelley
2014/07/10 22:49:59
OnJobFailed is called once directly in DoSSLConenc
| |
138 | 140 |
141 // Determines which pending socket should be the next leading connection, | |
142 // and runs that socket's resumption callback. | |
143 void ConnectNewLeader(); | |
144 | |
139 private: | 145 private: |
140 // Runs all callbacks stored in |pending_sockets_and_callbacks_|. | 146 // Runs all callbacks stored in |pending_sockets_and_callbacks_|. |
141 void RunAllJobs(std::vector<SocketAndCallback>& pending_socket_and_callbacks); | 147 void RunAllJobs( |
148 std::vector<SocketAndCallback>& pending_sockets_and_callbacks); | |
142 | 149 |
150 base::WeakPtrFactory<SSLConnectJobMessenger> weak_factory_; | |
143 SSLPendingSocketsAndCallbacks pending_sockets_and_callbacks_; | 151 SSLPendingSocketsAndCallbacks pending_sockets_and_callbacks_; |
144 std::vector<SSLClientSocket*> connecting_sockets_; | 152 std::vector<SSLClientSocket*> connecting_sockets_; |
145 }; | 153 }; |
146 | 154 |
147 // SSLConnectJob handles the SSL handshake after setting up the underlying | 155 // SSLConnectJob handles the SSL handshake after setting up the underlying |
148 // connection as specified in the params. | 156 // connection as specified in the params. |
149 class SSLConnectJob : public ConnectJob { | 157 class SSLConnectJob : public ConnectJob { |
150 public: | 158 public: |
151 // Note: the SSLConnectJob does not own |messenger|. | 159 // Note: the SSLConnectJob does not own |messenger|. |
152 // so it must outlive the job. | 160 // so it must outlive the job. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 HttpProxyClientSocketPool* const http_proxy_pool_; | 375 HttpProxyClientSocketPool* const http_proxy_pool_; |
368 PoolBase base_; | 376 PoolBase base_; |
369 const scoped_refptr<SSLConfigService> ssl_config_service_; | 377 const scoped_refptr<SSLConfigService> ssl_config_service_; |
370 | 378 |
371 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); | 379 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
372 }; | 380 }; |
373 | 381 |
374 } // namespace net | 382 } // namespace net |
375 | 383 |
376 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 384 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |