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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 2907463002: Split HttpNetworkSession::Params into two structs. (Closed)
Patch Set: Fix Created 3 years, 6 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/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 CreateDefaultAuthHandlerFactory(); 626 CreateDefaultAuthHandlerFactory();
627 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService()); 627 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService());
628 globals_->host_mapping_rules.reset(new net::HostMappingRules()); 628 globals_->host_mapping_rules.reset(new net::HostMappingRules());
629 if (command_line.HasSwitch(switches::kHostRules)) { 629 if (command_line.HasSwitch(switches::kHostRules)) {
630 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString"); 630 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString");
631 globals_->host_mapping_rules->SetRulesFromString( 631 globals_->host_mapping_rules->SetRulesFromString(
632 command_line.GetSwitchValueASCII(switches::kHostRules)); 632 command_line.GetSwitchValueASCII(switches::kHostRules));
633 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString"); 633 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString");
634 } 634 }
635 params_.host_mapping_rules = *globals_->host_mapping_rules.get(); 635 session_params_.host_mapping_rules = *globals_->host_mapping_rules.get();
636 globals_->enable_brotli = 636 globals_->enable_brotli =
637 base::FeatureList::IsEnabled(features::kBrotliEncoding); 637 base::FeatureList::IsEnabled(features::kBrotliEncoding);
638 params_.enable_token_binding = 638 session_params_.enable_token_binding =
639 base::FeatureList::IsEnabled(features::kTokenBinding); 639 base::FeatureList::IsEnabled(features::kTokenBinding);
640 640
641 // Check for OS support of TCP FastOpen, and turn it on for all connections if 641 // Check for OS support of TCP FastOpen, and turn it on for all connections if
642 // indicated by user. 642 // indicated by user.
643 // TODO(rch): Make the client socket factory a per-network session instance, 643 // TODO(rch): Make the client socket factory a per-network session instance,
644 // constructed from a NetworkSession::Params, to allow us to move this option 644 // constructed from a NetworkSession::Params, to allow us to move this option
645 // to IOThread::Globals & HttpNetworkSession::Params. 645 // to IOThread::Globals & HttpNetworkSession::Params.
646 bool always_enable_tfo_if_supported = 646 bool always_enable_tfo_if_supported =
647 command_line.HasSwitch(switches::kEnableTcpFastOpen); 647 command_line.HasSwitch(switches::kEnableTcpFastOpen);
648 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); 648 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported);
649 649
650 ConfigureParamsFromFieldTrialsAndCommandLine( 650 ConfigureParamsFromFieldTrialsAndCommandLine(
651 command_line, is_quic_allowed_by_policy_, 651 command_line, is_quic_allowed_by_policy_,
652 http_09_on_non_default_ports_enabled_, &params_); 652 http_09_on_non_default_ports_enabled_, &session_params_);
653 653
654 #if defined(OS_MACOSX) 654 #if defined(OS_MACOSX)
655 // Start observing Keychain events. This needs to be done on the UI thread, 655 // Start observing Keychain events. This needs to be done on the UI thread,
656 // as Keychain services requires a CFRunLoop. 656 // as Keychain services requires a CFRunLoop.
657 BrowserThread::PostTask(BrowserThread::UI, 657 BrowserThread::PostTask(BrowserThread::UI,
658 FROM_HERE, 658 FROM_HERE,
659 base::Bind(&ObserveKeychainEvents)); 659 base::Bind(&ObserveKeychainEvents));
660 #endif 660 #endif
661 661
662 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 662 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 void IOThread::ClearHostCache( 784 void IOThread::ClearHostCache(
785 const base::Callback<bool(const std::string&)>& host_filter) { 785 const base::Callback<bool(const std::string&)>& host_filter) {
786 DCHECK_CURRENTLY_ON(BrowserThread::IO); 786 DCHECK_CURRENTLY_ON(BrowserThread::IO);
787 787
788 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); 788 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
789 if (host_cache) 789 if (host_cache)
790 host_cache->ClearForHosts(host_filter); 790 host_cache->ClearForHosts(host_filter);
791 } 791 }
792 792
793 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { 793 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const {
794 return params_; 794 return session_params_;
795 } 795 }
796 796
797 void IOThread::DisableQuic() { 797 void IOThread::DisableQuic() {
798 params_.enable_quic = false; 798 session_params_.enable_quic = false;
799 799
800 if (globals_->system_request_context_storage) 800 if (globals_->system_request_context_storage)
801 globals_->system_request_context_storage->http_network_session() 801 globals_->system_request_context_storage->http_network_session()
802 ->DisableQuic(); 802 ->DisableQuic();
803 } 803 }
804 804
805 base::TimeTicks IOThread::creation_time() const { 805 base::TimeTicks IOThread::creation_time() const {
806 return creation_time_; 806 return creation_time_;
807 } 807 }
808 808
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 884
885 context_storage->set_transport_security_state( 885 context_storage->set_transport_security_state(
886 base::MakeUnique<net::TransportSecurityState>()); 886 base::MakeUnique<net::TransportSecurityState>());
887 887
888 context_storage->set_http_server_properties( 888 context_storage->set_http_server_properties(
889 base::MakeUnique<net::HttpServerPropertiesImpl>()); 889 base::MakeUnique<net::HttpServerPropertiesImpl>());
890 890
891 context->set_cert_verifier(globals_->cert_verifier.get()); 891 context->set_cert_verifier(globals_->cert_verifier.get());
892 context->set_cert_transparency_verifier( 892 context->set_cert_transparency_verifier(
893 globals_->cert_transparency_verifier.get()); 893 globals_->cert_transparency_verifier.get());
894
894 context_storage->set_ct_policy_enforcer( 895 context_storage->set_ct_policy_enforcer(
895 base::MakeUnique<net::CTPolicyEnforcer>()); 896 base::MakeUnique<net::CTPolicyEnforcer>());
896 897
897 const base::CommandLine& command_line = 898 const base::CommandLine& command_line =
898 *base::CommandLine::ForCurrentProcess(); 899 *base::CommandLine::ForCurrentProcess();
899 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService( 900 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService(
900 net_log_, context, context->network_delegate(), 901 net_log_, context, context->network_delegate(),
901 std::move(system_proxy_config_service_), command_line, 902 std::move(system_proxy_config_service_), command_line,
902 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled())); 903 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled()));
903 904
904 net::HttpNetworkSession::Params system_params(params_); 905 net::HttpNetworkSession::Context session_context;
905 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( 906 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(
906 context, &system_params); 907 context, &session_context);
907 908
908 context_storage->set_http_network_session( 909 context_storage->set_http_network_session(
909 base::MakeUnique<net::HttpNetworkSession>(system_params)); 910 base::MakeUnique<net::HttpNetworkSession>(session_params_,
911 session_context));
910 context_storage->set_http_transaction_factory( 912 context_storage->set_http_transaction_factory(
911 base::MakeUnique<net::HttpNetworkLayer>( 913 base::MakeUnique<net::HttpNetworkLayer>(
912 context_storage->http_network_session())); 914 context_storage->http_network_session()));
913 915
914 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( 916 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
915 new net::URLRequestJobFactoryImpl()); 917 new net::URLRequestJobFactoryImpl());
916 918
917 job_factory->SetProtocolHandler(url::kDataScheme, 919 job_factory->SetProtocolHandler(url::kDataScheme,
918 base::MakeUnique<net::DataProtocolHandler>()); 920 base::MakeUnique<net::DataProtocolHandler>());
919 job_factory->SetProtocolHandler( 921 job_factory->SetProtocolHandler(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); 1023 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort);
1022 } 1024 }
1023 1025
1024 params->http_09_on_non_default_ports_enabled = 1026 params->http_09_on_non_default_ports_enabled =
1025 http_09_on_non_default_ports_enabled; 1027 http_09_on_non_default_ports_enabled;
1026 } 1028 }
1027 1029
1028 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { 1030 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() {
1029 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); 1031 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread);
1030 } 1032 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698