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/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "net/quic/quic_protocol.h" | 50 #include "net/quic/quic_protocol.h" |
51 #include "net/quic/quic_server_id.h" | 51 #include "net/quic/quic_server_id.h" |
52 #include "net/socket/client_socket_factory.h" | 52 #include "net/socket/client_socket_factory.h" |
53 #include "net/ssl/token_binding.h" | 53 #include "net/ssl/token_binding.h" |
54 #include "net/udp/udp_client_socket.h" | 54 #include "net/udp/udp_client_socket.h" |
55 | 55 |
56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
57 #include "base/win/windows_version.h" | 57 #include "base/win/windows_version.h" |
58 #endif | 58 #endif |
59 | 59 |
60 #if defined(USE_OPENSSL) | |
61 #include <openssl/aead.h> | 60 #include <openssl/aead.h> |
62 #include "crypto/openssl_util.h" | 61 #include "crypto/openssl_util.h" |
63 #else | |
64 #include "base/cpu.h" | |
65 #endif | |
66 | 62 |
67 using std::min; | 63 using std::min; |
68 using std::vector; | 64 using std::vector; |
69 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; | 65 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; |
70 | 66 |
71 namespace net { | 67 namespace net { |
72 | 68 |
73 namespace { | 69 namespace { |
74 | 70 |
75 enum CreateSessionFailure { | 71 enum CreateSessionFailure { |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 669 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
674 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); | 670 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); |
675 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until | 671 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until |
676 // channel_id_service is supported in cronet. | 672 // channel_id_service is supported in cronet. |
677 if (channel_id_service) { | 673 if (channel_id_service) { |
678 crypto_config_.SetChannelIDSource( | 674 crypto_config_.SetChannelIDSource( |
679 new ChannelIDSourceChromium(channel_id_service)); | 675 new ChannelIDSourceChromium(channel_id_service)); |
680 } | 676 } |
681 if (enable_token_binding && channel_id_service && IsTokenBindingSupported()) | 677 if (enable_token_binding && channel_id_service && IsTokenBindingSupported()) |
682 crypto_config_.tb_key_params.push_back(kP256); | 678 crypto_config_.tb_key_params.push_back(kP256); |
683 #if defined(USE_OPENSSL) | |
684 crypto::EnsureOpenSSLInit(); | 679 crypto::EnsureOpenSSLInit(); |
685 bool has_aes_hardware_support = !!EVP_has_aes_hardware(); | 680 bool has_aes_hardware_support = !!EVP_has_aes_hardware(); |
686 #else | |
687 base::CPU cpu; | |
688 bool has_aes_hardware_support = cpu.has_aesni() && cpu.has_avx(); | |
689 #endif | |
690 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", | 681 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", |
691 has_aes_hardware_support); | 682 has_aes_hardware_support); |
692 if (has_aes_hardware_support || prefer_aes_) | 683 if (has_aes_hardware_support || prefer_aes_) |
693 crypto_config_.PreferAesGcm(); | 684 crypto_config_.PreferAesGcm(); |
694 if (!IsEcdsaSupported()) | 685 if (!IsEcdsaSupported()) |
695 crypto_config_.DisableEcdsa(); | 686 crypto_config_.DisableEcdsa(); |
696 // When disk cache is used to store the server configs, HttpCache code calls | 687 // When disk cache is used to store the server configs, HttpCache code calls |
697 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't | 688 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't |
698 // created. | 689 // created. |
699 if (max_server_configs_stored_in_properties > 0) { | 690 if (max_server_configs_stored_in_properties > 0) { |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 // Since the session was active, there's no longer an | 1758 // Since the session was active, there's no longer an |
1768 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1759 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1769 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1760 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1770 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1761 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1771 // still race. | 1762 // still race. |
1772 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1763 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1773 alternative_service); | 1764 alternative_service); |
1774 } | 1765 } |
1775 | 1766 |
1776 } // namespace net | 1767 } // namespace net |
OLD | NEW |