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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
667 // Explicitly disable the persister for Cronet to avoid persistence of dynamic | 667 // Explicitly disable the persister for Cronet to avoid persistence of dynamic |
668 // HPKP. This is a safety measure ensuring that nobody enables the persistence | 668 // HPKP. This is a safety measure ensuring that nobody enables the persistence |
669 // of HPKP by specifying transport_security_persister_path in the future. | 669 // of HPKP by specifying transport_security_persister_path in the future. |
670 context_builder.set_transport_security_persister_path(base::FilePath()); | 670 context_builder.set_transport_security_persister_path(base::FilePath()); |
671 | 671 |
672 // Disable net::CookieStore and net::ChannelIDService. | 672 // Disable net::CookieStore and net::ChannelIDService. |
673 context_builder.SetCookieAndChannelIdStores(nullptr, nullptr); | 673 context_builder.SetCookieAndChannelIdStores(nullptr, nullptr); |
674 | 674 |
675 if (config->enable_network_quality_estimator) { | 675 if (config->enable_network_quality_estimator) { |
676 DCHECK(!network_quality_estimator_); | 676 DCHECK(!network_quality_estimator_); |
677 std::map<std::string, std::string> variation_params; | 677 |
678 // NetworkQualityEstimator experiment dictionary name. | |
679 const char kNetworkQualityEstimatorFieldTrialName[] = | |
mgersh
2017/05/02 18:06:49
Instead of duplicating this here, you could make i
tbansal1
2017/06/28 14:19:54
Obsolete.
| |
680 "NetworkQualityEstimator"; | |
681 | |
682 // Network quality estimator configuration params. | |
683 std::map<std::string, std::string> network_quality_estimator_options; | |
684 const base::DictionaryValue* nqe_args = nullptr; | |
685 | |
686 if (effective_experimental_options_ && | |
687 effective_experimental_options_->GetDictionary( | |
688 kNetworkQualityEstimatorFieldTrialName, &nqe_args)) { | |
xunjieli
2017/05/02 17:56:34
Can we move the parsing of NQE options to url_requ
tbansal1
2017/06/28 14:19:54
Done.
| |
689 for (base::DictionaryValue::Iterator it(*nqe_args); !it.IsAtEnd(); | |
690 it.Advance()) { | |
691 std::string value_string; | |
692 bool value_string_available; | |
693 value_string_available = it.value().GetAsString(&value_string); | |
694 DCHECK(value_string_available); | |
695 network_quality_estimator_options.emplace(it.key(), value_string); | |
696 } | |
697 } | |
698 | |
678 // Configure network quality estimator: Specify the algorithm that should | 699 // Configure network quality estimator: Specify the algorithm that should |
679 // be used for computing the effective connection type. The algorithm | 700 // be used for computing the effective connection type if it has not been |
680 // is specified using the key-value pairs defined in | 701 // specified by the embedder. The algorithm is specified using the |
681 // //net/nqe/network_quality_estimator.cc. | 702 // key-value pairs defined in //net/nqe/network_quality_estimator.cc. |
682 // TODO(tbansal): Investigate a more robust way of configuring the network | 703 if (network_quality_estimator_options.find( |
683 // quality estimator. | 704 "effective_connection_type_algorithm") == |
684 variation_params["effective_connection_type_algorithm"] = | 705 network_quality_estimator_options.end()) { |
685 "TransportRTTOrDownstreamThroughput"; | 706 network_quality_estimator_options.emplace( |
707 "effective_connection_type_algorithm", | |
708 "TransportRTTOrDownstreamThroughput"); | |
709 } | |
686 network_quality_estimator_ = base::MakeUnique<net::NetworkQualityEstimator>( | 710 network_quality_estimator_ = base::MakeUnique<net::NetworkQualityEstimator>( |
687 std::unique_ptr<net::ExternalEstimateProvider>(), variation_params, | 711 std::unique_ptr<net::ExternalEstimateProvider>(), |
688 false, false, g_net_log.Get().net_log()); | 712 network_quality_estimator_options, false, false, |
713 g_net_log.Get().net_log()); | |
689 // Set the socket performance watcher factory so that network quality | 714 // Set the socket performance watcher factory so that network quality |
690 // estimator is notified of socket performance metrics from TCP and QUIC. | 715 // estimator is notified of socket performance metrics from TCP and QUIC. |
691 context_builder.set_socket_performance_watcher_factory( | 716 context_builder.set_socket_performance_watcher_factory( |
692 network_quality_estimator_->GetSocketPerformanceWatcherFactory()); | 717 network_quality_estimator_->GetSocketPerformanceWatcherFactory()); |
693 network_quality_estimator_->AddEffectiveConnectionTypeObserver(this); | 718 network_quality_estimator_->AddEffectiveConnectionTypeObserver(this); |
694 network_quality_estimator_->AddRTTAndThroughputEstimatesObserver(this); | 719 network_quality_estimator_->AddRTTAndThroughputEstimatesObserver(this); |
695 | 720 |
696 // Set up network quality prefs if the storage path is specified. | 721 // Set up network quality prefs if the storage path is specified. |
697 if (!config->storage_path.empty()) { | 722 if (!config->storage_path.empty()) { |
698 DCHECK(!network_qualities_prefs_manager_); | 723 DCHECK(!network_qualities_prefs_manager_); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1173 JNIEnv* env, | 1198 JNIEnv* env, |
1174 const JavaParamRef<jclass>& jcaller) { | 1199 const JavaParamRef<jclass>& jcaller) { |
1175 DCHECK(base::StatisticsRecorder::IsActive()); | 1200 DCHECK(base::StatisticsRecorder::IsActive()); |
1176 std::vector<uint8_t> data; | 1201 std::vector<uint8_t> data; |
1177 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1202 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
1178 return ScopedJavaLocalRef<jbyteArray>(); | 1203 return ScopedJavaLocalRef<jbyteArray>(); |
1179 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1204 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
1180 } | 1205 } |
1181 | 1206 |
1182 } // namespace cronet | 1207 } // namespace cronet |
OLD | NEW |