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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 809 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
810 // is fixed. | 810 // is fixed. |
811 tracked_objects::ScopedTracker tracking_profile12_5( | 811 tracked_objects::ScopedTracker tracking_profile12_5( |
812 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 812 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
813 "466432 IOThread::InitAsync::QuicConfiguration")); | 813 "466432 IOThread::InitAsync::QuicConfiguration")); |
814 ConfigureQuic(command_line); | 814 ConfigureQuic(command_line); |
815 if (command_line.HasSwitch( | 815 if (command_line.HasSwitch( |
816 switches::kEnableUserAlternateProtocolPorts)) { | 816 switches::kEnableUserAlternateProtocolPorts)) { |
817 globals_->enable_user_alternate_protocol_ports = true; | 817 globals_->enable_user_alternate_protocol_ports = true; |
818 } | 818 } |
| 819 globals_->enable_brotli.set(ShouldEnableBrotli(command_line)); |
819 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 820 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
820 // is fixed. | 821 // is fixed. |
821 tracked_objects::ScopedTracker tracking_profile13( | 822 tracked_objects::ScopedTracker tracking_profile13( |
822 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 823 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
823 "466432 IOThread::InitAsync::InitializeNetworkOptions")); | 824 "466432 IOThread::InitAsync::InitializeNetworkOptions")); |
824 InitializeNetworkOptions(command_line); | 825 InitializeNetworkOptions(command_line); |
825 | 826 |
826 TRACE_EVENT_BEGIN0("startup", | 827 TRACE_EVENT_BEGIN0("startup", |
827 "IOThread::Init:ProxyScriptFetcherRequestContext"); | 828 "IOThread::Init:ProxyScriptFetcherRequestContext"); |
828 globals_->proxy_script_fetcher_context.reset( | 829 globals_->proxy_script_fetcher_context.reset( |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 params->next_protos = globals.next_protos; | 1084 params->next_protos = globals.next_protos; |
1084 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1085 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
1085 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1086 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
1086 globals.use_alternative_services.CopyToIfSet( | 1087 globals.use_alternative_services.CopyToIfSet( |
1087 ¶ms->use_alternative_services); | 1088 ¶ms->use_alternative_services); |
1088 globals.alternative_service_probability_threshold.CopyToIfSet( | 1089 globals.alternative_service_probability_threshold.CopyToIfSet( |
1089 ¶ms->alternative_service_probability_threshold); | 1090 ¶ms->alternative_service_probability_threshold); |
1090 | 1091 |
1091 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); | 1092 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); |
1092 | 1093 |
| 1094 globals.enable_brotli.CopyToIfSet(¶ms->enable_brotli); |
| 1095 |
1093 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1096 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
1094 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1097 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
1095 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1098 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
1096 ¶ms->quic_always_require_handshake_confirmation); | 1099 ¶ms->quic_always_require_handshake_confirmation); |
1097 globals.quic_disable_connection_pooling.CopyToIfSet( | 1100 globals.quic_disable_connection_pooling.CopyToIfSet( |
1098 ¶ms->quic_disable_connection_pooling); | 1101 ¶ms->quic_disable_connection_pooling); |
1099 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1102 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
1100 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1103 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
1101 globals.quic_enable_connection_racing.CopyToIfSet( | 1104 globals.quic_enable_connection_racing.CopyToIfSet( |
1102 ¶ms->quic_enable_connection_racing); | 1105 ¶ms->quic_enable_connection_racing); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | 1290 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { |
1288 net::HostPortPair quic_origin = | 1291 net::HostPortPair quic_origin = |
1289 net::HostPortPair::FromString( | 1292 net::HostPortPair::FromString( |
1290 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); | 1293 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); |
1291 if (!quic_origin.IsEmpty()) { | 1294 if (!quic_origin.IsEmpty()) { |
1292 globals->origin_to_force_quic_on.set(quic_origin); | 1295 globals->origin_to_force_quic_on.set(quic_origin); |
1293 } | 1296 } |
1294 } | 1297 } |
1295 } | 1298 } |
1296 | 1299 |
| 1300 bool IOThread::ShouldEnableBrotli(const base::CommandLine& command_line) { |
| 1301 if (command_line.HasSwitch(switches::kDisableBrotli)) |
| 1302 return false; |
| 1303 return command_line.HasSwitch(switches::kEnableBrotli); |
| 1304 } |
| 1305 |
1297 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, | 1306 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, |
1298 base::StringPiece quic_trial_group, | 1307 base::StringPiece quic_trial_group, |
1299 bool quic_allowed_by_policy) { | 1308 bool quic_allowed_by_policy) { |
1300 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) | 1309 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) |
1301 return false; | 1310 return false; |
1302 | 1311 |
1303 if (command_line.HasSwitch(switches::kEnableQuic)) | 1312 if (command_line.HasSwitch(switches::kEnableQuic)) |
1304 return true; | 1313 return true; |
1305 | 1314 |
1306 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | 1315 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1673 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1665 | 1674 |
1666 context->set_job_factory( | 1675 context->set_job_factory( |
1667 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1676 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1668 | 1677 |
1669 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1678 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1670 // system URLRequestContext too. There's no reason this should be tied to a | 1679 // system URLRequestContext too. There's no reason this should be tied to a |
1671 // profile. | 1680 // profile. |
1672 return context; | 1681 return context; |
1673 } | 1682 } |
OLD | NEW |