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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 818 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
819 // is fixed. | 819 // is fixed. |
820 tracked_objects::ScopedTracker tracking_profile12_5( | 820 tracked_objects::ScopedTracker tracking_profile12_5( |
821 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 821 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
822 "466432 IOThread::InitAsync::QuicConfiguration")); | 822 "466432 IOThread::InitAsync::QuicConfiguration")); |
823 ConfigureQuic(command_line); | 823 ConfigureQuic(command_line); |
824 if (command_line.HasSwitch( | 824 if (command_line.HasSwitch( |
825 switches::kEnableUserAlternateProtocolPorts)) { | 825 switches::kEnableUserAlternateProtocolPorts)) { |
826 globals_->enable_user_alternate_protocol_ports = true; | 826 globals_->enable_user_alternate_protocol_ports = true; |
827 } | 827 } |
| 828 globals_->enable_brotli.set(ShouldEnableBrotli(command_line)); |
828 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 829 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
829 // is fixed. | 830 // is fixed. |
830 tracked_objects::ScopedTracker tracking_profile13( | 831 tracked_objects::ScopedTracker tracking_profile13( |
831 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 832 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
832 "466432 IOThread::InitAsync::InitializeNetworkOptions")); | 833 "466432 IOThread::InitAsync::InitializeNetworkOptions")); |
833 InitializeNetworkOptions(command_line); | 834 InitializeNetworkOptions(command_line); |
834 | 835 |
835 TRACE_EVENT_BEGIN0("startup", | 836 TRACE_EVENT_BEGIN0("startup", |
836 "IOThread::Init:ProxyScriptFetcherRequestContext"); | 837 "IOThread::Init:ProxyScriptFetcherRequestContext"); |
837 globals_->proxy_script_fetcher_context.reset( | 838 globals_->proxy_script_fetcher_context.reset( |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 params->next_protos = globals.next_protos; | 1091 params->next_protos = globals.next_protos; |
1091 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1092 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
1092 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1093 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
1093 globals.use_alternative_services.CopyToIfSet( | 1094 globals.use_alternative_services.CopyToIfSet( |
1094 ¶ms->use_alternative_services); | 1095 ¶ms->use_alternative_services); |
1095 globals.alternative_service_probability_threshold.CopyToIfSet( | 1096 globals.alternative_service_probability_threshold.CopyToIfSet( |
1096 ¶ms->alternative_service_probability_threshold); | 1097 ¶ms->alternative_service_probability_threshold); |
1097 | 1098 |
1098 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); | 1099 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); |
1099 | 1100 |
| 1101 globals.enable_brotli.CopyToIfSet(¶ms->enable_brotli); |
| 1102 |
1100 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1103 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
1101 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1104 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
1102 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1105 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
1103 ¶ms->quic_always_require_handshake_confirmation); | 1106 ¶ms->quic_always_require_handshake_confirmation); |
1104 globals.quic_disable_connection_pooling.CopyToIfSet( | 1107 globals.quic_disable_connection_pooling.CopyToIfSet( |
1105 ¶ms->quic_disable_connection_pooling); | 1108 ¶ms->quic_disable_connection_pooling); |
1106 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1109 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
1107 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1110 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
1108 globals.quic_enable_connection_racing.CopyToIfSet( | 1111 globals.quic_enable_connection_racing.CopyToIfSet( |
1109 ¶ms->quic_enable_connection_racing); | 1112 ¶ms->quic_enable_connection_racing); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | 1305 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { |
1303 net::HostPortPair quic_origin = | 1306 net::HostPortPair quic_origin = |
1304 net::HostPortPair::FromString( | 1307 net::HostPortPair::FromString( |
1305 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); | 1308 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); |
1306 if (!quic_origin.IsEmpty()) { | 1309 if (!quic_origin.IsEmpty()) { |
1307 globals->origin_to_force_quic_on.set(quic_origin); | 1310 globals->origin_to_force_quic_on.set(quic_origin); |
1308 } | 1311 } |
1309 } | 1312 } |
1310 } | 1313 } |
1311 | 1314 |
| 1315 bool IOThread::ShouldEnableBrotli(const base::CommandLine& command_line) { |
| 1316 if (command_line.HasSwitch(switches::kDisableBrotli)) |
| 1317 return false; |
| 1318 return command_line.HasSwitch(switches::kEnableBrotli); |
| 1319 } |
| 1320 |
1312 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, | 1321 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, |
1313 base::StringPiece quic_trial_group, | 1322 base::StringPiece quic_trial_group, |
1314 bool quic_allowed_by_policy) { | 1323 bool quic_allowed_by_policy) { |
1315 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) | 1324 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) |
1316 return false; | 1325 return false; |
1317 | 1326 |
1318 if (command_line.HasSwitch(switches::kEnableQuic)) | 1327 if (command_line.HasSwitch(switches::kEnableQuic)) |
1319 return true; | 1328 return true; |
1320 | 1329 |
1321 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | 1330 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1699 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1691 | 1700 |
1692 context->set_job_factory( | 1701 context->set_job_factory( |
1693 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1702 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1694 | 1703 |
1695 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1704 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1696 // system URLRequestContext too. There's no reason this should be tied to a | 1705 // system URLRequestContext too. There's no reason this should be tied to a |
1697 // profile. | 1706 // profile. |
1698 return context; | 1707 return context; |
1699 } | 1708 } |
OLD | NEW |