OLD | NEW |
---|---|
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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 if (base::StringToInt(s, &n) && n >= 0) { | 181 if (base::StringToInt(s, &n) && n >= 0) { |
182 options.max_retry_attempts = static_cast<size_t>(n); | 182 options.max_retry_attempts = static_cast<size_t>(n); |
183 } else { | 183 } else { |
184 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; | 184 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 scoped_ptr<net::HostResolver> global_host_resolver( | 188 scoped_ptr<net::HostResolver> global_host_resolver( |
189 net::HostResolver::CreateSystemResolver(options, net_log)); | 189 net::HostResolver::CreateSystemResolver(options, net_log)); |
190 | 190 |
191 // Determine if we should disable IPv6 support. | 191 if (command_line.HasSwitch(switches::kDisableIPv6)) { |
szym
2014/02/19 00:13:29
IMO if anything deserves to be left behind, it is
willchan no longer on Chromium
2014/02/19 00:21:43
Oh, maybe I got this wrong. Did you think we shoul
szym
2014/02/19 02:29:16
In contrast to -async-dns (which can be moved to n
| |
192 if (command_line.HasSwitch(switches::kEnableIPv6)) { | |
193 // Disable IPv6 probing. | |
194 global_host_resolver->SetDefaultAddressFamily( | |
195 net::ADDRESS_FAMILY_UNSPECIFIED); | |
196 } else if (command_line.HasSwitch(switches::kDisableIPv6)) { | |
197 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 192 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
198 } | 193 } |
199 | 194 |
200 // If hostname remappings were specified on the command-line, layer these | 195 // If hostname remappings were specified on the command-line, layer these |
201 // rules on top of the real host resolver. This allows forwarding all requests | 196 // rules on top of the real host resolver. This allows forwarding all requests |
202 // through a designated test server. | 197 // through a designated test server. |
203 if (!command_line.HasSwitch(switches::kHostResolverRules)) | 198 if (!command_line.HasSwitch(switches::kHostResolverRules)) |
204 return global_host_resolver.PassAs<net::HostResolver>(); | 199 return global_host_resolver.PassAs<net::HostResolver>(); |
205 | 200 |
206 scoped_ptr<net::MappedHostResolver> remapped_resolver( | 201 scoped_ptr<net::MappedHostResolver> remapped_resolver( |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
766 globals_->enable_spdy_ip_pooling.set(true); | 761 globals_->enable_spdy_ip_pooling.set(true); |
767 | 762 |
768 if (command_line.HasSwitch(switches::kDisableIPPooling)) | 763 if (command_line.HasSwitch(switches::kDisableIPPooling)) |
769 globals_->enable_spdy_ip_pooling.set(false); | 764 globals_->enable_spdy_ip_pooling.set(false); |
770 | 765 |
771 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { | 766 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { |
772 // Enable WebSocket over SPDY. | 767 // Enable WebSocket over SPDY. |
773 net::WebSocketJob::set_websocket_over_spdy_enabled(true); | 768 net::WebSocketJob::set_websocket_over_spdy_enabled(true); |
774 } | 769 } |
775 | 770 |
776 if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) { | |
777 globals_->max_spdy_concurrent_streams_limit.set( | |
778 GetSwitchValueAsInt(command_line, | |
779 switches::kMaxSpdyConcurrentStreams)); | |
780 } | |
781 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { | 771 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { |
782 globals_->trusted_spdy_proxy.set( | 772 globals_->trusted_spdy_proxy.set( |
783 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy)); | 773 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy)); |
784 } | 774 } |
785 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) | 775 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) |
786 net::URLFetcher::SetIgnoreCertificateRequests(true); | 776 net::URLFetcher::SetIgnoreCertificateRequests(true); |
787 | 777 |
788 if (command_line.HasSwitch(switches::kUseSpdy)) { | 778 if (command_line.HasSwitch(switches::kUseSpdy)) { |
789 std::string spdy_mode = | 779 std::string spdy_mode = |
790 command_line.GetSwitchValueASCII(switches::kUseSpdy); | 780 command_line.GetSwitchValueASCII(switches::kUseSpdy); |
791 EnableSpdy(spdy_mode); | 781 EnableSpdy(spdy_mode); |
792 } else if (command_line.HasSwitch(switches::kEnableHttp2Draft04)) { | 782 } else if (command_line.HasSwitch(switches::kEnableHttp2Draft04)) { |
793 net::HttpStreamFactory::EnableNpnHttp2Draft04(); | 783 net::HttpStreamFactory::EnableNpnHttp2Draft04(); |
794 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) { | 784 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) { |
795 net::HttpStreamFactory::EnableNpnSpdy4a2(); | 785 net::HttpStreamFactory::EnableNpnSpdy4a2(); |
796 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { | 786 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { |
797 net::HttpStreamFactory::EnableNpnSpdy3(); | 787 net::HttpStreamFactory::EnableNpnSpdy3(); |
798 } else if (command_line.HasSwitch(switches::kEnableSpdy2)) { | |
799 net::HttpStreamFactory::EnableNpnSpdy31WithSpdy2(); | |
800 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { | 788 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { |
801 net::HttpStreamFactory::EnableNpnHttpOnly(); | 789 net::HttpStreamFactory::EnableNpnHttpOnly(); |
802 } else { | 790 } else { |
803 if (spdy_trial_group == kSpdyFieldTrialDisabledGroupName && | 791 if (spdy_trial_group == kSpdyFieldTrialDisabledGroupName && |
804 !command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { | 792 !command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { |
805 net::HttpStreamFactory::set_spdy_enabled(false); | 793 net::HttpStreamFactory::set_spdy_enabled(false); |
806 } else { | 794 } else { |
807 // Use SPDY/3.1 by default. | 795 // Use SPDY/3.1 by default. |
808 net::HttpStreamFactory::EnableNpnSpdy31(); | 796 net::HttpStreamFactory::EnableNpnSpdy31(); |
809 } | 797 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 globals_->http_server_properties->GetWeakPtr(); | 965 globals_->http_server_properties->GetWeakPtr(); |
978 params->network_delegate = globals_->system_network_delegate.get(); | 966 params->network_delegate = globals_->system_network_delegate.get(); |
979 params->host_mapping_rules = globals_->host_mapping_rules.get(); | 967 params->host_mapping_rules = globals_->host_mapping_rules.get(); |
980 params->ignore_certificate_errors = globals_->ignore_certificate_errors; | 968 params->ignore_certificate_errors = globals_->ignore_certificate_errors; |
981 params->http_pipelining_enabled = globals_->http_pipelining_enabled; | 969 params->http_pipelining_enabled = globals_->http_pipelining_enabled; |
982 params->testing_fixed_http_port = globals_->testing_fixed_http_port; | 970 params->testing_fixed_http_port = globals_->testing_fixed_http_port; |
983 params->testing_fixed_https_port = globals_->testing_fixed_https_port; | 971 params->testing_fixed_https_port = globals_->testing_fixed_https_port; |
984 | 972 |
985 globals_->initial_max_spdy_concurrent_streams.CopyToIfSet( | 973 globals_->initial_max_spdy_concurrent_streams.CopyToIfSet( |
986 ¶ms->spdy_initial_max_concurrent_streams); | 974 ¶ms->spdy_initial_max_concurrent_streams); |
987 globals_->max_spdy_concurrent_streams_limit.CopyToIfSet( | |
988 ¶ms->spdy_max_concurrent_streams_limit); | |
989 globals_->force_spdy_single_domain.CopyToIfSet( | 975 globals_->force_spdy_single_domain.CopyToIfSet( |
990 ¶ms->force_spdy_single_domain); | 976 ¶ms->force_spdy_single_domain); |
991 globals_->enable_spdy_ip_pooling.CopyToIfSet( | 977 globals_->enable_spdy_ip_pooling.CopyToIfSet( |
992 ¶ms->enable_spdy_ip_pooling); | 978 ¶ms->enable_spdy_ip_pooling); |
993 globals_->enable_spdy_compression.CopyToIfSet( | 979 globals_->enable_spdy_compression.CopyToIfSet( |
994 ¶ms->enable_spdy_compression); | 980 ¶ms->enable_spdy_compression); |
995 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( | 981 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( |
996 ¶ms->enable_spdy_ping_based_connection_checking); | 982 ¶ms->enable_spdy_ping_based_connection_checking); |
997 globals_->spdy_default_protocol.CopyToIfSet( | 983 globals_->spdy_default_protocol.CopyToIfSet( |
998 ¶ms->spdy_default_protocol); | 984 ¶ms->spdy_default_protocol); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 std::string version_flag = | 1194 std::string version_flag = |
1209 command_line.GetSwitchValueASCII(switches::kQuicVersion); | 1195 command_line.GetSwitchValueASCII(switches::kQuicVersion); |
1210 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1196 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1211 net::QuicVersion version = supported_versions[i]; | 1197 net::QuicVersion version = supported_versions[i]; |
1212 if (net::QuicVersionToString(version) == version_flag) { | 1198 if (net::QuicVersionToString(version) == version_flag) { |
1213 return version; | 1199 return version; |
1214 } | 1200 } |
1215 } | 1201 } |
1216 return net::QUIC_VERSION_UNSUPPORTED; | 1202 return net::QUIC_VERSION_UNSUPPORTED; |
1217 } | 1203 } |
OLD | NEW |