Chromium Code Reviews| Index: chrome/browser/profiles/profile_impl_io_data.cc |
| diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc |
| index ae46c2ba5428e59892f0c77cdfd96cd0a70707e4..00837772c5fe6cef90e4c587bb219a63d8194d49 100644 |
| --- a/chrome/browser/profiles/profile_impl_io_data.cc |
| +++ b/chrome/browser/profiles/profile_impl_io_data.cc |
| @@ -435,24 +435,16 @@ ProfileImplIOData::~ProfileImplIOData() { |
| media_request_context_->AssertNoURLRequests(); |
| } |
| -void ProfileImplIOData::InitializeInternal( |
| - std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, |
| - ProfileParams* profile_params, |
| - content::ProtocolHandlerMap* protocol_handlers, |
| - content::URLRequestInterceptorScopedVector request_interceptors) const { |
| - net::URLRequestContext* main_context = main_request_context(); |
| - net::URLRequestContextStorage* main_context_storage = |
| - main_request_context_storage(); |
| - |
| - IOThread* const io_thread = profile_params->io_thread; |
| - IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| - |
| +std::unique_ptr<net::NetworkDelegate> |
| +ProfileImplIOData::ConfigureNetworkDelegate( |
| + IOThread* io_thread, |
| + std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate) const { |
| if (lazy_params_->domain_reliability_monitor) { |
| // Hold on to a raw pointer to call Shutdown() in ~ProfileImplIOData. |
| domain_reliability_monitor_ = |
| lazy_params_->domain_reliability_monitor.get(); |
| - domain_reliability_monitor_->InitURLRequestContext(main_context); |
| + domain_reliability_monitor_->InitURLRequestContext(main_request_context()); |
| domain_reliability_monitor_->AddBakedInConfigs(); |
| domain_reliability_monitor_->SetDiscardUploads( |
| !GetMetricsEnabledStateOnIOThread()); |
| @@ -461,6 +453,24 @@ void ProfileImplIOData::InitializeInternal( |
| std::move(lazy_params_->domain_reliability_monitor)); |
| } |
| + return data_reduction_proxy_io_data()->CreateNetworkDelegate( |
| + io_thread->globals()->data_use_ascriber->CreateNetworkDelegate( |
| + std::move(chrome_network_delegate), |
| + io_thread->GetMetricsDataUseForwarder()), |
| + true); |
| +} |
| + |
| +void ProfileImplIOData::InitializeInternal( |
| + ProfileParams* profile_params, |
| + content::ProtocolHandlerMap* protocol_handlers, |
| + content::URLRequestInterceptorScopedVector request_interceptors) const { |
|
mmenke
2017/05/02 20:10:26
Splitting this method in two does seem a bit ugly,
|
| + net::URLRequestContext* main_context = main_request_context(); |
| + net::URLRequestContextStorage* main_context_storage = |
| + main_request_context_storage(); |
| + |
| + IOThread* const io_thread = profile_params->io_thread; |
| + IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| + |
| ApplyProfileParamsToContext(main_context); |
| if (lazy_params_->http_server_properties_manager) { |
| @@ -475,16 +485,6 @@ void ProfileImplIOData::InitializeInternal( |
| main_context->set_net_log(io_thread->net_log()); |
| - main_context_storage->set_network_delegate( |
| - data_reduction_proxy_io_data()->CreateNetworkDelegate( |
| - io_thread_globals->data_use_ascriber->CreateNetworkDelegate( |
| - std::move(chrome_network_delegate), |
| - io_thread->GetMetricsDataUseForwarder()), |
| - true)); |
| - |
| - main_context->set_host_resolver( |
| - io_thread_globals->host_resolver.get()); |
| - |
| main_context->set_http_auth_handler_factory( |
| io_thread_globals->http_auth_handler_factory.get()); |