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