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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 835 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
836 // is fixed. | 836 // is fixed. |
837 tracked_objects::ScopedTracker tracking_profile12_5( | 837 tracked_objects::ScopedTracker tracking_profile12_5( |
838 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 838 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
839 "466432 IOThread::InitAsync::QuicConfiguration")); | 839 "466432 IOThread::InitAsync::QuicConfiguration")); |
840 ConfigureQuic(command_line); | 840 ConfigureQuic(command_line); |
841 if (command_line.HasSwitch( | 841 if (command_line.HasSwitch( |
842 switches::kEnableUserAlternateProtocolPorts)) { | 842 switches::kEnableUserAlternateProtocolPorts)) { |
843 globals_->enable_user_alternate_protocol_ports = true; | 843 globals_->enable_user_alternate_protocol_ports = true; |
844 } | 844 } |
| 845 globals_->enable_brotli.set(ShouldEnableBrotli(command_line)); |
845 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 846 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
846 // is fixed. | 847 // is fixed. |
847 tracked_objects::ScopedTracker tracking_profile13( | 848 tracked_objects::ScopedTracker tracking_profile13( |
848 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 849 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
849 "466432 IOThread::InitAsync::InitializeNetworkOptions")); | 850 "466432 IOThread::InitAsync::InitializeNetworkOptions")); |
850 InitializeNetworkOptions(command_line); | 851 InitializeNetworkOptions(command_line); |
851 | 852 |
852 TRACE_EVENT_BEGIN0("startup", | 853 TRACE_EVENT_BEGIN0("startup", |
853 "IOThread::Init:ProxyScriptFetcherRequestContext"); | 854 "IOThread::Init:ProxyScriptFetcherRequestContext"); |
854 globals_->proxy_script_fetcher_context.reset( | 855 globals_->proxy_script_fetcher_context.reset( |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 params->next_protos = globals.next_protos; | 1131 params->next_protos = globals.next_protos; |
1131 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1132 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
1132 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1133 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
1133 globals.use_alternative_services.CopyToIfSet( | 1134 globals.use_alternative_services.CopyToIfSet( |
1134 ¶ms->use_alternative_services); | 1135 ¶ms->use_alternative_services); |
1135 globals.alternative_service_probability_threshold.CopyToIfSet( | 1136 globals.alternative_service_probability_threshold.CopyToIfSet( |
1136 ¶ms->alternative_service_probability_threshold); | 1137 ¶ms->alternative_service_probability_threshold); |
1137 | 1138 |
1138 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); | 1139 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); |
1139 | 1140 |
| 1141 globals.enable_brotli.CopyToIfSet(¶ms->enable_brotli); |
| 1142 |
1140 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1143 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
1141 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1144 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
1142 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1145 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
1143 ¶ms->quic_always_require_handshake_confirmation); | 1146 ¶ms->quic_always_require_handshake_confirmation); |
1144 globals.quic_disable_connection_pooling.CopyToIfSet( | 1147 globals.quic_disable_connection_pooling.CopyToIfSet( |
1145 ¶ms->quic_disable_connection_pooling); | 1148 ¶ms->quic_disable_connection_pooling); |
1146 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1149 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
1147 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1150 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
1148 globals.quic_enable_connection_racing.CopyToIfSet( | 1151 globals.quic_enable_connection_racing.CopyToIfSet( |
1149 ¶ms->quic_enable_connection_racing); | 1152 ¶ms->quic_enable_connection_racing); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | 1345 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { |
1343 net::HostPortPair quic_origin = | 1346 net::HostPortPair quic_origin = |
1344 net::HostPortPair::FromString( | 1347 net::HostPortPair::FromString( |
1345 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); | 1348 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); |
1346 if (!quic_origin.IsEmpty()) { | 1349 if (!quic_origin.IsEmpty()) { |
1347 globals->origin_to_force_quic_on.set(quic_origin); | 1350 globals->origin_to_force_quic_on.set(quic_origin); |
1348 } | 1351 } |
1349 } | 1352 } |
1350 } | 1353 } |
1351 | 1354 |
| 1355 bool IOThread::ShouldEnableBrotli(const base::CommandLine& command_line) { |
| 1356 if (command_line.HasSwitch(switches::kDisableBrotli)) |
| 1357 return false; |
| 1358 return command_line.HasSwitch(switches::kEnableBrotli); |
| 1359 } |
| 1360 |
1352 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, | 1361 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, |
1353 base::StringPiece quic_trial_group, | 1362 base::StringPiece quic_trial_group, |
1354 bool quic_allowed_by_policy) { | 1363 bool quic_allowed_by_policy) { |
1355 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) | 1364 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) |
1356 return false; | 1365 return false; |
1357 | 1366 |
1358 if (command_line.HasSwitch(switches::kEnableQuic)) | 1367 if (command_line.HasSwitch(switches::kEnableQuic)) |
1359 return true; | 1368 return true; |
1360 | 1369 |
1361 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | 1370 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1739 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1731 | 1740 |
1732 context->set_job_factory( | 1741 context->set_job_factory( |
1733 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1742 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1734 | 1743 |
1735 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1744 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1736 // system URLRequestContext too. There's no reason this should be tied to a | 1745 // system URLRequestContext too. There's no reason this should be tied to a |
1737 // profile. | 1746 // profile. |
1738 return context; | 1747 return context; |
1739 } | 1748 } |
OLD | NEW |