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

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

Issue 284423002: Remove HttpStreamFactory's NPN/SPDY globals, except for spdy_enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/preconnect.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 <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
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
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
937 globals_->initial_max_spdy_concurrent_streams.CopyToIfSet( 942 globals_->initial_max_spdy_concurrent_streams.CopyToIfSet(
938 &params->spdy_initial_max_concurrent_streams); 943 &params->spdy_initial_max_concurrent_streams);
939 globals_->force_spdy_single_domain.CopyToIfSet( 944 globals_->force_spdy_single_domain.CopyToIfSet(
940 &params->force_spdy_single_domain); 945 &params->force_spdy_single_domain);
941 globals_->enable_spdy_compression.CopyToIfSet( 946 globals_->enable_spdy_compression.CopyToIfSet(
942 &params->enable_spdy_compression); 947 &params->enable_spdy_compression);
943 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( 948 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet(
944 &params->enable_spdy_ping_based_connection_checking); 949 &params->enable_spdy_ping_based_connection_checking);
945 globals_->spdy_default_protocol.CopyToIfSet( 950 globals_->spdy_default_protocol.CopyToIfSet(
946 &params->spdy_default_protocol); 951 &params->spdy_default_protocol);
947 globals_->trusted_spdy_proxy.CopyToIfSet( 952 params->next_protos = globals_->next_protos;
948 &params->trusted_spdy_proxy); 953 globals_->trusted_spdy_proxy.CopyToIfSet(&params->trusted_spdy_proxy);
954 globals_->force_spdy_over_ssl.CopyToIfSet(&params->force_spdy_over_ssl);
955 globals_->force_spdy_always.CopyToIfSet(&params->force_spdy_always);
956 globals_->forced_spdy_exclusions = params->forced_spdy_exclusions;
957 globals_->use_alternate_protocols.CopyToIfSet(
958 &params->use_alternate_protocols);
959
949 globals_->enable_quic.CopyToIfSet(&params->enable_quic); 960 globals_->enable_quic.CopyToIfSet(&params->enable_quic);
950 globals_->enable_quic_https.CopyToIfSet(&params->enable_quic_https); 961 globals_->enable_quic_https.CopyToIfSet(&params->enable_quic_https);
951 globals_->enable_quic_pacing.CopyToIfSet( 962 globals_->enable_quic_pacing.CopyToIfSet(
952 &params->enable_quic_pacing); 963 &params->enable_quic_pacing);
953 globals_->enable_quic_time_based_loss_detection.CopyToIfSet( 964 globals_->enable_quic_time_based_loss_detection.CopyToIfSet(
954 &params->enable_quic_time_based_loss_detection); 965 &params->enable_quic_time_based_loss_detection);
955 globals_->enable_quic_persist_server_info.CopyToIfSet( 966 globals_->enable_quic_persist_server_info.CopyToIfSet(
956 &params->enable_quic_persist_server_info); 967 &params->enable_quic_persist_server_info);
957 globals_->enable_quic_port_selection.CopyToIfSet( 968 globals_->enable_quic_port_selection.CopyToIfSet(
958 &params->enable_quic_port_selection); 969 &params->enable_quic_port_selection);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 std::string version_flag = 1203 std::string version_flag =
1193 command_line.GetSwitchValueASCII(switches::kQuicVersion); 1204 command_line.GetSwitchValueASCII(switches::kQuicVersion);
1194 for (size_t i = 0; i < supported_versions.size(); ++i) { 1205 for (size_t i = 0; i < supported_versions.size(); ++i) {
1195 net::QuicVersion version = supported_versions[i]; 1206 net::QuicVersion version = supported_versions[i];
1196 if (net::QuicVersionToString(version) == version_flag) { 1207 if (net::QuicVersionToString(version) == version_flag) {
1197 return version; 1208 return version;
1198 } 1209 }
1199 } 1210 }
1200 return net::QUIC_VERSION_UNSUPPORTED; 1211 return net::QUIC_VERSION_UNSUPPORTED;
1201 } 1212 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/preconnect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698