| 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 24 matching lines...) Expand all Loading... |
| 35 #include "chrome/browser/data_usage/tab_id_annotator.h" | 35 #include "chrome/browser/data_usage/tab_id_annotator.h" |
| 36 #include "chrome/browser/net/async_dns_field_trial.h" | 36 #include "chrome/browser/net/async_dns_field_trial.h" |
| 37 #include "chrome/browser/net/chrome_network_delegate.h" | 37 #include "chrome/browser/net/chrome_network_delegate.h" |
| 38 #include "chrome/browser/net/connect_interceptor.h" | 38 #include "chrome/browser/net/connect_interceptor.h" |
| 39 #include "chrome/browser/net/dns_probe_service.h" | 39 #include "chrome/browser/net/dns_probe_service.h" |
| 40 #include "chrome/browser/net/proxy_service_factory.h" | 40 #include "chrome/browser/net/proxy_service_factory.h" |
| 41 #include "chrome/common/channel_info.h" | 41 #include "chrome/common/channel_info.h" |
| 42 #include "chrome/common/chrome_content_client.h" | 42 #include "chrome/common/chrome_content_client.h" |
| 43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
| 45 #include "components/certificate_transparency/tree_state_tracker.h" |
| 45 #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" |
| 46 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 47 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 47 #include "components/data_usage/core/data_use_aggregator.h" | 48 #include "components/data_usage/core/data_use_aggregator.h" |
| 48 #include "components/data_usage/core/data_use_amortizer.h" | 49 #include "components/data_usage/core/data_use_amortizer.h" |
| 49 #include "components/data_usage/core/data_use_annotator.h" | 50 #include "components/data_usage/core/data_use_annotator.h" |
| 50 #include "components/net_log/chrome_net_log.h" | 51 #include "components/net_log/chrome_net_log.h" |
| 51 #include "components/policy/core/common/policy_service.h" | 52 #include "components/policy/core/common/policy_service.h" |
| 52 #include "components/prefs/pref_registry_simple.h" | 53 #include "components/prefs/pref_registry_simple.h" |
| 53 #include "components/prefs/pref_service.h" | 54 #include "components/prefs/pref_service.h" |
| 54 #include "components/proxy_config/pref_proxy_config_tracker.h" | 55 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); | 865 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
| 865 | 866 |
| 866 #if defined(USE_NSS_CERTS) | 867 #if defined(USE_NSS_CERTS) |
| 867 net::ShutdownNSSHttpIO(); | 868 net::ShutdownNSSHttpIO(); |
| 868 #endif | 869 #endif |
| 869 | 870 |
| 870 system_url_request_context_getter_ = NULL; | 871 system_url_request_context_getter_ = NULL; |
| 871 | 872 |
| 872 // Release objects that the net::URLRequestContext could have been pointing | 873 // Release objects that the net::URLRequestContext could have been pointing |
| 873 // to. | 874 // to. |
| 875 globals()->cert_transparency_verifier->SetObserver(nullptr); |
| 876 |
| 877 VLOG(1) << "XXX: IOThread::CleanUp"; |
| 878 globals()->sth_observers_registrar.UnregisterAll(); |
| 874 | 879 |
| 875 // Shutdown the HistogramWatcher on the IO thread. | 880 // Shutdown the HistogramWatcher on the IO thread. |
| 876 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); | 881 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); |
| 877 | 882 |
| 878 // This must be reset before the ChromeNetLog is destroyed. | 883 // This must be reset before the ChromeNetLog is destroyed. |
| 879 network_change_observer_.reset(); | 884 network_change_observer_.reset(); |
| 880 | 885 |
| 881 system_proxy_config_service_.reset(); | 886 system_proxy_config_service_.reset(); |
| 882 delete globals_; | 887 delete globals_; |
| 883 globals_ = NULL; | 888 globals_ = NULL; |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 const base::CommandLine& command_line = | 1211 const base::CommandLine& command_line = |
| 1207 *base::CommandLine::ForCurrentProcess(); | 1212 *base::CommandLine::ForCurrentProcess(); |
| 1208 globals_->system_proxy_service = ProxyServiceFactory::CreateProxyService( | 1213 globals_->system_proxy_service = ProxyServiceFactory::CreateProxyService( |
| 1209 net_log_, globals_->proxy_script_fetcher_context.get(), | 1214 net_log_, globals_->proxy_script_fetcher_context.get(), |
| 1210 globals_->system_network_delegate.get(), | 1215 globals_->system_network_delegate.get(), |
| 1211 std::move(system_proxy_config_service_), command_line, | 1216 std::move(system_proxy_config_service_), command_line, |
| 1212 quick_check_enabled_.GetValue()); | 1217 quick_check_enabled_.GetValue()); |
| 1213 | 1218 |
| 1214 globals_->system_request_context.reset( | 1219 globals_->system_request_context.reset( |
| 1215 ConstructSystemRequestContext(globals_, net_log_)); | 1220 ConstructSystemRequestContext(globals_, net_log_)); |
| 1221 |
| 1222 VLOG(1) << "Creating TreeStateTracker observer on IOThread."; |
| 1223 // TODO(eranm): Clean up the order of pointer creation and |
| 1224 // moving around. This should be a scoped_ptr until ownership |
| 1225 // is transferred to globals_->cert_transparency_observer |
| 1226 certificate_transparency::TreeStateTracker* scts_observer( |
| 1227 new certificate_transparency::TreeStateTracker(globals_->ct_logs)); |
| 1228 globals_->cert_transparency_observer.reset(scts_observer); |
| 1229 globals_->sth_observers_registrar.SignUpForRegistration( |
| 1230 globals_->cert_transparency_observer.get()); |
| 1231 VLOG(1) |
| 1232 << "XXX IOThread::InitSystemRequestContextOnIOThread, created observer."; |
| 1233 // The |cert_transparency_verifier| is the same one held by |
| 1234 // the |proxy_script_fetcher_context| and |system_request_context|, |
| 1235 // so no need to set the observer in their cert_transparency_verifiers. |
| 1236 globals_->cert_transparency_verifier->SetObserver(scts_observer); |
| 1237 VLOG(1) << "TreeStateTracker observer on IOThread created."; |
| 1216 } | 1238 } |
| 1217 | 1239 |
| 1218 void IOThread::UpdateDnsClientEnabled() { | 1240 void IOThread::UpdateDnsClientEnabled() { |
| 1219 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 1241 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 1220 } | 1242 } |
| 1221 | 1243 |
| 1222 void IOThread::ConfigurePriorityDependencies() { | 1244 void IOThread::ConfigurePriorityDependencies() { |
| 1223 std::string group = | 1245 std::string group = |
| 1224 base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial); | 1246 base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial); |
| 1225 if (group == kSpdyDependenciesFieldTrialEnable) { | 1247 if (group == kSpdyDependenciesFieldTrialEnable) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 const base::CommandLine& command_line) { | 1421 const base::CommandLine& command_line) { |
| 1400 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | 1422 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
| 1401 return false; | 1423 return false; |
| 1402 | 1424 |
| 1403 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1425 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
| 1404 return true; | 1426 return true; |
| 1405 | 1427 |
| 1406 return false; // Default to disabling port selection on all channels. | 1428 return false; // Default to disabling port selection on all channels. |
| 1407 } | 1429 } |
| 1408 | 1430 |
| 1431 void IOThread::RegisterWithSTHObserver(net::ct::STHReporter* reporter) { |
| 1432 DCHECK(globals()); |
| 1433 // Just a sanity check to make sure it was created by now. |
| 1434 DCHECK(globals()->cert_transparency_observer.get()); |
| 1435 |
| 1436 VLOG(1) << "XXX IOThread::RegisterWithSTHObserver"; |
| 1437 |
| 1438 globals()->sth_observers_registrar.AssignReporter(reporter); |
| 1439 } |
| 1440 |
| 1409 net::QuicTagVector IOThread::GetQuicConnectionOptions( | 1441 net::QuicTagVector IOThread::GetQuicConnectionOptions( |
| 1410 const base::CommandLine& command_line, | 1442 const base::CommandLine& command_line, |
| 1411 const VariationParameters& quic_trial_params) { | 1443 const VariationParameters& quic_trial_params) { |
| 1412 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { | 1444 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { |
| 1413 return net::QuicUtils::ParseQuicConnectionOptions( | 1445 return net::QuicUtils::ParseQuicConnectionOptions( |
| 1414 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); | 1446 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); |
| 1415 } | 1447 } |
| 1416 | 1448 |
| 1417 VariationParameters::const_iterator it = | 1449 VariationParameters::const_iterator it = |
| 1418 quic_trial_params.find("connection_options"); | 1450 quic_trial_params.find("connection_options"); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 std::move(job_factory); | 1790 std::move(job_factory); |
| 1759 | 1791 |
| 1760 context->set_job_factory( | 1792 context->set_job_factory( |
| 1761 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1793 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1762 | 1794 |
| 1763 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1795 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1764 // system URLRequestContext too. There's no reason this should be tied to a | 1796 // system URLRequestContext too. There's no reason this should be tied to a |
| 1765 // profile. | 1797 // profile. |
| 1766 return context; | 1798 return context; |
| 1767 } | 1799 } |
| OLD | NEW |