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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 globals.quic_disable_connection_pooling.CopyToIfSet( | 1204 globals.quic_disable_connection_pooling.CopyToIfSet( |
1205 ¶ms->quic_disable_connection_pooling); | 1205 ¶ms->quic_disable_connection_pooling); |
1206 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1206 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
1207 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1207 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
1208 globals.quic_enable_connection_racing.CopyToIfSet( | 1208 globals.quic_enable_connection_racing.CopyToIfSet( |
1209 ¶ms->quic_enable_connection_racing); | 1209 ¶ms->quic_enable_connection_racing); |
1210 globals.quic_enable_non_blocking_io.CopyToIfSet( | 1210 globals.quic_enable_non_blocking_io.CopyToIfSet( |
1211 ¶ms->quic_enable_non_blocking_io); | 1211 ¶ms->quic_enable_non_blocking_io); |
1212 globals.quic_disable_disk_cache.CopyToIfSet( | 1212 globals.quic_disable_disk_cache.CopyToIfSet( |
1213 ¶ms->quic_disable_disk_cache); | 1213 ¶ms->quic_disable_disk_cache); |
| 1214 globals.quic_max_number_of_lossy_connections.CopyToIfSet( |
| 1215 ¶ms->quic_max_number_of_lossy_connections); |
| 1216 globals.quic_packet_loss_threshold.CopyToIfSet( |
| 1217 ¶ms->quic_packet_loss_threshold); |
1214 globals.quic_socket_receive_buffer_size.CopyToIfSet( | 1218 globals.quic_socket_receive_buffer_size.CopyToIfSet( |
1215 ¶ms->quic_socket_receive_buffer_size); | 1219 ¶ms->quic_socket_receive_buffer_size); |
1216 globals.enable_quic_port_selection.CopyToIfSet( | 1220 globals.enable_quic_port_selection.CopyToIfSet( |
1217 ¶ms->enable_quic_port_selection); | 1221 ¶ms->enable_quic_port_selection); |
1218 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 1222 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
1219 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1223 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
1220 globals.quic_supported_versions.CopyToIfSet( | 1224 globals.quic_supported_versions.CopyToIfSet( |
1221 ¶ms->quic_supported_versions); | 1225 ¶ms->quic_supported_versions); |
1222 params->quic_connection_options = globals.quic_connection_options; | 1226 params->quic_connection_options = globals.quic_connection_options; |
1223 | 1227 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 if (load_server_info_timeout_srtt_multiplier != 0) { | 1344 if (load_server_info_timeout_srtt_multiplier != 0) { |
1341 globals->quic_load_server_info_timeout_srtt_multiplier.set( | 1345 globals->quic_load_server_info_timeout_srtt_multiplier.set( |
1342 load_server_info_timeout_srtt_multiplier); | 1346 load_server_info_timeout_srtt_multiplier); |
1343 } | 1347 } |
1344 globals->quic_enable_connection_racing.set( | 1348 globals->quic_enable_connection_racing.set( |
1345 ShouldQuicEnableConnectionRacing(quic_trial_params)); | 1349 ShouldQuicEnableConnectionRacing(quic_trial_params)); |
1346 globals->quic_enable_non_blocking_io.set( | 1350 globals->quic_enable_non_blocking_io.set( |
1347 ShouldQuicEnableNonBlockingIO(quic_trial_params)); | 1351 ShouldQuicEnableNonBlockingIO(quic_trial_params)); |
1348 globals->quic_disable_disk_cache.set( | 1352 globals->quic_disable_disk_cache.set( |
1349 ShouldQuicDisableDiskCache(quic_trial_params)); | 1353 ShouldQuicDisableDiskCache(quic_trial_params)); |
| 1354 int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections( |
| 1355 quic_trial_params); |
| 1356 if (max_number_of_lossy_connections != 0) { |
| 1357 globals->quic_max_number_of_lossy_connections.set( |
| 1358 max_number_of_lossy_connections); |
| 1359 } |
| 1360 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); |
| 1361 if (packet_loss_threshold != 0) |
| 1362 globals->quic_packet_loss_threshold.set(packet_loss_threshold); |
1350 globals->enable_quic_port_selection.set( | 1363 globals->enable_quic_port_selection.set( |
1351 ShouldEnableQuicPortSelection(command_line)); | 1364 ShouldEnableQuicPortSelection(command_line)); |
1352 globals->quic_connection_options = | 1365 globals->quic_connection_options = |
1353 GetQuicConnectionOptions(command_line, quic_trial_params); | 1366 GetQuicConnectionOptions(command_line, quic_trial_params); |
1354 if (ShouldEnableQuicPacing(command_line, quic_trial_params)) { | 1367 if (ShouldEnableQuicPacing(command_line, quic_trial_params)) { |
1355 globals->quic_connection_options.push_back(net::kPACE); | 1368 globals->quic_connection_options.push_back(net::kPACE); |
1356 } | 1369 } |
1357 } | 1370 } |
1358 | 1371 |
1359 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1372 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 } | 1553 } |
1541 | 1554 |
1542 // static | 1555 // static |
1543 bool IOThread::ShouldQuicDisableDiskCache( | 1556 bool IOThread::ShouldQuicDisableDiskCache( |
1544 const VariationParameters& quic_trial_params) { | 1557 const VariationParameters& quic_trial_params) { |
1545 return LowerCaseEqualsASCII( | 1558 return LowerCaseEqualsASCII( |
1546 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); | 1559 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); |
1547 } | 1560 } |
1548 | 1561 |
1549 // static | 1562 // static |
| 1563 int IOThread::GetQuicMaxNumberOfLossyConnections( |
| 1564 const VariationParameters& quic_trial_params) { |
| 1565 int value; |
| 1566 if (base::StringToInt(GetVariationParam(quic_trial_params, |
| 1567 "max_number_of_lossy_connections"), |
| 1568 &value)) { |
| 1569 return value; |
| 1570 } |
| 1571 return 0; |
| 1572 } |
| 1573 |
| 1574 // static |
| 1575 float IOThread::GetQuicPacketLossThreshold( |
| 1576 const VariationParameters& quic_trial_params) { |
| 1577 double value; |
| 1578 if (base::StringToDouble(GetVariationParam(quic_trial_params, |
| 1579 "packet_loss_threshold"), |
| 1580 &value)) { |
| 1581 return (float)value; |
| 1582 } |
| 1583 return 0.0f; |
| 1584 } |
| 1585 |
| 1586 // static |
1550 int IOThread::GetQuicSocketReceiveBufferSize( | 1587 int IOThread::GetQuicSocketReceiveBufferSize( |
1551 const VariationParameters& quic_trial_params) { | 1588 const VariationParameters& quic_trial_params) { |
1552 int value; | 1589 int value; |
1553 if (base::StringToInt(GetVariationParam(quic_trial_params, | 1590 if (base::StringToInt(GetVariationParam(quic_trial_params, |
1554 "receive_buffer_size"), | 1591 "receive_buffer_size"), |
1555 &value)) { | 1592 &value)) { |
1556 return value; | 1593 return value; |
1557 } | 1594 } |
1558 return 0; | 1595 return 0; |
1559 } | 1596 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1635 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1599 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1636 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1600 net::QuicVersion version = supported_versions[i]; | 1637 net::QuicVersion version = supported_versions[i]; |
1601 if (net::QuicVersionToString(version) == quic_version) { | 1638 if (net::QuicVersionToString(version) == quic_version) { |
1602 return version; | 1639 return version; |
1603 } | 1640 } |
1604 } | 1641 } |
1605 | 1642 |
1606 return net::QUIC_VERSION_UNSUPPORTED; | 1643 return net::QUIC_VERSION_UNSUPPORTED; |
1607 } | 1644 } |
OLD | NEW |