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

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

Issue 544223003: Add SetSupportsQuic method to explicitly specify server that supports QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabled testQuicLoadUrl until local QUIC server is available. Removed setQuicHint. Created 6 years, 3 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/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 4552f10118d45760ec9738c9bcd66e99277f4ad6..c5b9338b0fedfe2c0bac39e150dc7f28620819d9 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,34 @@ void URLRequestContextAdapter::InitializeURLRequestContext(
context_.reset(context_builder.Build());
+ // Currently (circa M39) enabling QUIC requires setting probability threshold.
+ if (config->enable_quic) {
+ context_->http_server_properties()
+ ->SetAlternateProtocolProbabilityThreshold(1.0f);
+ if (!config->quic_hints.empty()) {
Ryan Hamilton 2014/09/15 18:29:44 Consider breaking this new chunk of code (lines 14
mef 2014/09/15 21:01:01 Done.
+ for (size_t hint = 0; hint < config->quic_hints.size(); ++hint) {
+ const URLRequestContextConfig::QuicHint& quic_hint =
+ *config->quic_hints[hint];
+ GURL quic_hint_server(quic_hint.server);
+ net::HostPortPair quic_hint_host(quic_hint_server.HostNoBrackets(),
+ quic_hint_server.EffectiveIntPort());
+ if (!quic_hint_server.is_valid() ||
+ quic_hint.alternate_port <= std::numeric_limits<uint16>::min() ||
+ quic_hint.alternate_port > std::numeric_limits<uint16>::max() ||
+ quic_hint_host.IsEmpty()) {
+ LOG(ERROR) << "Invalid QUIC hint: " << quic_hint.server;
Ryan Hamilton 2014/09/15 18:29:44 Since there are actually two different potential p
mef 2014/09/15 21:01:01 Done.
+ continue;
+ }
+
+ context_->http_server_properties()->SetAlternateProtocol(
+ quic_hint_host,
+ static_cast<uint16>(quic_hint.alternate_port),
+ net::AlternateProtocol::QUIC,
+ 1.0f);
+ }
+ }
+ }
+
if (VLOG_IS_ON(2)) {
net_log_observer_.reset(new NetLogObserver());
context_->net_log()->AddThreadSafeObserver(net_log_observer_.get(),

Powered by Google App Engine
This is Rietveld 408576698