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

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: Sync 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
« no previous file with comments | « components/cronet/android/url_request_context_adapter.h ('k') | components/cronet/tools/cr_cronet.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..00e463e7f83d0f3cefbb14abfe0891ed28366c08 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,42 @@ 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);
Ryan Hamilton 2014/09/17 22:07:26 Doh! I should have noticed this before. This shoul
+ for (size_t hint = 0; hint < config->quic_hints.size(); ++hint) {
+ const URLRequestContextConfig::QuicHint& quic_hint =
+ *config->quic_hints[hint];
+ if (quic_hint.host.empty()) {
+ LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host;
+ continue;
+ }
+
+ if (quic_hint.port <= std::numeric_limits<uint16>::min() ||
+ quic_hint.port > std::numeric_limits<uint16>::max()) {
+ LOG(ERROR) << "Invalid QUIC hint port: "
+ << quic_hint.port;
+ continue;
+ }
+
+ if (quic_hint.alternate_port <= std::numeric_limits<uint16>::min() ||
+ quic_hint.alternate_port > std::numeric_limits<uint16>::max()) {
+ LOG(ERROR) << "Invalid QUIC hint alternate port: "
+ << quic_hint.alternate_port;
+ continue;
+ }
+
+ net::HostPortPair quic_hint_host_port_pair(quic_hint.host,
+ quic_hint.port);
+ context_->http_server_properties()->SetAlternateProtocol(
+ quic_hint_host_port_pair,
+ 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(),
« no previous file with comments | « components/cronet/android/url_request_context_adapter.h ('k') | components/cronet/tools/cr_cronet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698