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

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

Issue 2907463002: Split HttpNetworkSession::Params into two structs. (Closed)
Patch Set: Response to comments 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/profiles/off_the_record_profile_io_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 611
612 CreateDefaultAuthHandlerFactory(); 612 CreateDefaultAuthHandlerFactory();
613 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService()); 613 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService());
614 globals_->host_mapping_rules.reset(new net::HostMappingRules()); 614 globals_->host_mapping_rules.reset(new net::HostMappingRules());
615 if (command_line.HasSwitch(switches::kHostRules)) { 615 if (command_line.HasSwitch(switches::kHostRules)) {
616 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString"); 616 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString");
617 globals_->host_mapping_rules->SetRulesFromString( 617 globals_->host_mapping_rules->SetRulesFromString(
618 command_line.GetSwitchValueASCII(switches::kHostRules)); 618 command_line.GetSwitchValueASCII(switches::kHostRules));
619 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString"); 619 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString");
620 } 620 }
621 params_.host_mapping_rules = *globals_->host_mapping_rules.get(); 621
622 session_params_.host_mapping_rules = *globals_->host_mapping_rules.get();
622 globals_->enable_brotli = 623 globals_->enable_brotli =
623 base::FeatureList::IsEnabled(features::kBrotliEncoding); 624 base::FeatureList::IsEnabled(features::kBrotliEncoding);
624 params_.enable_token_binding = 625 session_params_.enable_token_binding =
625 base::FeatureList::IsEnabled(features::kTokenBinding); 626 base::FeatureList::IsEnabled(features::kTokenBinding);
626 627
627 // Check for OS support of TCP FastOpen, and turn it on for all connections if 628 // Check for OS support of TCP FastOpen, and turn it on for all connections if
628 // indicated by user. 629 // indicated by user.
629 // TODO(rch): Make the client socket factory a per-network session instance, 630 // TODO(rch): Make the client socket factory a per-network session instance,
630 // constructed from a NetworkSession::Params, to allow us to move this option 631 // constructed from a NetworkSession::Params, to allow us to move this option
631 // to IOThread::Globals & HttpNetworkSession::Params. 632 // to IOThread::Globals & HttpNetworkSession::Params.
632 bool always_enable_tfo_if_supported = 633 bool always_enable_tfo_if_supported =
633 command_line.HasSwitch(switches::kEnableTcpFastOpen); 634 command_line.HasSwitch(switches::kEnableTcpFastOpen);
634 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); 635 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported);
635 636
636 ConfigureParamsFromFieldTrialsAndCommandLine( 637 ConfigureParamsFromFieldTrialsAndCommandLine(
637 command_line, is_quic_allowed_by_policy_, 638 command_line, is_quic_allowed_by_policy_,
638 http_09_on_non_default_ports_enabled_, &params_); 639 http_09_on_non_default_ports_enabled_, &session_params_);
639 640
640 #if defined(OS_MACOSX) 641 #if defined(OS_MACOSX)
641 // Start observing Keychain events. This needs to be done on the UI thread, 642 // Start observing Keychain events. This needs to be done on the UI thread,
642 // as Keychain services requires a CFRunLoop. 643 // as Keychain services requires a CFRunLoop.
643 BrowserThread::PostTask(BrowserThread::UI, 644 BrowserThread::PostTask(BrowserThread::UI,
644 FROM_HERE, 645 FROM_HERE,
645 base::Bind(&ObserveKeychainEvents)); 646 base::Bind(&ObserveKeychainEvents));
646 #endif 647 #endif
647 648
648 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 649 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 void IOThread::ClearHostCache( 771 void IOThread::ClearHostCache(
771 const base::Callback<bool(const std::string&)>& host_filter) { 772 const base::Callback<bool(const std::string&)>& host_filter) {
772 DCHECK_CURRENTLY_ON(BrowserThread::IO); 773 DCHECK_CURRENTLY_ON(BrowserThread::IO);
773 774
774 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); 775 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
775 if (host_cache) 776 if (host_cache)
776 host_cache->ClearForHosts(host_filter); 777 host_cache->ClearForHosts(host_filter);
777 } 778 }
778 779
779 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { 780 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const {
780 return params_; 781 return session_params_;
781 } 782 }
782 783
783 void IOThread::DisableQuic() { 784 void IOThread::DisableQuic() {
784 params_.enable_quic = false; 785 session_params_.enable_quic = false;
785 786
786 if (globals_->system_request_context_storage) 787 if (globals_->system_request_context_storage)
787 globals_->system_request_context_storage->http_network_session() 788 globals_->system_request_context_storage->http_network_session()
788 ->DisableQuic(); 789 ->DisableQuic();
789 } 790 }
790 791
791 base::TimeTicks IOThread::creation_time() const { 792 base::TimeTicks IOThread::creation_time() const {
792 return creation_time_; 793 return creation_time_;
793 } 794 }
794 795
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 871
871 context_storage->set_transport_security_state( 872 context_storage->set_transport_security_state(
872 base::MakeUnique<net::TransportSecurityState>()); 873 base::MakeUnique<net::TransportSecurityState>());
873 874
874 context_storage->set_http_server_properties( 875 context_storage->set_http_server_properties(
875 base::MakeUnique<net::HttpServerPropertiesImpl>()); 876 base::MakeUnique<net::HttpServerPropertiesImpl>());
876 877
877 context->set_cert_verifier(globals_->cert_verifier.get()); 878 context->set_cert_verifier(globals_->cert_verifier.get());
878 context->set_cert_transparency_verifier( 879 context->set_cert_transparency_verifier(
879 globals_->cert_transparency_verifier.get()); 880 globals_->cert_transparency_verifier.get());
881
880 context_storage->set_ct_policy_enforcer( 882 context_storage->set_ct_policy_enforcer(
881 base::MakeUnique<net::CTPolicyEnforcer>()); 883 base::MakeUnique<net::CTPolicyEnforcer>());
882 884
883 const base::CommandLine& command_line = 885 const base::CommandLine& command_line =
884 *base::CommandLine::ForCurrentProcess(); 886 *base::CommandLine::ForCurrentProcess();
885 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService( 887 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService(
886 net_log_, context, context->network_delegate(), 888 net_log_, context, context->network_delegate(),
887 std::move(system_proxy_config_service_), command_line, 889 std::move(system_proxy_config_service_), command_line,
888 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled())); 890 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled()));
889 891
890 net::HttpNetworkSession::Params system_params(params_); 892 net::HttpNetworkSession::Context session_context;
891 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( 893 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(
892 context, &system_params); 894 context, &session_context);
893 895
894 context_storage->set_http_network_session( 896 context_storage->set_http_network_session(
895 base::MakeUnique<net::HttpNetworkSession>(system_params)); 897 base::MakeUnique<net::HttpNetworkSession>(session_params_,
898 session_context));
896 context_storage->set_http_transaction_factory( 899 context_storage->set_http_transaction_factory(
897 base::MakeUnique<net::HttpNetworkLayer>( 900 base::MakeUnique<net::HttpNetworkLayer>(
898 context_storage->http_network_session())); 901 context_storage->http_network_session()));
899 902
900 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( 903 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
901 new net::URLRequestJobFactoryImpl()); 904 new net::URLRequestJobFactoryImpl());
902 905
903 job_factory->SetProtocolHandler(url::kDataScheme, 906 job_factory->SetProtocolHandler(url::kDataScheme,
904 base::MakeUnique<net::DataProtocolHandler>()); 907 base::MakeUnique<net::DataProtocolHandler>());
905 job_factory->SetProtocolHandler( 908 job_factory->SetProtocolHandler(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); 1010 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort);
1008 } 1011 }
1009 1012
1010 params->http_09_on_non_default_ports_enabled = 1013 params->http_09_on_non_default_ports_enabled =
1011 http_09_on_non_default_ports_enabled; 1014 http_09_on_non_default_ports_enabled;
1012 } 1015 }
1013 1016
1014 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { 1017 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() {
1015 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); 1018 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread);
1016 } 1019 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/profiles/off_the_record_profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698