Index: components/cronet/android/url_request_context_adapter.cc |
diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/url_request_context_adapter.cc |
index 0feb0f13e4ad825768ca041f4665061cfcafeba8..305f0073ae0e40f5fbef997eee3d451b909745a9 100644 |
--- a/components/cronet/android/url_request_context_adapter.cc |
+++ b/components/cronet/android/url_request_context_adapter.cc |
@@ -13,7 +13,7 @@ |
#include "net/cert/cert_verifier.h" |
#include "net/http/http_auth_handler_factory.h" |
#include "net/http/http_network_layer.h" |
-#include "net/http/http_server_properties_impl.h" |
+#include "net/http/http_server_properties.h" |
#include "net/proxy/proxy_config_service_fixed.h" |
#include "net/proxy/proxy_service.h" |
#include "net/ssl/ssl_config_service_defaults.h" |
@@ -144,6 +144,11 @@ void URLRequestContextAdapter::InitializeURLRequestContext( |
context_.reset(context_builder.Build()); |
+ // Currently (circa M39) enabling QUIC requires setting probability threshold. |
+ double quic_threshold = config->enable_quic ? 1.0f : 0.0f; |
+ context_->http_server_properties()->SetAlternateProtocolProbabilityThreshold( |
+ quic_threshold); |
+ |
if (VLOG_IS_ON(2)) { |
net_log_observer_.reset(new NetLogObserver()); |
context_->net_log()->AddThreadSafeObserver(net_log_observer_.get(), |
@@ -201,6 +206,19 @@ void URLRequestContextAdapter::StopNetLog() { |
} |
} |
+void URLRequestContextAdapter::SetSupportsQuic(const net::HostPortPair& server, |
+ uint16 alternate_port, |
+ double probability) { |
+ GetNetworkTaskRunner()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&net::HttpServerProperties::SetAlternateProtocol, |
+ context_->http_server_properties(), |
+ server, |
+ alternate_port, |
+ net::AlternateProtocol::QUIC, |
+ probability)); |
+} |
+ |
void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { |
VLOG(2) << "Net log entry: type=" << entry.type() |
<< ", source=" << entry.source().type << ", phase=" << entry.phase(); |