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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const base::TimeDelta& timeout_duration, 187 const base::TimeDelta& timeout_duration,
188 TransportClientSocketPool* transport_pool, 188 TransportClientSocketPool* transport_pool,
189 SOCKSClientSocketPool* socks_pool, 189 SOCKSClientSocketPool* socks_pool,
190 HttpProxyClientSocketPool* http_proxy_pool, 190 HttpProxyClientSocketPool* http_proxy_pool,
191 ClientSocketFactory* client_socket_factory, 191 ClientSocketFactory* client_socket_factory,
192 HostResolver* host_resolver, 192 HostResolver* host_resolver,
193 const SSLClientSocketContext& context, 193 const SSLClientSocketContext& context,
194 const GetMessengerCallback& get_messenger_callback, 194 const GetMessengerCallback& get_messenger_callback,
195 Delegate* delegate, 195 Delegate* delegate,
196 NetLog* net_log); 196 NetLog* net_log);
197 virtual ~SSLConnectJob(); 197 ~SSLConnectJob() override;
198 198
199 // ConnectJob methods. 199 // ConnectJob methods.
200 virtual LoadState GetLoadState() const override; 200 LoadState GetLoadState() const override;
201 201
202 virtual void GetAdditionalErrorState(ClientSocketHandle * handle) override; 202 void GetAdditionalErrorState(ClientSocketHandle* handle) override;
203 203
204 private: 204 private:
205 enum State { 205 enum State {
206 STATE_TRANSPORT_CONNECT, 206 STATE_TRANSPORT_CONNECT,
207 STATE_TRANSPORT_CONNECT_COMPLETE, 207 STATE_TRANSPORT_CONNECT_COMPLETE,
208 STATE_SOCKS_CONNECT, 208 STATE_SOCKS_CONNECT,
209 STATE_SOCKS_CONNECT_COMPLETE, 209 STATE_SOCKS_CONNECT_COMPLETE,
210 STATE_TUNNEL_CONNECT, 210 STATE_TUNNEL_CONNECT,
211 STATE_TUNNEL_CONNECT_COMPLETE, 211 STATE_TUNNEL_CONNECT_COMPLETE,
212 STATE_CREATE_SSL_SOCKET, 212 STATE_CREATE_SSL_SOCKET,
(...skipping 22 matching lines...) Expand all
235 // Tells a waiting SSLConnectJob to resume its SSL connection. 235 // Tells a waiting SSLConnectJob to resume its SSL connection.
236 void ResumeSSLConnection(); 236 void ResumeSSLConnection();
237 237
238 // Returns the initial state for the state machine based on the 238 // Returns the initial state for the state machine based on the
239 // |connection_type|. 239 // |connection_type|.
240 static State GetInitialState(SSLSocketParams::ConnectionType connection_type); 240 static State GetInitialState(SSLSocketParams::ConnectionType connection_type);
241 241
242 // Starts the SSL connection process. Returns OK on success and 242 // Starts the SSL connection process. Returns OK on success and
243 // ERR_IO_PENDING if it cannot immediately service the request. 243 // ERR_IO_PENDING if it cannot immediately service the request.
244 // Otherwise, it returns a net error code. 244 // Otherwise, it returns a net error code.
245 virtual int ConnectInternal() override; 245 int ConnectInternal() override;
246 246
247 scoped_refptr<SSLSocketParams> params_; 247 scoped_refptr<SSLSocketParams> params_;
248 TransportClientSocketPool* const transport_pool_; 248 TransportClientSocketPool* const transport_pool_;
249 SOCKSClientSocketPool* const socks_pool_; 249 SOCKSClientSocketPool* const socks_pool_;
250 HttpProxyClientSocketPool* const http_proxy_pool_; 250 HttpProxyClientSocketPool* const http_proxy_pool_;
251 ClientSocketFactory* const client_socket_factory_; 251 ClientSocketFactory* const client_socket_factory_;
252 HostResolver* const host_resolver_; 252 HostResolver* const host_resolver_;
253 253
254 const SSLClientSocketContext context_; 254 const SSLClientSocketContext context_;
255 255
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 CTVerifier* cert_transparency_verifier, 287 CTVerifier* cert_transparency_verifier,
288 const std::string& ssl_session_cache_shard, 288 const std::string& ssl_session_cache_shard,
289 ClientSocketFactory* client_socket_factory, 289 ClientSocketFactory* client_socket_factory,
290 TransportClientSocketPool* transport_pool, 290 TransportClientSocketPool* transport_pool,
291 SOCKSClientSocketPool* socks_pool, 291 SOCKSClientSocketPool* socks_pool,
292 HttpProxyClientSocketPool* http_proxy_pool, 292 HttpProxyClientSocketPool* http_proxy_pool,
293 SSLConfigService* ssl_config_service, 293 SSLConfigService* ssl_config_service,
294 bool enable_ssl_connect_job_waiting, 294 bool enable_ssl_connect_job_waiting,
295 NetLog* net_log); 295 NetLog* net_log);
296 296
297 virtual ~SSLClientSocketPool(); 297 ~SSLClientSocketPool() override;
298 298
299 // ClientSocketPool implementation. 299 // ClientSocketPool implementation.
300 virtual int RequestSocket(const std::string& group_name, 300 int RequestSocket(const std::string& group_name,
301 const void* connect_params, 301 const void* connect_params,
302 RequestPriority priority, 302 RequestPriority priority,
303 ClientSocketHandle* handle, 303 ClientSocketHandle* handle,
304 const CompletionCallback& callback, 304 const CompletionCallback& callback,
305 const BoundNetLog& net_log) override; 305 const BoundNetLog& net_log) override;
306 306
307 virtual void RequestSockets(const std::string& group_name, 307 void RequestSockets(const std::string& group_name,
308 const void* params, 308 const void* params,
309 int num_sockets, 309 int num_sockets,
310 const BoundNetLog& net_log) override; 310 const BoundNetLog& net_log) override;
311 311
312 virtual void CancelRequest(const std::string& group_name, 312 void CancelRequest(const std::string& group_name,
313 ClientSocketHandle* handle) override; 313 ClientSocketHandle* handle) override;
314 314
315 virtual void ReleaseSocket(const std::string& group_name, 315 void ReleaseSocket(const std::string& group_name,
316 scoped_ptr<StreamSocket> socket, 316 scoped_ptr<StreamSocket> socket,
317 int id) override; 317 int id) override;
318 318
319 virtual void FlushWithError(int error) override; 319 void FlushWithError(int error) override;
320 320
321 virtual void CloseIdleSockets() override; 321 void CloseIdleSockets() override;
322 322
323 virtual int IdleSocketCount() const override; 323 int IdleSocketCount() const override;
324 324
325 virtual int IdleSocketCountInGroup( 325 int IdleSocketCountInGroup(const std::string& group_name) const override;
326 const std::string& group_name) const override;
327 326
328 virtual LoadState GetLoadState( 327 LoadState GetLoadState(const std::string& group_name,
329 const std::string& group_name, 328 const ClientSocketHandle* handle) const override;
330 const ClientSocketHandle* handle) const override;
331 329
332 virtual base::DictionaryValue* GetInfoAsValue( 330 base::DictionaryValue* GetInfoAsValue(
333 const std::string& name, 331 const std::string& name,
334 const std::string& type, 332 const std::string& type,
335 bool include_nested_pools) const override; 333 bool include_nested_pools) const override;
336 334
337 virtual base::TimeDelta ConnectionTimeout() const override; 335 base::TimeDelta ConnectionTimeout() const override;
338 336
339 virtual ClientSocketPoolHistograms* histograms() const override; 337 ClientSocketPoolHistograms* histograms() const override;
340 338
341 // LowerLayeredPool implementation. 339 // LowerLayeredPool implementation.
342 virtual bool IsStalled() const override; 340 bool IsStalled() const override;
343 341
344 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; 342 void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override;
345 343
346 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; 344 void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override;
347 345
348 // HigherLayeredPool implementation. 346 // HigherLayeredPool implementation.
349 virtual bool CloseOneIdleConnection() override; 347 bool CloseOneIdleConnection() override;
350 348
351 // Gets the SSLConnectJobMessenger for the given ssl session |cache_key|. If 349 // Gets the SSLConnectJobMessenger for the given ssl session |cache_key|. If
352 // none exits, it creates one and stores it in |messenger_map_|. 350 // none exits, it creates one and stores it in |messenger_map_|.
353 SSLConnectJobMessenger* GetOrCreateSSLConnectJobMessenger( 351 SSLConnectJobMessenger* GetOrCreateSSLConnectJobMessenger(
354 const std::string& cache_key); 352 const std::string& cache_key);
355 void DeleteSSLConnectJobMessenger(const std::string& cache_key); 353 void DeleteSSLConnectJobMessenger(const std::string& cache_key);
356 354
357 private: 355 private:
358 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; 356 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase;
359 // Maps SSLConnectJob cache keys to SSLConnectJobMessenger objects. 357 // Maps SSLConnectJob cache keys to SSLConnectJobMessenger objects.
360 typedef std::map<std::string, SSLConnectJobMessenger*> MessengerMap; 358 typedef std::map<std::string, SSLConnectJobMessenger*> MessengerMap;
361 359
362 // SSLConfigService::Observer implementation. 360 // SSLConfigService::Observer implementation.
363 361
364 // When the user changes the SSL config, we flush all idle sockets so they 362 // When the user changes the SSL config, we flush all idle sockets so they
365 // won't get re-used. 363 // won't get re-used.
366 virtual void OnSSLConfigChanged() override; 364 void OnSSLConfigChanged() override;
367 365
368 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { 366 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory {
369 public: 367 public:
370 SSLConnectJobFactory( 368 SSLConnectJobFactory(
371 TransportClientSocketPool* transport_pool, 369 TransportClientSocketPool* transport_pool,
372 SOCKSClientSocketPool* socks_pool, 370 SOCKSClientSocketPool* socks_pool,
373 HttpProxyClientSocketPool* http_proxy_pool, 371 HttpProxyClientSocketPool* http_proxy_pool,
374 ClientSocketFactory* client_socket_factory, 372 ClientSocketFactory* client_socket_factory,
375 HostResolver* host_resolver, 373 HostResolver* host_resolver,
376 const SSLClientSocketContext& context, 374 const SSLClientSocketContext& context,
377 const SSLConnectJob::GetMessengerCallback& get_messenger_callback, 375 const SSLConnectJob::GetMessengerCallback& get_messenger_callback,
378 NetLog* net_log); 376 NetLog* net_log);
379 377
380 virtual ~SSLConnectJobFactory(); 378 ~SSLConnectJobFactory() override;
381 379
382 // ClientSocketPoolBase::ConnectJobFactory methods. 380 // ClientSocketPoolBase::ConnectJobFactory methods.
383 virtual scoped_ptr<ConnectJob> NewConnectJob( 381 scoped_ptr<ConnectJob> NewConnectJob(
384 const std::string& group_name, 382 const std::string& group_name,
385 const PoolBase::Request& request, 383 const PoolBase::Request& request,
386 ConnectJob::Delegate* delegate) const override; 384 ConnectJob::Delegate* delegate) const override;
387 385
388 virtual base::TimeDelta ConnectionTimeout() const override; 386 base::TimeDelta ConnectionTimeout() const override;
389 387
390 private: 388 private:
391 TransportClientSocketPool* const transport_pool_; 389 TransportClientSocketPool* const transport_pool_;
392 SOCKSClientSocketPool* const socks_pool_; 390 SOCKSClientSocketPool* const socks_pool_;
393 HttpProxyClientSocketPool* const http_proxy_pool_; 391 HttpProxyClientSocketPool* const http_proxy_pool_;
394 ClientSocketFactory* const client_socket_factory_; 392 ClientSocketFactory* const client_socket_factory_;
395 HostResolver* const host_resolver_; 393 HostResolver* const host_resolver_;
396 const SSLClientSocketContext context_; 394 const SSLClientSocketContext context_;
397 base::TimeDelta timeout_; 395 base::TimeDelta timeout_;
398 SSLConnectJob::GetMessengerCallback get_messenger_callback_; 396 SSLConnectJob::GetMessengerCallback get_messenger_callback_;
399 NetLog* net_log_; 397 NetLog* net_log_;
400 398
401 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); 399 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory);
402 }; 400 };
403 401
404 TransportClientSocketPool* const transport_pool_; 402 TransportClientSocketPool* const transport_pool_;
405 SOCKSClientSocketPool* const socks_pool_; 403 SOCKSClientSocketPool* const socks_pool_;
406 HttpProxyClientSocketPool* const http_proxy_pool_; 404 HttpProxyClientSocketPool* const http_proxy_pool_;
407 PoolBase base_; 405 PoolBase base_;
408 const scoped_refptr<SSLConfigService> ssl_config_service_; 406 const scoped_refptr<SSLConfigService> ssl_config_service_;
409 MessengerMap messenger_map_; 407 MessengerMap messenger_map_;
410 bool enable_ssl_connect_job_waiting_; 408 bool enable_ssl_connect_job_waiting_;
411 409
412 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); 410 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool);
413 }; 411 };
414 412
415 } // namespace net 413 } // namespace net
416 414
417 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ 415 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698