| 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy)); | 760 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy)); |
| 761 } | 761 } |
| 762 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) | 762 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) |
| 763 net::URLFetcher::SetIgnoreCertificateRequests(true); | 763 net::URLFetcher::SetIgnoreCertificateRequests(true); |
| 764 | 764 |
| 765 if (command_line.HasSwitch(switches::kUseSpdy)) { | 765 if (command_line.HasSwitch(switches::kUseSpdy)) { |
| 766 std::string spdy_mode = | 766 std::string spdy_mode = |
| 767 command_line.GetSwitchValueASCII(switches::kUseSpdy); | 767 command_line.GetSwitchValueASCII(switches::kUseSpdy); |
| 768 EnableSpdy(spdy_mode); | 768 EnableSpdy(spdy_mode); |
| 769 } else if (command_line.HasSwitch(switches::kEnableSpdy4)) { | 769 } else if (command_line.HasSwitch(switches::kEnableSpdy4)) { |
| 770 net::HttpStreamFactory::EnableNpnSpdy4Http2(); | 770 globals_->next_protos = net::NextProtosSpdy4Http2(); |
| 771 globals_->use_alternate_protocols.set(true); |
| 771 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { | 772 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { |
| 772 net::HttpStreamFactory::EnableNpnSpdy3(); | 773 globals_->next_protos = net::NextProtosSpdy3(); |
| 774 globals_->use_alternate_protocols.set(true); |
| 773 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { | 775 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { |
| 774 net::HttpStreamFactory::EnableNpnHttpOnly(); | 776 globals_->next_protos = net::NextProtosHttpOnly(); |
| 777 globals_->use_alternate_protocols.set(false); |
| 775 } else { | 778 } else { |
| 776 if (spdy_trial_group == kSpdyFieldTrialDisabledGroupName && | 779 if (spdy_trial_group == kSpdyFieldTrialDisabledGroupName && |
| 777 !command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { | 780 !command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { |
| 778 net::HttpStreamFactory::set_spdy_enabled(false); | 781 net::HttpStreamFactory::set_spdy_enabled(false); |
| 779 } else { | 782 } else { |
| 780 // Use SPDY/3.1 by default. | 783 // Use SPDY/3.1 by default. |
| 781 net::HttpStreamFactory::EnableNpnSpdy31(); | 784 globals_->next_protos = net::NextProtosSpdy31(); |
| 785 globals_->use_alternate_protocols.set(true); |
| 782 } | 786 } |
| 783 } | 787 } |
| 784 } | 788 } |
| 785 | 789 |
| 786 // TODO(rch): Make the client socket factory a per-network session | 790 // TODO(rch): Make the client socket factory a per-network session |
| 787 // instance, constructed from a NetworkSession::Params, to allow us | 791 // instance, constructed from a NetworkSession::Params, to allow us |
| 788 // to move this option to IOThread::Globals & | 792 // to move this option to IOThread::Globals & |
| 789 // HttpNetworkSession::Params. | 793 // HttpNetworkSession::Params. |
| 790 if (command_line.HasSwitch(switches::kEnableTcpFastOpen)) | 794 if (command_line.HasSwitch(switches::kEnableTcpFastOpen)) |
| 791 net::SetTCPFastOpenEnabled(true); | 795 net::SetTCPFastOpenEnabled(true); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 814 base::SplitString(element, '=', &name_value); | 818 base::SplitString(element, '=', &name_value); |
| 815 const std::string& option = | 819 const std::string& option = |
| 816 name_value.size() > 0 ? name_value[0] : std::string(); | 820 name_value.size() > 0 ? name_value[0] : std::string(); |
| 817 const std::string value = | 821 const std::string value = |
| 818 name_value.size() > 1 ? name_value[1] : std::string(); | 822 name_value.size() > 1 ? name_value[1] : std::string(); |
| 819 | 823 |
| 820 if (option == kOff) { | 824 if (option == kOff) { |
| 821 net::HttpStreamFactory::set_spdy_enabled(false); | 825 net::HttpStreamFactory::set_spdy_enabled(false); |
| 822 } else if (option == kDisableSSL) { | 826 } else if (option == kDisableSSL) { |
| 823 globals_->spdy_default_protocol.set(net::kProtoSPDY3); | 827 globals_->spdy_default_protocol.set(net::kProtoSPDY3); |
| 824 net::HttpStreamFactory::set_force_spdy_over_ssl(false); | 828 globals_->force_spdy_over_ssl.set(false); |
| 825 net::HttpStreamFactory::set_force_spdy_always(true); | 829 globals_->force_spdy_always.set(true); |
| 826 } else if (option == kSSL) { | 830 } else if (option == kSSL) { |
| 827 globals_->spdy_default_protocol.set(net::kProtoSPDY3); | 831 globals_->spdy_default_protocol.set(net::kProtoSPDY3); |
| 828 net::HttpStreamFactory::set_force_spdy_over_ssl(true); | 832 globals_->force_spdy_over_ssl.set(true); |
| 829 net::HttpStreamFactory::set_force_spdy_always(true); | 833 globals_->force_spdy_always.set(true); |
| 830 } else if (option == kDisablePing) { | 834 } else if (option == kDisablePing) { |
| 831 globals_->enable_spdy_ping_based_connection_checking.set(false); | 835 globals_->enable_spdy_ping_based_connection_checking.set(false); |
| 832 } else if (option == kExclude) { | 836 } else if (option == kExclude) { |
| 833 net::HttpStreamFactory::add_forced_spdy_exclusion(value); | 837 globals_->forced_spdy_exclusions.insert( |
| 838 net::HostPortPair::FromURL(GURL(value))); |
| 834 } else if (option == kDisableCompression) { | 839 } else if (option == kDisableCompression) { |
| 835 globals_->enable_spdy_compression.set(false); | 840 globals_->enable_spdy_compression.set(false); |
| 836 } else if (option == kDisableAltProtocols) { | 841 } else if (option == kDisableAltProtocols) { |
| 837 net::HttpStreamFactory::set_use_alternate_protocols(false); | 842 globals_->use_alternate_protocols.set(false); |
| 838 } else if (option == kForceAltProtocols) { | 843 } else if (option == kForceAltProtocols) { |
| 839 net::PortAlternateProtocolPair pair; | 844 net::PortAlternateProtocolPair pair; |
| 840 pair.port = 443; | 845 pair.port = 443; |
| 841 pair.protocol = net::NPN_SPDY_3; | 846 pair.protocol = net::NPN_SPDY_3; |
| 842 net::HttpServerPropertiesImpl::ForceAlternateProtocol(pair); | 847 net::HttpServerPropertiesImpl::ForceAlternateProtocol(pair); |
| 843 } else if (option == kSingleDomain) { | 848 } else if (option == kSingleDomain) { |
| 844 DVLOG(1) << "FORCING SINGLE DOMAIN"; | 849 DVLOG(1) << "FORCING SINGLE DOMAIN"; |
| 845 globals_->force_spdy_single_domain.set(true); | 850 globals_->force_spdy_single_domain.set(true); |
| 846 } else if (option == kInitialMaxConcurrentStreams) { | 851 } else if (option == kInitialMaxConcurrentStreams) { |
| 847 int streams; | 852 int streams; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 globals_->initial_max_spdy_concurrent_streams.CopyToIfSet( | 942 globals_->initial_max_spdy_concurrent_streams.CopyToIfSet( |
| 938 ¶ms->spdy_initial_max_concurrent_streams); | 943 ¶ms->spdy_initial_max_concurrent_streams); |
| 939 globals_->force_spdy_single_domain.CopyToIfSet( | 944 globals_->force_spdy_single_domain.CopyToIfSet( |
| 940 ¶ms->force_spdy_single_domain); | 945 ¶ms->force_spdy_single_domain); |
| 941 globals_->enable_spdy_compression.CopyToIfSet( | 946 globals_->enable_spdy_compression.CopyToIfSet( |
| 942 ¶ms->enable_spdy_compression); | 947 ¶ms->enable_spdy_compression); |
| 943 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( | 948 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( |
| 944 ¶ms->enable_spdy_ping_based_connection_checking); | 949 ¶ms->enable_spdy_ping_based_connection_checking); |
| 945 globals_->spdy_default_protocol.CopyToIfSet( | 950 globals_->spdy_default_protocol.CopyToIfSet( |
| 946 ¶ms->spdy_default_protocol); | 951 ¶ms->spdy_default_protocol); |
| 947 globals_->trusted_spdy_proxy.CopyToIfSet( | 952 params->next_protos = globals_->next_protos; |
| 948 ¶ms->trusted_spdy_proxy); | 953 globals_->trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
| 954 globals_->force_spdy_over_ssl.CopyToIfSet(¶ms->force_spdy_over_ssl); |
| 955 globals_->force_spdy_always.CopyToIfSet(¶ms->force_spdy_always); |
| 956 globals_->forced_spdy_exclusions = params->forced_spdy_exclusions; |
| 957 globals_->use_alternate_protocols.CopyToIfSet( |
| 958 ¶ms->use_alternate_protocols); |
| 959 |
| 949 globals_->enable_quic.CopyToIfSet(¶ms->enable_quic); | 960 globals_->enable_quic.CopyToIfSet(¶ms->enable_quic); |
| 950 globals_->enable_quic_https.CopyToIfSet(¶ms->enable_quic_https); | 961 globals_->enable_quic_https.CopyToIfSet(¶ms->enable_quic_https); |
| 951 globals_->enable_quic_pacing.CopyToIfSet( | 962 globals_->enable_quic_pacing.CopyToIfSet( |
| 952 ¶ms->enable_quic_pacing); | 963 ¶ms->enable_quic_pacing); |
| 953 globals_->enable_quic_time_based_loss_detection.CopyToIfSet( | 964 globals_->enable_quic_time_based_loss_detection.CopyToIfSet( |
| 954 ¶ms->enable_quic_time_based_loss_detection); | 965 ¶ms->enable_quic_time_based_loss_detection); |
| 955 globals_->enable_quic_persist_server_info.CopyToIfSet( | 966 globals_->enable_quic_persist_server_info.CopyToIfSet( |
| 956 ¶ms->enable_quic_persist_server_info); | 967 ¶ms->enable_quic_persist_server_info); |
| 957 globals_->enable_quic_port_selection.CopyToIfSet( | 968 globals_->enable_quic_port_selection.CopyToIfSet( |
| 958 ¶ms->enable_quic_port_selection); | 969 ¶ms->enable_quic_port_selection); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 std::string version_flag = | 1220 std::string version_flag = |
| 1210 command_line.GetSwitchValueASCII(switches::kQuicVersion); | 1221 command_line.GetSwitchValueASCII(switches::kQuicVersion); |
| 1211 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1222 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1212 net::QuicVersion version = supported_versions[i]; | 1223 net::QuicVersion version = supported_versions[i]; |
| 1213 if (net::QuicVersionToString(version) == version_flag) { | 1224 if (net::QuicVersionToString(version) == version_flag) { |
| 1214 return version; | 1225 return version; |
| 1215 } | 1226 } |
| 1216 } | 1227 } |
| 1217 return net::QUIC_VERSION_UNSUPPORTED; | 1228 return net::QUIC_VERSION_UNSUPPORTED; |
| 1218 } | 1229 } |
| OLD | NEW |