OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cronet/android/cronet_url_request_context_adapter.h" | 5 #include "components/cronet/android/cronet_url_request_context_adapter.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 #include "net/cookies/cookie_monster.h" | 57 #include "net/cookies/cookie_monster.h" |
58 #include "net/http/http_auth_handler_factory.h" | 58 #include "net/http/http_auth_handler_factory.h" |
59 #include "net/http/http_server_properties_manager.h" | 59 #include "net/http/http_server_properties_manager.h" |
60 #include "net/log/file_net_log_observer.h" | 60 #include "net/log/file_net_log_observer.h" |
61 #include "net/log/net_log_util.h" | 61 #include "net/log/net_log_util.h" |
62 #include "net/nqe/external_estimate_provider.h" | 62 #include "net/nqe/external_estimate_provider.h" |
63 #include "net/nqe/network_qualities_prefs_manager.h" | 63 #include "net/nqe/network_qualities_prefs_manager.h" |
64 #include "net/nqe/network_quality_estimator_params.h" | 64 #include "net/nqe/network_quality_estimator_params.h" |
65 #include "net/proxy/proxy_config_service_android.h" | 65 #include "net/proxy/proxy_config_service_android.h" |
66 #include "net/proxy/proxy_service.h" | 66 #include "net/proxy/proxy_service.h" |
67 #include "net/quic/core/quic_versions.h" | |
67 #include "net/sdch/sdch_owner.h" | 68 #include "net/sdch/sdch_owner.h" |
68 #include "net/ssl/channel_id_service.h" | 69 #include "net/ssl/channel_id_service.h" |
69 #include "net/url_request/url_request_context.h" | 70 #include "net/url_request/url_request_context.h" |
70 #include "net/url_request/url_request_context_builder.h" | 71 #include "net/url_request/url_request_context_builder.h" |
71 #include "net/url_request/url_request_interceptor.h" | 72 #include "net/url_request/url_request_interceptor.h" |
72 | 73 |
73 using base::android::JavaParamRef; | 74 using base::android::JavaParamRef; |
74 using base::android::ScopedJavaLocalRef; | 75 using base::android::ScopedJavaLocalRef; |
75 | 76 |
76 namespace { | 77 namespace { |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
752 if (quic_hint.alternate_port <= std::numeric_limits<uint16_t>::min() || | 753 if (quic_hint.alternate_port <= std::numeric_limits<uint16_t>::min() || |
753 quic_hint.alternate_port > std::numeric_limits<uint16_t>::max()) { | 754 quic_hint.alternate_port > std::numeric_limits<uint16_t>::max()) { |
754 LOG(ERROR) << "Invalid QUIC hint alternate port: " | 755 LOG(ERROR) << "Invalid QUIC hint alternate port: " |
755 << quic_hint.alternate_port; | 756 << quic_hint.alternate_port; |
756 continue; | 757 continue; |
757 } | 758 } |
758 | 759 |
759 url::SchemeHostPort quic_server("https", canon_host, quic_hint.port); | 760 url::SchemeHostPort quic_server("https", canon_host, quic_hint.port); |
760 net::AlternativeService alternative_service( | 761 net::AlternativeService alternative_service( |
761 net::kProtoQUIC, "", static_cast<uint16_t>(quic_hint.alternate_port)); | 762 net::kProtoQUIC, "", static_cast<uint16_t>(quic_hint.alternate_port)); |
762 context_->http_server_properties()->SetAlternativeService( | 763 QuicVersionVector advertised_versions; |
763 quic_server, alternative_service, base::Time::Max()); | 764 HttpNetworkSession::Params* params = context_->GetNetworkSessionParams(); |
765 if (params) { | |
xunjieli
2017/06/16 14:43:56
|params| should be always non-null, right?
Can you
Zhongyi Shi
2017/06/20 23:23:37
Done.
| |
766 advertised_versions = params->quic_supported_versions; | |
767 } else { | |
768 advertised_versions = CurrentSupportedVersions(); | |
769 } | |
770 | |
771 context_->http_server_properties()->SetQuicAlternativeService( | |
Bence
2017/06/16 14:43:40
I believe this should be called with an empty Quic
Zhongyi Shi
2017/06/20 23:23:37
Setting versions here doesn't have behavioral diff
Bence
2017/06/21 12:39:25
What happens if one version of Chrome supports QUI
Zhongyi Shi
2017/06/21 21:01:32
Discussed offline. I have confirmed with xunjieli@
Zhongyi Shi
2017/06/26 22:23:24
As I realized version advertisement is optional. I
| |
772 quic_server, alternative_service, base::Time::Max(), | |
773 advertised_versions); | |
764 } | 774 } |
765 } | 775 } |
766 | 776 |
767 // If there is a cert_verifier, then populate its cache with | 777 // If there is a cert_verifier, then populate its cache with |
768 // |cert_verifier_data|. | 778 // |cert_verifier_data|. |
769 if (!config->cert_verifier_data.empty() && context_->cert_verifier()) { | 779 if (!config->cert_verifier_data.empty() && context_->cert_verifier()) { |
770 SCOPED_UMA_HISTOGRAM_TIMER("Net.Cronet.CertVerifierCache.DeserializeTime"); | 780 SCOPED_UMA_HISTOGRAM_TIMER("Net.Cronet.CertVerifierCache.DeserializeTime"); |
771 std::string data; | 781 std::string data; |
772 cronet_pb::CertVerificationCache cert_verification_cache; | 782 cronet_pb::CertVerificationCache cert_verification_cache; |
773 if (base::Base64Decode(config->cert_verifier_data, &data) && | 783 if (base::Base64Decode(config->cert_verifier_data, &data) && |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1172 JNIEnv* env, | 1182 JNIEnv* env, |
1173 const JavaParamRef<jclass>& jcaller) { | 1183 const JavaParamRef<jclass>& jcaller) { |
1174 DCHECK(base::StatisticsRecorder::IsActive()); | 1184 DCHECK(base::StatisticsRecorder::IsActive()); |
1175 std::vector<uint8_t> data; | 1185 std::vector<uint8_t> data; |
1176 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1186 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
1177 return ScopedJavaLocalRef<jbyteArray>(); | 1187 return ScopedJavaLocalRef<jbyteArray>(); |
1178 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1188 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
1179 } | 1189 } |
1180 | 1190 |
1181 } // namespace cronet | 1191 } // namespace cronet |
OLD | NEW |