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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 base::StringPiece quic_trial_group, | 1127 base::StringPiece quic_trial_group, |
1128 const VariationParameters& quic_trial_params, | 1128 const VariationParameters& quic_trial_params, |
1129 bool quic_allowed_by_policy, | 1129 bool quic_allowed_by_policy, |
1130 IOThread::Globals* globals) { | 1130 IOThread::Globals* globals) { |
1131 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, | 1131 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, |
1132 quic_allowed_by_policy); | 1132 quic_allowed_by_policy); |
1133 globals->enable_quic.set(enable_quic); | 1133 globals->enable_quic.set(enable_quic); |
1134 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( | 1134 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( |
1135 command_line, quic_trial_group, quic_allowed_by_policy); | 1135 command_line, quic_trial_group, quic_allowed_by_policy); |
1136 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); | 1136 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); |
1137 bool enable_alternative_services = | |
1138 command_line.HasSwitch(switches::kEnableAltSvc); | |
1137 if (enable_quic) { | 1139 if (enable_quic) { |
1138 globals->enable_insecure_quic.set( | 1140 globals->enable_insecure_quic.set( |
1139 ShouldEnableInsecureQuic(command_line, quic_trial_params)); | 1141 ShouldEnableInsecureQuic(command_line, quic_trial_params)); |
1140 globals->quic_always_require_handshake_confirmation.set( | 1142 globals->quic_always_require_handshake_confirmation.set( |
1141 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); | 1143 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); |
1142 globals->quic_disable_connection_pooling.set( | 1144 globals->quic_disable_connection_pooling.set( |
1143 ShouldQuicDisableConnectionPooling(quic_trial_params)); | 1145 ShouldQuicDisableConnectionPooling(quic_trial_params)); |
1144 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); | 1146 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); |
1145 if (receive_buffer_size != 0) { | 1147 if (receive_buffer_size != 0) { |
1146 globals->quic_socket_receive_buffer_size.set(receive_buffer_size); | 1148 globals->quic_socket_receive_buffer_size.set(receive_buffer_size); |
1147 } | 1149 } |
1148 float load_server_info_timeout_srtt_multiplier = | 1150 float load_server_info_timeout_srtt_multiplier = |
1149 GetQuicLoadServerInfoTimeoutSrttMultiplier(quic_trial_params); | 1151 GetQuicLoadServerInfoTimeoutSrttMultiplier(quic_trial_params); |
1150 if (load_server_info_timeout_srtt_multiplier != 0) { | 1152 if (load_server_info_timeout_srtt_multiplier != 0) { |
1151 globals->quic_load_server_info_timeout_srtt_multiplier.set( | 1153 globals->quic_load_server_info_timeout_srtt_multiplier.set( |
1152 load_server_info_timeout_srtt_multiplier); | 1154 load_server_info_timeout_srtt_multiplier); |
1153 } | 1155 } |
1154 globals->quic_enable_connection_racing.set( | 1156 globals->quic_enable_connection_racing.set( |
1155 ShouldQuicEnableConnectionRacing(quic_trial_params)); | 1157 ShouldQuicEnableConnectionRacing(quic_trial_params)); |
1156 globals->quic_enable_non_blocking_io.set( | 1158 globals->quic_enable_non_blocking_io.set( |
1157 ShouldQuicEnableNonBlockingIO(quic_trial_params)); | 1159 ShouldQuicEnableNonBlockingIO(quic_trial_params)); |
1158 globals->quic_disable_disk_cache.set( | 1160 globals->quic_disable_disk_cache.set( |
1159 ShouldQuicDisableDiskCache(quic_trial_params)); | 1161 ShouldQuicDisableDiskCache(quic_trial_params)); |
1160 globals->quic_prefer_aes.set( | 1162 globals->quic_prefer_aes.set( |
1161 ShouldQuicPreferAes(quic_trial_params)); | 1163 ShouldQuicPreferAes(quic_trial_params)); |
1162 globals->use_alternative_services.set( | 1164 enable_alternative_services |= |
1163 ShouldQuicEnableAlternativeServices(quic_trial_params)); | 1165 ShouldQuicEnableAlternativeServices(quic_trial_params); |
Ryan Hamilton
2015/09/08 17:50:06
Typically, we put the command line flag logic into
Bence
2015/09/14 21:56:16
Done.
| |
1164 int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections( | 1166 int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections( |
1165 quic_trial_params); | 1167 quic_trial_params); |
1166 if (max_number_of_lossy_connections != 0) { | 1168 if (max_number_of_lossy_connections != 0) { |
1167 globals->quic_max_number_of_lossy_connections.set( | 1169 globals->quic_max_number_of_lossy_connections.set( |
1168 max_number_of_lossy_connections); | 1170 max_number_of_lossy_connections); |
1169 } | 1171 } |
1170 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); | 1172 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); |
1171 if (packet_loss_threshold != 0) | 1173 if (packet_loss_threshold != 0) |
1172 globals->quic_packet_loss_threshold.set(packet_loss_threshold); | 1174 globals->quic_packet_loss_threshold.set(packet_loss_threshold); |
1173 globals->enable_quic_port_selection.set( | 1175 globals->enable_quic_port_selection.set( |
1174 ShouldEnableQuicPortSelection(command_line)); | 1176 ShouldEnableQuicPortSelection(command_line)); |
1175 globals->quic_connection_options = | 1177 globals->quic_connection_options = |
1176 GetQuicConnectionOptions(command_line, quic_trial_params); | 1178 GetQuicConnectionOptions(command_line, quic_trial_params); |
1177 } | 1179 } |
1180 globals->use_alternative_services.set(enable_alternative_services); | |
1178 | 1181 |
1179 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1182 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
1180 quic_trial_params); | 1183 quic_trial_params); |
1181 if (max_packet_length != 0) { | 1184 if (max_packet_length != 0) { |
1182 globals->quic_max_packet_length.set(max_packet_length); | 1185 globals->quic_max_packet_length.set(max_packet_length); |
1183 } | 1186 } |
1184 | 1187 |
1185 std::string quic_user_agent_id = chrome::GetChannelString(); | 1188 std::string quic_user_agent_id = chrome::GetChannelString(); |
1186 if (!quic_user_agent_id.empty()) | 1189 if (!quic_user_agent_id.empty()) |
1187 quic_user_agent_id.push_back(' '); | 1190 quic_user_agent_id.push_back(' '); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1578 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1581 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1579 | 1582 |
1580 context->set_job_factory( | 1583 context->set_job_factory( |
1581 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1584 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1582 | 1585 |
1583 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1586 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1584 // system URLRequestContext too. There's no reason this should be tied to a | 1587 // system URLRequestContext too. There's no reason this should be tied to a |
1585 // profile. | 1588 // profile. |
1586 return context; | 1589 return context; |
1587 } | 1590 } |
OLD | NEW |