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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 | 108 |
109 using content::BrowserThread; | 109 using content::BrowserThread; |
110 | 110 |
111 class SafeBrowsingURLRequestContext; | 111 class SafeBrowsingURLRequestContext; |
112 | 112 |
113 // The IOThread object must outlive any tasks posted to the IO thread before the | 113 // The IOThread object must outlive any tasks posted to the IO thread before the |
114 // Quit task, so base::Bind() calls are not refcounted. | 114 // Quit task, so base::Bind() calls are not refcounted. |
115 | 115 |
116 namespace { | 116 namespace { |
117 | 117 |
118 const char kTCPFastOpenForSSLFieldTrialName[] = "TCPFastOpenEnabledForSSL"; | |
119 | |
118 const char kQuicFieldTrialName[] = "QUIC"; | 120 const char kQuicFieldTrialName[] = "QUIC"; |
119 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; | 121 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; |
120 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; | 122 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; |
121 const char kQuicFieldTrialPacketLengthSuffix[] = "BytePackets"; | 123 const char kQuicFieldTrialPacketLengthSuffix[] = "BytePackets"; |
122 const char kQuicFieldTrialPacingSuffix[] = "WithPacing"; | 124 const char kQuicFieldTrialPacingSuffix[] = "WithPacing"; |
123 const char kQuicFieldTrialTimeBasedLossDetectionSuffix[] = | 125 const char kQuicFieldTrialTimeBasedLossDetectionSuffix[] = |
124 "WithTimeBasedLossDetection"; | 126 "WithTimeBasedLossDetection"; |
125 | 127 |
126 // The SPDY trial composes two different trial plus control groups: | 128 // The SPDY trial composes two different trial plus control groups: |
127 // * A "holdback" group with SPDY disabled, and corresponding control | 129 // * A "holdback" group with SPDY disabled, and corresponding control |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 } else { | 834 } else { |
833 // No SPDY command-line flags have been specified. Examine trial groups. | 835 // No SPDY command-line flags have been specified. Examine trial groups. |
834 ConfigureSpdyFromTrial( | 836 ConfigureSpdyFromTrial( |
835 base::FieldTrialList::FindFullName(kSpdyFieldTrialName), globals_); | 837 base::FieldTrialList::FindFullName(kSpdyFieldTrialName), globals_); |
836 } | 838 } |
837 | 839 |
838 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) | 840 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) |
839 globals_->enable_websocket_over_spdy.set(true); | 841 globals_->enable_websocket_over_spdy.set(true); |
840 } | 842 } |
841 | 843 |
844 ConfigureTCPFastOpen(command_line); | |
845 | |
842 // TODO(rch): Make the client socket factory a per-network session | 846 // TODO(rch): Make the client socket factory a per-network session |
843 // instance, constructed from a NetworkSession::Params, to allow us | 847 // instance, constructed from a NetworkSession::Params, to allow us |
844 // to move this option to IOThread::Globals & | 848 // to move this option to IOThread::Globals & |
845 // HttpNetworkSession::Params. | 849 // HttpNetworkSession::Params. |
850 } | |
846 | 851 |
852 void IOThread::ConfigureTCPFastOpen(const CommandLine& command_line) { | |
853 const std::string trial_group = | |
854 base::FieldTrialList::FindFullName(kTCPFastOpenForSSLFieldTrialName); | |
855 if (trial_group == kTCPFastOpenForSSLFieldTrialName) | |
856 globals_->enable_tcp_fast_open_for_ssl.set(true); | |
Randy Smith (Not in Mondays)
2014/09/10 18:57:06
This looks wrong to me--it looks like you're confl
Jana
2014/09/11 20:04:59
Yes, you are right -- I had conflated these things
| |
847 bool always_enable_if_supported = | 857 bool always_enable_if_supported = |
848 command_line.HasSwitch(switches::kEnableTcpFastOpen); | 858 command_line.HasSwitch(switches::kEnableTcpFastOpen); |
849 // Check for OS support of TCP FastOpen, and turn it on for all connections | 859 // Check for OS support of TCP FastOpen, and turn it on for all connections |
850 // if indicated by user. | 860 // if indicated by user. |
851 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_if_supported); | 861 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_if_supported); |
852 } | 862 } |
853 | 863 |
854 void IOThread::ConfigureSpdyFromTrial(const std::string& spdy_trial_group, | 864 void IOThread::ConfigureSpdyFromTrial(const std::string& spdy_trial_group, |
855 Globals* globals) { | 865 Globals* globals) { |
856 if (spdy_trial_group == kSpdyFieldTrialHoldbackGroupName) { | 866 if (spdy_trial_group == kSpdyFieldTrialHoldbackGroupName) { |
857 // TODO(jgraettinger): Use net::NextProtosHttpOnly() instead? | 867 // TODO(jgraettinger): Use net::NextProtosHttpOnly() instead? |
858 net::HttpStreamFactory::set_spdy_enabled(false); | 868 net::HttpStreamFactory::set_spdy_enabled(false); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1007 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); | 1017 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); |
1008 params->http_server_properties = | 1018 params->http_server_properties = |
1009 globals.http_server_properties->GetWeakPtr(); | 1019 globals.http_server_properties->GetWeakPtr(); |
1010 params->network_delegate = globals.system_network_delegate.get(); | 1020 params->network_delegate = globals.system_network_delegate.get(); |
1011 params->host_mapping_rules = globals.host_mapping_rules.get(); | 1021 params->host_mapping_rules = globals.host_mapping_rules.get(); |
1012 params->enable_ssl_connect_job_waiting = | 1022 params->enable_ssl_connect_job_waiting = |
1013 globals.enable_ssl_connect_job_waiting; | 1023 globals.enable_ssl_connect_job_waiting; |
1014 params->ignore_certificate_errors = globals.ignore_certificate_errors; | 1024 params->ignore_certificate_errors = globals.ignore_certificate_errors; |
1015 params->testing_fixed_http_port = globals.testing_fixed_http_port; | 1025 params->testing_fixed_http_port = globals.testing_fixed_http_port; |
1016 params->testing_fixed_https_port = globals.testing_fixed_https_port; | 1026 params->testing_fixed_https_port = globals.testing_fixed_https_port; |
1027 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet( | |
1028 ¶ms->enable_tcp_fast_open_for_ssl); | |
1017 | 1029 |
1018 globals.initial_max_spdy_concurrent_streams.CopyToIfSet( | 1030 globals.initial_max_spdy_concurrent_streams.CopyToIfSet( |
1019 ¶ms->spdy_initial_max_concurrent_streams); | 1031 ¶ms->spdy_initial_max_concurrent_streams); |
1020 globals.force_spdy_single_domain.CopyToIfSet( | 1032 globals.force_spdy_single_domain.CopyToIfSet( |
1021 ¶ms->force_spdy_single_domain); | 1033 ¶ms->force_spdy_single_domain); |
1022 globals.enable_spdy_compression.CopyToIfSet( | 1034 globals.enable_spdy_compression.CopyToIfSet( |
1023 ¶ms->enable_spdy_compression); | 1035 ¶ms->enable_spdy_compression); |
1024 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( | 1036 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( |
1025 ¶ms->enable_spdy_ping_based_connection_checking); | 1037 ¶ms->enable_spdy_ping_based_connection_checking); |
1026 globals.spdy_default_protocol.CopyToIfSet( | 1038 globals.spdy_default_protocol.CopyToIfSet( |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1399 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1411 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1400 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1412 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1401 net::QuicVersion version = supported_versions[i]; | 1413 net::QuicVersion version = supported_versions[i]; |
1402 if (net::QuicVersionToString(version) == quic_version) { | 1414 if (net::QuicVersionToString(version) == quic_version) { |
1403 return version; | 1415 return version; |
1404 } | 1416 } |
1405 } | 1417 } |
1406 | 1418 |
1407 return net::QUIC_VERSION_UNSUPPORTED; | 1419 return net::QUIC_VERSION_UNSUPPORTED; |
1408 } | 1420 } |
OLD | NEW |