Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #include "chrome/browser/net/async_dns_field_trial.h" | 37 #include "chrome/browser/net/async_dns_field_trial.h" |
| 38 #include "chrome/browser/net/chrome_network_delegate.h" | 38 #include "chrome/browser/net/chrome_network_delegate.h" |
| 39 #include "chrome/browser/net/connect_interceptor.h" | 39 #include "chrome/browser/net/connect_interceptor.h" |
| 40 #include "chrome/browser/net/dns_probe_service.h" | 40 #include "chrome/browser/net/dns_probe_service.h" |
| 41 #include "chrome/browser/net/proxy_service_factory.h" | 41 #include "chrome/browser/net/proxy_service_factory.h" |
| 42 #include "chrome/common/channel_info.h" | 42 #include "chrome/common/channel_info.h" |
| 43 #include "chrome/common/chrome_content_client.h" | 43 #include "chrome/common/chrome_content_client.h" |
| 44 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
| 46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" | 46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" |
| 47 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | |
| 48 #include "components/data_usage/core/data_use_aggregator.h" | 47 #include "components/data_usage/core/data_use_aggregator.h" |
| 49 #include "components/data_usage/core/data_use_amortizer.h" | 48 #include "components/data_usage/core/data_use_amortizer.h" |
| 50 #include "components/data_usage/core/data_use_annotator.h" | 49 #include "components/data_usage/core/data_use_annotator.h" |
| 51 #include "components/metrics/metrics_service.h" | 50 #include "components/metrics/metrics_service.h" |
| 52 #include "components/net_log/chrome_net_log.h" | 51 #include "components/net_log/chrome_net_log.h" |
| 53 #include "components/policy/core/common/policy_service.h" | 52 #include "components/policy/core/common/policy_service.h" |
| 54 #include "components/prefs/pref_registry_simple.h" | 53 #include "components/prefs/pref_registry_simple.h" |
| 55 #include "components/prefs/pref_service.h" | 54 #include "components/prefs/pref_service.h" |
| 56 #include "components/proxy_config/pref_proxy_config_tracker.h" | 55 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 57 #include "components/variations/variations_associated_data.h" | 56 #include "components/variations/variations_associated_data.h" |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1156 | 1155 |
| 1157 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { | 1156 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { |
| 1158 return params_; | 1157 return params_; |
| 1159 } | 1158 } |
| 1160 | 1159 |
| 1161 base::TimeTicks IOThread::creation_time() const { | 1160 base::TimeTicks IOThread::creation_time() const { |
| 1162 return creation_time_; | 1161 return creation_time_; |
| 1163 } | 1162 } |
| 1164 | 1163 |
| 1165 // static | 1164 // static |
| 1166 bool IOThread::ShouldEnableQuicForDataReductionProxy() { | |
| 1167 const base::CommandLine& command_line = | |
| 1168 *base::CommandLine::ForCurrentProcess(); | |
| 1169 return NetworkSessionConfigurator::ShouldEnableQuicForDataReductionProxy( | |
| 1170 command_line); | |
| 1171 } | |
| 1172 | |
| 1173 net::SSLConfigService* IOThread::GetSSLConfigService() { | 1165 net::SSLConfigService* IOThread::GetSSLConfigService() { |
| 1174 return ssl_config_service_manager_->Get(); | 1166 return ssl_config_service_manager_->Get(); |
| 1175 } | 1167 } |
| 1176 | 1168 |
| 1177 void IOThread::ChangedToOnTheRecordOnIOThread() { | 1169 void IOThread::ChangedToOnTheRecordOnIOThread() { |
| 1178 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1170 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1179 | 1171 |
| 1180 // Clear the host cache to avoid showing entries from the OTR session | 1172 // Clear the host cache to avoid showing entries from the OTR session |
| 1181 // in about:net-internals. | 1173 // in about:net-internals. |
| 1182 ClearHostCache(); | 1174 ClearHostCache(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1226 void IOThread::NetworkSessionConfigurator::ConfigureQuicParams( | 1218 void IOThread::NetworkSessionConfigurator::ConfigureQuicParams( |
| 1227 const base::CommandLine& command_line, | 1219 const base::CommandLine& command_line, |
| 1228 base::StringPiece quic_trial_group, | 1220 base::StringPiece quic_trial_group, |
| 1229 const VariationParameters& quic_trial_params, | 1221 const VariationParameters& quic_trial_params, |
| 1230 bool is_quic_allowed_by_policy, | 1222 bool is_quic_allowed_by_policy, |
| 1231 net::HttpNetworkSession::Params* params) { | 1223 net::HttpNetworkSession::Params* params) { |
| 1232 params->enable_quic = ShouldEnableQuic(command_line, quic_trial_group, | 1224 params->enable_quic = ShouldEnableQuic(command_line, quic_trial_group, |
| 1233 is_quic_allowed_by_policy); | 1225 is_quic_allowed_by_policy); |
| 1234 params->disable_quic_on_timeout_with_open_streams = | 1226 params->disable_quic_on_timeout_with_open_streams = |
| 1235 ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams(quic_trial_params); | 1227 ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams(quic_trial_params); |
| 1236 params->enable_quic_for_proxies = ShouldEnableQuicForProxies( | |
| 1237 command_line, quic_trial_group, is_quic_allowed_by_policy); | |
| 1238 | 1228 |
| 1239 if (ShouldQuicEnableAlternativeServicesForDifferentHost(command_line, | 1229 if (ShouldQuicEnableAlternativeServicesForDifferentHost(command_line, |
| 1240 quic_trial_params)) { | 1230 quic_trial_params)) { |
| 1241 params->enable_alternative_service_with_different_host = true; | 1231 params->enable_alternative_service_with_different_host = true; |
| 1242 params->parse_alternative_services = true; | 1232 params->parse_alternative_services = true; |
| 1243 } else { | 1233 } else { |
| 1244 params->enable_alternative_service_with_different_host = false; | 1234 params->enable_alternative_service_with_different_host = false; |
| 1245 } | 1235 } |
| 1246 | 1236 |
| 1247 if (params->enable_quic) { | 1237 if (params->enable_quic) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1350 return false; | 1340 return false; |
| 1351 | 1341 |
| 1352 if (command_line.HasSwitch(switches::kEnableQuic)) | 1342 if (command_line.HasSwitch(switches::kEnableQuic)) |
| 1353 return true; | 1343 return true; |
| 1354 | 1344 |
| 1355 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | 1345 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || |
| 1356 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); | 1346 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); |
| 1357 } | 1347 } |
| 1358 | 1348 |
| 1359 // static | 1349 // static |
| 1360 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuicForProxies( | |
| 1361 const base::CommandLine& command_line, | |
| 1362 base::StringPiece quic_trial_group, | |
| 1363 bool is_quic_allowed_by_policy) { | |
| 1364 return ShouldEnableQuic(command_line, quic_trial_group, | |
| 1365 is_quic_allowed_by_policy) || | |
| 1366 ShouldEnableQuicForDataReductionProxy(command_line); | |
| 1367 } | |
| 1368 | |
|
Ryan Hamilton
2016/05/10 21:31:14
This means that the only way to enable QUIC for fl
tbansal1
2016/05/10 21:43:46
Yes, I think that's the right approach in longer t
Ryan Hamilton
2016/05/10 22:41:24
Discussed offline. LGTM.
| |
| 1369 // static | |
| 1370 bool IOThread::NetworkSessionConfigurator:: | |
| 1371 ShouldEnableQuicForDataReductionProxy( | |
| 1372 const base::CommandLine& command_line) { | |
| 1373 if (command_line.HasSwitch(switches::kDisableQuic)) | |
| 1374 return false; | |
| 1375 | |
| 1376 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); | |
| 1377 } | |
| 1378 | |
| 1379 // static | |
| 1380 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuicPortSelection( | 1350 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuicPortSelection( |
| 1381 const base::CommandLine& command_line) { | 1351 const base::CommandLine& command_line) { |
| 1382 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | 1352 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
| 1383 return false; | 1353 return false; |
| 1384 | 1354 |
| 1385 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1355 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
| 1386 return true; | 1356 return true; |
| 1387 | 1357 |
| 1388 return false; // Default to disabling port selection on all channels. | 1358 return false; // Default to disabling port selection on all channels. |
| 1389 } | 1359 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1773 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1743 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1774 // system URLRequestContext too. There's no reason this should be tied to a | 1744 // system URLRequestContext too. There's no reason this should be tied to a |
| 1775 // profile. | 1745 // profile. |
| 1776 return context; | 1746 return context; |
| 1777 } | 1747 } |
| 1778 | 1748 |
| 1779 const metrics::UpdateUsagePrefCallbackType& | 1749 const metrics::UpdateUsagePrefCallbackType& |
| 1780 IOThread::GetMetricsDataUseForwarder() { | 1750 IOThread::GetMetricsDataUseForwarder() { |
| 1781 return metrics_data_use_forwarder_; | 1751 return metrics_data_use_forwarder_; |
| 1782 } | 1752 } |
| OLD | NEW |