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 #include "net/socket/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_client_socket_pool.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
11 #include "base/metrics/sparse_histogram.h" | 11 #include "base/metrics/sparse_histogram.h" |
12 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "net/http/http_proxy_client_socket.h" | 16 #include "net/http/http_proxy_client_socket.h" |
17 #include "net/http/http_proxy_client_socket_pool.h" | 17 #include "net/http/http_proxy_client_socket_pool.h" |
18 #include "net/socket/client_socket_factory.h" | 18 #include "net/socket/client_socket_factory.h" |
19 #include "net/socket/client_socket_handle.h" | 19 #include "net/socket/client_socket_handle.h" |
20 #include "net/socket/socks_client_socket_pool.h" | 20 #include "net/socket/socks_client_socket_pool.h" |
21 #include "net/socket/ssl_client_socket.h" | 21 #include "net/socket/ssl_client_socket.h" |
22 #include "net/socket/transport_client_socket_pool.h" | 22 #include "net/socket/transport_client_socket_pool.h" |
23 #include "net/ssl/ssl_cert_request_info.h" | 23 #include "net/ssl/ssl_cert_request_info.h" |
| 24 #include "net/ssl/ssl_cipher_suite_names.h" |
24 #include "net/ssl/ssl_connection_status_flags.h" | 25 #include "net/ssl/ssl_connection_status_flags.h" |
25 #include "net/ssl/ssl_info.h" | 26 #include "net/ssl/ssl_info.h" |
26 | 27 |
27 namespace net { | 28 namespace net { |
28 | 29 |
29 SSLSocketParams::SSLSocketParams( | 30 SSLSocketParams::SSLSocketParams( |
30 const scoped_refptr<TransportSocketParams>& direct_params, | 31 const scoped_refptr<TransportSocketParams>& direct_params, |
31 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params, | 32 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params, |
32 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, | 33 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, |
33 const HostPortPair& host_and_port, | 34 const HostPortPair& host_and_port, |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 100); | 365 100); |
365 | 366 |
366 SSLInfo ssl_info; | 367 SSLInfo ssl_info; |
367 bool has_ssl_info = ssl_socket_->GetSSLInfo(&ssl_info); | 368 bool has_ssl_info = ssl_socket_->GetSSLInfo(&ssl_info); |
368 DCHECK(has_ssl_info); | 369 DCHECK(has_ssl_info); |
369 | 370 |
370 UMA_HISTOGRAM_ENUMERATION("Net.SSLVersion", SSLConnectionStatusToVersion( | 371 UMA_HISTOGRAM_ENUMERATION("Net.SSLVersion", SSLConnectionStatusToVersion( |
371 ssl_info.connection_status), | 372 ssl_info.connection_status), |
372 SSL_CONNECTION_VERSION_MAX); | 373 SSL_CONNECTION_VERSION_MAX); |
373 | 374 |
374 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite", | 375 uint16 cipher_suite = |
375 SSLConnectionStatusToCipherSuite( | 376 SSLConnectionStatusToCipherSuite(ssl_info.connection_status); |
376 ssl_info.connection_status)); | 377 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite", cipher_suite); |
| 378 |
| 379 const char *str, *cipher_str, *mac_str; |
| 380 bool is_aead; |
| 381 SSLCipherSuiteToStrings(&str, &cipher_str, &mac_str, &is_aead, |
| 382 cipher_suite); |
| 383 // UMA_HISTOGRAM_... macros cache the Histogram instance and thus only work |
| 384 // if the histogram name is constant, so don't generate it dynamically. |
| 385 if (strcmp(str, "RSA") == 0) { |
| 386 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_KeyExchange.RSA", |
| 387 ssl_info.key_exchange_info); |
| 388 } else if (strncmp(str, "DHE_", 4) == 0) { |
| 389 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_KeyExchange.DHE", |
| 390 ssl_info.key_exchange_info); |
| 391 } else if (strncmp(str, "ECDHE_", 6) == 0) { |
| 392 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_KeyExchange.ECDHE", |
| 393 ssl_info.key_exchange_info); |
| 394 } else { |
| 395 NOTREACHED(); |
| 396 } |
377 | 397 |
378 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { | 398 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { |
379 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake", | 399 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake", |
380 connect_duration, | 400 connect_duration, |
381 base::TimeDelta::FromMilliseconds(1), | 401 base::TimeDelta::FromMilliseconds(1), |
382 base::TimeDelta::FromMinutes(1), | 402 base::TimeDelta::FromMinutes(1), |
383 100); | 403 100); |
384 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { | 404 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { |
385 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", | 405 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", |
386 connect_duration, | 406 connect_duration, |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 if (base_.CloseOneIdleSocket()) | 681 if (base_.CloseOneIdleSocket()) |
662 return true; | 682 return true; |
663 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 683 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
664 } | 684 } |
665 | 685 |
666 void SSLClientSocketPool::OnSSLConfigChanged() { | 686 void SSLClientSocketPool::OnSSLConfigChanged() { |
667 FlushWithError(ERR_NETWORK_CHANGED); | 687 FlushWithError(ERR_NETWORK_CHANGED); |
668 } | 688 } |
669 | 689 |
670 } // namespace net | 690 } // namespace net |
OLD | NEW |