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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2841163002: Make ProfileIOData's ProxyService fetch PACs with the main URLRequestContext (Closed)
Patch Set: Merge fix Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 ProfileImplIOData::~ProfileImplIOData() { 428 ProfileImplIOData::~ProfileImplIOData() {
429 if (domain_reliability_monitor_) 429 if (domain_reliability_monitor_)
430 domain_reliability_monitor_->Shutdown(); 430 domain_reliability_monitor_->Shutdown();
431 431
432 DestroyResourceContext(); 432 DestroyResourceContext();
433 433
434 if (media_request_context_) 434 if (media_request_context_)
435 media_request_context_->AssertNoURLRequests(); 435 media_request_context_->AssertNoURLRequests();
436 } 436 }
437 437
438 void ProfileImplIOData::InitializeInternal( 438 std::unique_ptr<net::NetworkDelegate>
439 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, 439 ProfileImplIOData::ConfigureNetworkDelegate(
440 ProfileParams* profile_params, 440 IOThread* io_thread,
441 content::ProtocolHandlerMap* protocol_handlers, 441 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate) const {
442 content::URLRequestInterceptorScopedVector request_interceptors) const {
443 net::URLRequestContext* main_context = main_request_context();
444 net::URLRequestContextStorage* main_context_storage =
445 main_request_context_storage();
446
447 IOThread* const io_thread = profile_params->io_thread;
448 IOThread::Globals* const io_thread_globals = io_thread->globals();
449
450 if (lazy_params_->domain_reliability_monitor) { 442 if (lazy_params_->domain_reliability_monitor) {
451 // Hold on to a raw pointer to call Shutdown() in ~ProfileImplIOData. 443 // Hold on to a raw pointer to call Shutdown() in ~ProfileImplIOData.
452 domain_reliability_monitor_ = 444 domain_reliability_monitor_ =
453 lazy_params_->domain_reliability_monitor.get(); 445 lazy_params_->domain_reliability_monitor.get();
454 446
455 domain_reliability_monitor_->InitURLRequestContext(main_context); 447 domain_reliability_monitor_->InitURLRequestContext(main_request_context());
456 domain_reliability_monitor_->AddBakedInConfigs(); 448 domain_reliability_monitor_->AddBakedInConfigs();
457 domain_reliability_monitor_->SetDiscardUploads( 449 domain_reliability_monitor_->SetDiscardUploads(
458 !GetMetricsEnabledStateOnIOThread()); 450 !GetMetricsEnabledStateOnIOThread());
459 451
460 chrome_network_delegate->set_domain_reliability_monitor( 452 chrome_network_delegate->set_domain_reliability_monitor(
461 std::move(lazy_params_->domain_reliability_monitor)); 453 std::move(lazy_params_->domain_reliability_monitor));
462 } 454 }
463 455
456 return data_reduction_proxy_io_data()->CreateNetworkDelegate(
457 io_thread->globals()->data_use_ascriber->CreateNetworkDelegate(
458 std::move(chrome_network_delegate),
459 io_thread->GetMetricsDataUseForwarder()),
460 true);
461 }
462
463 void ProfileImplIOData::InitializeInternal(
464 ProfileParams* profile_params,
465 content::ProtocolHandlerMap* protocol_handlers,
466 content::URLRequestInterceptorScopedVector request_interceptors) const {
mmenke 2017/05/02 20:10:26 Splitting this method in two does seem a bit ugly,
467 net::URLRequestContext* main_context = main_request_context();
468 net::URLRequestContextStorage* main_context_storage =
469 main_request_context_storage();
470
471 IOThread* const io_thread = profile_params->io_thread;
472 IOThread::Globals* const io_thread_globals = io_thread->globals();
473
464 ApplyProfileParamsToContext(main_context); 474 ApplyProfileParamsToContext(main_context);
465 475
466 if (lazy_params_->http_server_properties_manager) { 476 if (lazy_params_->http_server_properties_manager) {
467 lazy_params_->http_server_properties_manager->InitializeOnNetworkThread(); 477 lazy_params_->http_server_properties_manager->InitializeOnNetworkThread();
468 main_context_storage->set_http_server_properties( 478 main_context_storage->set_http_server_properties(
469 std::move(lazy_params_->http_server_properties_manager)); 479 std::move(lazy_params_->http_server_properties_manager));
470 } 480 }
471 481
472 main_context->set_transport_security_state(transport_security_state()); 482 main_context->set_transport_security_state(transport_security_state());
473 main_context->set_ct_policy_enforcer( 483 main_context->set_ct_policy_enforcer(
474 io_thread_globals->ct_policy_enforcer.get()); 484 io_thread_globals->ct_policy_enforcer.get());
475 485
476 main_context->set_net_log(io_thread->net_log()); 486 main_context->set_net_log(io_thread->net_log());
477 487
478 main_context_storage->set_network_delegate(
479 data_reduction_proxy_io_data()->CreateNetworkDelegate(
480 io_thread_globals->data_use_ascriber->CreateNetworkDelegate(
481 std::move(chrome_network_delegate),
482 io_thread->GetMetricsDataUseForwarder()),
483 true));
484
485 main_context->set_host_resolver(
486 io_thread_globals->host_resolver.get());
487
488 main_context->set_http_auth_handler_factory( 488 main_context->set_http_auth_handler_factory(
489 io_thread_globals->http_auth_handler_factory.get()); 489 io_thread_globals->http_auth_handler_factory.get());
490 490
491 main_context->set_proxy_service(proxy_service()); 491 main_context->set_proxy_service(proxy_service());
492 492
493 // Set up cookie store. 493 // Set up cookie store.
494 DCHECK(!lazy_params_->cookie_path.empty()); 494 DCHECK(!lazy_params_->cookie_path.empty());
495 495
496 content::CookieStoreConfig cookie_config( 496 content::CookieStoreConfig cookie_config(
497 lazy_params_->cookie_path, lazy_params_->session_cookie_mode, 497 lazy_params_->cookie_path, lazy_params_->session_cookie_mode,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 const base::Closure& completion) { 807 const base::Closure& completion) {
808 DCHECK_CURRENTLY_ON(BrowserThread::IO); 808 DCHECK_CURRENTLY_ON(BrowserThread::IO);
809 DCHECK(initialized()); 809 DCHECK(initialized());
810 810
811 DCHECK(transport_security_state()); 811 DCHECK(transport_security_state());
812 // Completes synchronously. 812 // Completes synchronously.
813 transport_security_state()->DeleteAllDynamicDataSince(time); 813 transport_security_state()->DeleteAllDynamicDataSince(time);
814 DCHECK(http_server_properties_manager_); 814 DCHECK(http_server_properties_manager_);
815 http_server_properties_manager_->Clear(completion); 815 http_server_properties_manager_->Clear(completion);
816 } 816 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698