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

Unified Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2416473004: Add functionality for embedders to configure NQE (Closed)
Patch Set: rebased Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/cronet_url_request_context_adapter.cc
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
index 2a252b4386e3e74e1777460d265cf7e4390ad4e0..be7c532e38dfb0c0d925251cd7df8d07c8b8e002 100644
--- a/components/cronet/android/cronet_url_request_context_adapter.cc
+++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -674,18 +674,43 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread(
if (config->enable_network_quality_estimator) {
DCHECK(!network_quality_estimator_);
- std::map<std::string, std::string> variation_params;
+
+ // NetworkQualityEstimator experiment dictionary name.
+ 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.
+ "NetworkQualityEstimator";
+
+ // Network quality estimator configuration params.
+ std::map<std::string, std::string> network_quality_estimator_options;
+ const base::DictionaryValue* nqe_args = nullptr;
+
+ if (effective_experimental_options_ &&
+ effective_experimental_options_->GetDictionary(
+ 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.
+ for (base::DictionaryValue::Iterator it(*nqe_args); !it.IsAtEnd();
+ it.Advance()) {
+ std::string value_string;
+ bool value_string_available;
+ value_string_available = it.value().GetAsString(&value_string);
+ DCHECK(value_string_available);
+ network_quality_estimator_options.emplace(it.key(), value_string);
+ }
+ }
+
// Configure network quality estimator: Specify the algorithm that should
- // be used for computing the effective connection type. The algorithm
- // is specified using the key-value pairs defined in
- // //net/nqe/network_quality_estimator.cc.
- // TODO(tbansal): Investigate a more robust way of configuring the network
- // quality estimator.
- variation_params["effective_connection_type_algorithm"] =
- "TransportRTTOrDownstreamThroughput";
+ // be used for computing the effective connection type if it has not been
+ // specified by the embedder. The algorithm is specified using the
+ // key-value pairs defined in //net/nqe/network_quality_estimator.cc.
+ if (network_quality_estimator_options.find(
+ "effective_connection_type_algorithm") ==
+ network_quality_estimator_options.end()) {
+ network_quality_estimator_options.emplace(
+ "effective_connection_type_algorithm",
+ "TransportRTTOrDownstreamThroughput");
+ }
network_quality_estimator_ = base::MakeUnique<net::NetworkQualityEstimator>(
- std::unique_ptr<net::ExternalEstimateProvider>(), variation_params,
- false, false, g_net_log.Get().net_log());
+ std::unique_ptr<net::ExternalEstimateProvider>(),
+ network_quality_estimator_options, false, false,
+ g_net_log.Get().net_log());
// Set the socket performance watcher factory so that network quality
// estimator is notified of socket performance metrics from TCP and QUIC.
context_builder.set_socket_performance_watcher_factory(

Powered by Google App Engine
This is Rietveld 408576698