Commit 7e9567e2 authored by Sean Topping's avatar Sean Topping Committed by Commit Bot

[Chromecast] Initialize QuicContext in URLRequestContextFactory

QuicContext needs to be provided for every URLRequestContext. Otherwise,
a crash occurs.

Bug: internal b/144527786
Test: CQ
Change-Id: Ideac2eeefe6b12450906a47b711ebd9afda90e31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1923032Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Commit-Queue: Sean Topping <seantopping@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716412}
parent 2aab1d0c
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "net/http/http_server_properties.h" #include "net/http/http_server_properties.h"
#include "net/http/http_stream_factory.h" #include "net/http/http_stream_factory.h"
#include "net/proxy_resolution/proxy_resolution_service.h" #include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/quic/quic_context.h"
#include "net/ssl/ssl_config_service_defaults.h" #include "net/ssl/ssl_config_service_defaults.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h" #include "net/url_request/url_request_context_builder.h"
...@@ -232,6 +233,8 @@ void URLRequestContextFactory::InitializeSystemContextDependencies() { ...@@ -232,6 +233,8 @@ void URLRequestContextFactory::InitializeSystemContextDependencies() {
system_host_resolver_ = system_host_resolver_ =
net::HostResolver::CreateResolver(host_resolver_manager_.get()); net::HostResolver::CreateResolver(host_resolver_manager_.get());
quic_context_ = std::make_unique<net::QuicContext>();
system_dependencies_initialized_ = true; system_dependencies_initialized_ = true;
} }
...@@ -344,6 +347,7 @@ net::URLRequestContext* URLRequestContextFactory::CreateMediaRequestContext() { ...@@ -344,6 +347,7 @@ net::URLRequestContext* URLRequestContextFactory::CreateMediaRequestContext() {
DCHECK(main_getter_.get()) DCHECK(main_getter_.get())
<< "Getting MediaRequestContext before MainRequestContext"; << "Getting MediaRequestContext before MainRequestContext";
InitializeSystemContextDependencies();
InitializeMediaContextDependencies(); InitializeMediaContextDependencies();
// Reuse main context dependencies except HostResolver and // Reuse main context dependencies except HostResolver and
...@@ -403,6 +407,7 @@ void URLRequestContextFactory::ConfigureURLRequestContext( ...@@ -403,6 +407,7 @@ void URLRequestContextFactory::ConfigureURLRequestContext(
context->set_http_server_properties(http_server_properties_.get()); context->set_http_server_properties(http_server_properties_.get());
context->set_http_user_agent_settings(http_user_agent_settings_.get()); context->set_http_user_agent_settings(http_user_agent_settings_.get());
context->set_net_log(net_log_); context->set_net_log(net_log_);
context->set_quic_context(quic_context_.get());
// settings from the caller // settings from the caller
context->set_job_factory(job_factory.get()); context->set_job_factory(job_factory.get());
......
...@@ -25,6 +25,7 @@ class HttpTransactionFactory; ...@@ -25,6 +25,7 @@ class HttpTransactionFactory;
class HttpUserAgentSettings; class HttpUserAgentSettings;
class NetLog; class NetLog;
class ProxyConfigService; class ProxyConfigService;
class QuicContext;
class URLRequestContextGetter; class URLRequestContextGetter;
class URLRequestJobFactory; class URLRequestJobFactory;
} // namespace net } // namespace net
...@@ -130,6 +131,7 @@ class URLRequestContextFactory { ...@@ -130,6 +131,7 @@ class URLRequestContextFactory {
std::unique_ptr<net::CookieStore> system_cookie_store_; std::unique_ptr<net::CookieStore> system_cookie_store_;
std::unique_ptr<net::URLRequestJobFactory> system_job_factory_; std::unique_ptr<net::URLRequestJobFactory> system_job_factory_;
std::unique_ptr<net::HostResolver> system_host_resolver_; std::unique_ptr<net::HostResolver> system_host_resolver_;
std::unique_ptr<net::QuicContext> quic_context_;
bool main_dependencies_initialized_; bool main_dependencies_initialized_;
std::unique_ptr<net::HttpNetworkSession> main_network_session_; std::unique_ptr<net::HttpNetworkSession> main_network_session_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment