Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 // Parse the switch (it should be a non-negative integer). | 129 // Parse the switch (it should be a non-negative integer). |
| 130 int n; | 130 int n; |
| 131 if (base::StringToInt(s, &n) && n >= 0) { | 131 if (base::StringToInt(s, &n) && n >= 0) { |
| 132 retry_attempts = static_cast<size_t>(n); | 132 retry_attempts = static_cast<size_t>(n); |
| 133 } else { | 133 } else { |
| 134 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; | 134 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 net::HostResolver* global_host_resolver = NULL; | 138 net::HostResolver* global_host_resolver = NULL; |
| 139 if (command_line.HasSwitch(switches::kDnsServer)) { | 139 if (command_line.HasSwitch(switches::kDnsServer)) { |
|
cbentzel
2012/02/10 19:51:08
I'd be fine with getting rid of this for now.
| |
| 140 std::string dns_ip_string = | 140 std::string dns_ip_string = |
| 141 command_line.GetSwitchValueASCII(switches::kDnsServer); | 141 command_line.GetSwitchValueASCII(switches::kDnsServer); |
| 142 net::IPAddressNumber dns_ip_number; | 142 net::IPAddressNumber dns_ip_number; |
| 143 if (net::ParseIPLiteralToNumber(dns_ip_string, &dns_ip_number)) { | 143 if (net::ParseIPLiteralToNumber(dns_ip_string, &dns_ip_number)) { |
| 144 global_host_resolver = | 144 // TODO(szym): Somehow pass |dns_ip_number| to the DnsConfigService. |
| 145 net::CreateAsyncHostResolver(parallelism, dns_ip_number, net_log); | 145 LOG(WARNING) << "Configuration currently ignored --dns-server"; |
| 146 } else { | 146 } else { |
| 147 LOG(ERROR) << "Invalid IP address specified for --dns-server: " | 147 LOG(ERROR) << "Invalid IP address specified for --dns-server: " |
| 148 << dns_ip_string; | 148 << dns_ip_string; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 if (command_line.HasSwitch(switches::kEnableAsyncDns)) { | |
| 153 global_host_resolver = | |
| 154 net::CreateAsyncHostResolver(parallelism, retry_attempts, net_log); | |
| 155 } | |
| 156 | |
| 152 if (!global_host_resolver) { | 157 if (!global_host_resolver) { |
| 153 global_host_resolver = | 158 global_host_resolver = |
| 154 net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); | 159 net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); |
| 155 } | 160 } |
| 156 | 161 |
| 157 // Determine if we should disable IPv6 support. | 162 // Determine if we should disable IPv6 support. |
| 158 if (!command_line.HasSwitch(switches::kEnableIPv6)) { | 163 if (!command_line.HasSwitch(switches::kEnableIPv6)) { |
| 159 if (command_line.HasSwitch(switches::kDisableIPv6)) { | 164 if (command_line.HasSwitch(switches::kDisableIPv6)) { |
| 160 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 165 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
| 161 } else { | 166 } else { |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 system_params.network_delegate = globals_->system_network_delegate.get(); | 619 system_params.network_delegate = globals_->system_network_delegate.get(); |
| 615 system_params.net_log = net_log_; | 620 system_params.net_log = net_log_; |
| 616 globals_->system_http_transaction_factory.reset( | 621 globals_->system_http_transaction_factory.reset( |
| 617 new net::HttpNetworkLayer( | 622 new net::HttpNetworkLayer( |
| 618 new net::HttpNetworkSession(system_params))); | 623 new net::HttpNetworkSession(system_params))); |
| 619 globals_->system_ftp_transaction_factory.reset( | 624 globals_->system_ftp_transaction_factory.reset( |
| 620 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 625 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 621 globals_->system_request_context = | 626 globals_->system_request_context = |
| 622 ConstructSystemRequestContext(globals_, net_log_); | 627 ConstructSystemRequestContext(globals_, net_log_); |
| 623 } | 628 } |
| OLD | NEW |