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 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 // in about:net-internals. | 1063 // in about:net-internals. |
1064 ClearHostCache(); | 1064 ClearHostCache(); |
1065 } | 1065 } |
1066 | 1066 |
1067 void IOThread::InitSystemRequestContext() { | 1067 void IOThread::InitSystemRequestContext() { |
1068 if (system_url_request_context_getter_.get()) | 1068 if (system_url_request_context_getter_.get()) |
1069 return; | 1069 return; |
1070 // If we're in unit_tests, IOThread may not be run. | 1070 // If we're in unit_tests, IOThread may not be run. |
1071 if (!BrowserThread::IsMessageLoopValid(BrowserThread::IO)) | 1071 if (!BrowserThread::IsMessageLoopValid(BrowserThread::IO)) |
1072 return; | 1072 return; |
1073 system_proxy_config_service_.reset( | 1073 system_proxy_config_service_ = ProxyServiceFactory::CreateProxyConfigService( |
1074 ProxyServiceFactory::CreateProxyConfigService( | 1074 pref_proxy_config_tracker_.get()); |
1075 pref_proxy_config_tracker_.get())); | |
1076 system_url_request_context_getter_ = | 1075 system_url_request_context_getter_ = |
1077 new SystemURLRequestContextGetter(this); | 1076 new SystemURLRequestContextGetter(this); |
1078 // Safe to post an unretained this pointer, since IOThread is | 1077 // Safe to post an unretained this pointer, since IOThread is |
1079 // guaranteed to outlive the IO BrowserThread. | 1078 // guaranteed to outlive the IO BrowserThread. |
1080 BrowserThread::PostTask( | 1079 BrowserThread::PostTask( |
1081 BrowserThread::IO, | 1080 BrowserThread::IO, |
1082 FROM_HERE, | 1081 FROM_HERE, |
1083 base::Bind(&IOThread::InitSystemRequestContextOnIOThread, | 1082 base::Bind(&IOThread::InitSystemRequestContextOnIOThread, |
1084 base::Unretained(this))); | 1083 base::Unretained(this))); |
1085 } | 1084 } |
1086 | 1085 |
1087 void IOThread::InitSystemRequestContextOnIOThread() { | 1086 void IOThread::InitSystemRequestContextOnIOThread() { |
1088 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1087 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1089 DCHECK(!globals_->system_proxy_service.get()); | 1088 DCHECK(!globals_->system_proxy_service.get()); |
1090 DCHECK(system_proxy_config_service_.get()); | 1089 DCHECK(system_proxy_config_service_.get()); |
1091 | 1090 |
1092 const base::CommandLine& command_line = | 1091 const base::CommandLine& command_line = |
1093 *base::CommandLine::ForCurrentProcess(); | 1092 *base::CommandLine::ForCurrentProcess(); |
1094 globals_->system_proxy_service = ProxyServiceFactory::CreateProxyService( | 1093 globals_->system_proxy_service = ProxyServiceFactory::CreateProxyService( |
1095 net_log_, globals_->proxy_script_fetcher_context.get(), | 1094 net_log_, globals_->proxy_script_fetcher_context.get(), |
1096 globals_->system_network_delegate.get(), | 1095 globals_->system_network_delegate.get(), |
1097 system_proxy_config_service_.release(), command_line, | 1096 system_proxy_config_service_.Pass(), command_line, |
1098 quick_check_enabled_.GetValue()); | 1097 quick_check_enabled_.GetValue()); |
1099 | 1098 |
1100 globals_->system_request_context.reset( | 1099 globals_->system_request_context.reset( |
1101 ConstructSystemRequestContext(globals_, net_log_)); | 1100 ConstructSystemRequestContext(globals_, net_log_)); |
1102 } | 1101 } |
1103 | 1102 |
1104 void IOThread::UpdateDnsClientEnabled() { | 1103 void IOThread::UpdateDnsClientEnabled() { |
1105 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 1104 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
1106 } | 1105 } |
1107 | 1106 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1585 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1587 | 1586 |
1588 context->set_job_factory( | 1587 context->set_job_factory( |
1589 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1588 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1590 | 1589 |
1591 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1590 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1592 // system URLRequestContext too. There's no reason this should be tied to a | 1591 // system URLRequestContext too. There's no reason this should be tied to a |
1593 // profile. | 1592 // profile. |
1594 return context; | 1593 return context; |
1595 } | 1594 } |
OLD | NEW |