Index: chromecast/browser/url_request_context_factory.cc |
diff --git a/chromecast/browser/url_request_context_factory.cc b/chromecast/browser/url_request_context_factory.cc |
index ef726e6dd507f6c9f0611c7b02387bd197f94422..1691517d59b453a94c90080607075cce9df7481c 100644 |
--- a/chromecast/browser/url_request_context_factory.cc |
+++ b/chromecast/browser/url_request_context_factory.cc |
@@ -165,8 +165,8 @@ URLRequestContextFactory::URLRequestContextFactory() |
system_network_delegate_(CastNetworkDelegate::Create()), |
system_dependencies_initialized_(false), |
main_dependencies_initialized_(false), |
- media_dependencies_initialized_(false) { |
-} |
+ media_dependencies_initialized_(false), |
+ enable_quic_(true) {} |
URLRequestContextFactory::~URLRequestContextFactory() { |
} |
@@ -307,6 +307,7 @@ void URLRequestContextFactory::InitializeMediaContextDependencies( |
void URLRequestContextFactory::PopulateNetworkSessionParams( |
bool ignore_certificate_errors, |
net::HttpNetworkSession::Params* params) { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
params->host_resolver = host_resolver_.get(); |
params->cert_verifier = cert_verifier_.get(); |
params->channel_id_service = channel_id_service_.get(); |
@@ -318,6 +319,9 @@ void URLRequestContextFactory::PopulateNetworkSessionParams( |
params->http_server_properties = http_server_properties_.get(); |
params->ignore_certificate_errors = ignore_certificate_errors; |
params->proxy_service = proxy_service_.get(); |
+ |
+ LOG(INFO) << "Set HttpNetworkSessionParams.enable_quic = " << enable_quic_; |
halliwell
2017/01/27 04:32:53
how frequently does this get logged? Just want to
mbjorge
2017/01/27 06:22:20
It'll get logged a max of 3 times, once for each o
|
+ params->enable_quic = enable_quic_; |
} |
net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { |
@@ -427,5 +431,47 @@ void URLRequestContextFactory::InitializeNetworkDelegates() { |
LOG(INFO) << "Initialized system network delegate."; |
} |
+void URLRequestContextFactory::DisableQuic() { |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::IO, FROM_HERE, |
+ base::Bind(&URLRequestContextFactory::DisableQuicOnBrowserIOThread, |
+ base::Unretained(this))); |
halliwell
2017/01/27 04:32:53
Should this be done with weak ptr, or is there a g
mbjorge
2017/01/27 06:22:20
URLRequestContextFactory is owned by CastContentBr
halliwell
2017/01/27 18:35:35
That's fine, looks good.
|
+} |
+ |
+void URLRequestContextFactory::DisableQuicOnBrowserIOThread() { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
+ if (!enable_quic_) |
+ return; |
+ |
+ LOG(INFO) << "Disabled QUIC."; |
+ |
+ // Disable QUIC for any new URLContextGetter that gets created. |
halliwell
2017/01/27 04:32:53
this and the next 3 comments don't add value (what
mbjorge
2017/01/27 06:22:20
done
|
+ enable_quic_ = false; |
+ |
+ // Disable QUIC for the main URLContext. |
+ if (main_getter_) { |
+ main_getter_->GetURLRequestContext() |
+ ->http_transaction_factory() |
+ ->GetSession() |
+ ->DisableQuic(); |
+ } |
+ |
+ // Disable QUIC for the system URLContext. |
+ if (system_getter_) { |
+ system_getter_->GetURLRequestContext() |
+ ->http_transaction_factory() |
+ ->GetSession() |
+ ->DisableQuic(); |
+ } |
+ |
+ // Disable QUIC for the media URLContext. |
+ if (media_getter_) { |
+ media_getter_->GetURLRequestContext() |
+ ->http_transaction_factory() |
+ ->GetSession() |
+ ->DisableQuic(); |
+ } |
+} |
+ |
} // namespace shell |
} // namespace chromecast |