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

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

Issue 364943002: Makes waiting SSLConnectJobs use the message loops to resume their connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 #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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 SocketAndCallback(SSLClientSocket* ssl_socket, 108 SocketAndCallback(SSLClientSocket* ssl_socket,
109 const base::Closure& job_resumption_callback) 109 const base::Closure& job_resumption_callback)
110 : socket(ssl_socket), callback(job_resumption_callback) {} 110 : socket(ssl_socket), callback(job_resumption_callback) {}
111 111
112 SSLClientSocket* socket; 112 SSLClientSocket* socket;
113 base::Closure callback; 113 base::Closure callback;
114 }; 114 };
115 115
116 typedef std::vector<SocketAndCallback> SSLPendingSocketsAndCallbacks; 116 typedef std::vector<SocketAndCallback> SSLPendingSocketsAndCallbacks;
117 117
118 SSLConnectJobMessenger();
119
118 // Removes |socket| from the set of sockets being monitored. This 120 // Removes |socket| from the set of sockets being monitored. This
119 // guarantees that |job_resumption_callback| will not be called for 121 // guarantees that |job_resumption_callback| will not be called for
120 // the socket. 122 // the socket.
121 void RemovePendingSocket(SSLClientSocket* ssl_socket); 123 void RemovePendingSocket(SSLClientSocket* ssl_socket);
122 124
123 // Returns true if |ssl_socket|'s Connect() method should be called. 125 // Returns true if |ssl_socket|'s Connect() method should be called.
124 bool CanProceed(SSLClientSocket* ssl_socket); 126 bool CanProceed(SSLClientSocket* ssl_socket);
125 127
126 // Configures the SSLConnectJobMessenger to begin monitoring |ssl_socket|'s 128 // Configures the SSLConnectJobMessenger to begin monitoring |ssl_socket|'s
127 // connection status. After a successful connection, or an error, 129 // connection status. After a successful connection, or an error,
(...skipping 18 matching lines...) Expand all
146 void OnJobCompleted(); 148 void OnJobCompleted();
147 149
148 // Runs all callbacks stored in |pending_sockets_and_callbacks_|. 150 // Runs all callbacks stored in |pending_sockets_and_callbacks_|.
149 void RunAllCallbacks( 151 void RunAllCallbacks(
150 const SSLPendingSocketsAndCallbacks& pending_socket_and_callbacks); 152 const SSLPendingSocketsAndCallbacks& pending_socket_and_callbacks);
151 153
152 SSLPendingSocketsAndCallbacks pending_sockets_and_callbacks_; 154 SSLPendingSocketsAndCallbacks pending_sockets_and_callbacks_;
153 // Note: this field is a vector to allow for future design changes. Currently, 155 // Note: this field is a vector to allow for future design changes. Currently,
154 // this vector should only ever have one entry. 156 // this vector should only ever have one entry.
155 std::vector<SSLClientSocket*> connecting_sockets_; 157 std::vector<SSLClientSocket*> connecting_sockets_;
158
159 base::WeakPtrFactory<SSLConnectJobMessenger> weak_factory_;
156 }; 160 };
157 161
158 // SSLConnectJob handles the SSL handshake after setting up the underlying 162 // SSLConnectJob handles the SSL handshake after setting up the underlying
159 // connection as specified in the params. 163 // connection as specified in the params.
160 class SSLConnectJob : public ConnectJob { 164 class SSLConnectJob : public ConnectJob {
161 public: 165 public:
162 // Note: the SSLConnectJob does not own |messenger| so it must outlive the 166 // Note: the SSLConnectJob does not own |messenger| so it must outlive the
163 // job. 167 // job.
164 SSLConnectJob(const std::string& group_name, 168 SSLConnectJob(const std::string& group_name,
165 RequestPriority priority, 169 RequestPriority priority,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 HttpProxyClientSocketPool* const http_proxy_pool_; 384 HttpProxyClientSocketPool* const http_proxy_pool_;
381 PoolBase base_; 385 PoolBase base_;
382 const scoped_refptr<SSLConfigService> ssl_config_service_; 386 const scoped_refptr<SSLConfigService> ssl_config_service_;
383 387
384 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); 388 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool);
385 }; 389 };
386 390
387 } // namespace net 391 } // namespace net
388 392
389 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ 393 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_pool.cc » ('j') | net/socket/ssl_client_socket_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698