Fix brightray::URLRequestContextGetter::GetURLRequestContext()

Split HttpNetworkSession::Params into two structs.
https://codereview.chromium.org/2907463002

Make HttpNetworkSession::host_mapping_rules no longer a pointer.
https://codereview.chromium.org/2906463002
This commit is contained in:
Aleksei Kuzmin 2017-08-25 12:51:13 +03:00 committed by Cheng Zhao
parent 491249108e
commit c6333728d9

View file

@ -298,9 +298,11 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
storage_->set_cert_transparency_verifier(std::move(ct_verifier));
storage_->set_ct_policy_enforcer(base::MakeUnique<net::CTPolicyEnforcer>());
net::HttpNetworkSession::Params network_session_params;
net::HttpNetworkSession::Context network_session_context;
net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(
url_request_context_.get(), &network_session_params);
url_request_context_.get(), &network_session_context);
net::HttpNetworkSession::Params network_session_params;
network_session_params.ignore_certificate_errors = false;
// --disable-http2
@ -316,16 +318,16 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
host_mapping_rules_.reset(new net::HostMappingRules);
host_mapping_rules_->SetRulesFromString(
command_line.GetSwitchValueASCII(switches::kHostRules));
network_session_params.host_mapping_rules = host_mapping_rules_.get();
network_session_params.host_mapping_rules = *host_mapping_rules_.get();
}
// Give |storage_| ownership at the end in case it's |mapped_host_resolver|.
storage_->set_host_resolver(std::move(host_resolver));
network_session_params.host_resolver =
network_session_context.host_resolver =
url_request_context_->host_resolver();
http_network_session_.reset(
new net::HttpNetworkSession(network_session_params));
http_network_session_.reset(new net::HttpNetworkSession(
network_session_params, network_session_context));
std::unique_ptr<net::HttpCache::BackendFactory> backend;
if (in_memory_) {
backend = net::HttpCache::DefaultBackend::InMemory(0);