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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
36 #include "content/public/common/content_client.h" | 36 #include "content/public/common/content_client.h" |
37 #include "content/public/common/url_fetcher.h" | 37 #include "content/public/common/url_fetcher.h" |
38 #include "net/base/cert_verifier.h" | 38 #include "net/base/cert_verifier.h" |
39 #include "net/base/cookie_monster.h" | 39 #include "net/base/cookie_monster.h" |
40 #include "net/base/default_origin_bound_cert_store.h" | 40 #include "net/base/default_origin_bound_cert_store.h" |
41 #include "net/base/host_cache.h" | 41 #include "net/base/host_cache.h" |
42 #include "net/base/host_resolver.h" | 42 #include "net/base/host_resolver.h" |
43 #include "net/base/host_resolver_impl.h" | |
44 #include "net/base/mapped_host_resolver.h" | 43 #include "net/base/mapped_host_resolver.h" |
45 #include "net/base/net_util.h" | 44 #include "net/base/net_util.h" |
46 #include "net/base/origin_bound_cert_service.h" | 45 #include "net/base/origin_bound_cert_service.h" |
47 #include "net/base/sdch_manager.h" | 46 #include "net/base/sdch_manager.h" |
48 #include "net/dns/async_host_resolver.h" | |
49 #include "net/ftp/ftp_network_layer.h" | 47 #include "net/ftp/ftp_network_layer.h" |
50 #include "net/http/http_auth_filter.h" | 48 #include "net/http/http_auth_filter.h" |
51 #include "net/http/http_auth_handler_factory.h" | 49 #include "net/http/http_auth_handler_factory.h" |
52 #include "net/http/http_network_layer.h" | 50 #include "net/http/http_network_layer.h" |
53 #include "net/http/http_network_session.h" | 51 #include "net/http/http_network_session.h" |
54 #include "net/http/http_server_properties_impl.h" | 52 #include "net/http/http_server_properties_impl.h" |
55 #include "net/proxy/proxy_config_service.h" | 53 #include "net/proxy/proxy_config_service.h" |
56 #include "net/proxy/proxy_script_fetcher_impl.h" | 54 #include "net/proxy/proxy_script_fetcher_impl.h" |
57 #include "net/proxy/proxy_service.h" | 55 #include "net/proxy/proxy_service.h" |
58 | 56 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Parse the switch (it should be a non-negative integer). | 127 // Parse the switch (it should be a non-negative integer). |
130 int n; | 128 int n; |
131 if (base::StringToInt(s, &n) && n >= 0) { | 129 if (base::StringToInt(s, &n) && n >= 0) { |
132 retry_attempts = static_cast<size_t>(n); | 130 retry_attempts = static_cast<size_t>(n); |
133 } else { | 131 } else { |
134 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; | 132 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; |
135 } | 133 } |
136 } | 134 } |
137 | 135 |
138 net::HostResolver* global_host_resolver = NULL; | 136 net::HostResolver* global_host_resolver = NULL; |
139 if (command_line.HasSwitch(switches::kDnsServer)) { | 137 if (command_line.HasSwitch(switches::kEnableAsyncDns)) { |
140 std::string dns_ip_string = | 138 global_host_resolver = |
141 command_line.GetSwitchValueASCII(switches::kDnsServer); | 139 net::CreateAsyncHostResolver(parallelism, retry_attempts, net_log); |
142 net::IPAddressNumber dns_ip_number; | |
143 if (net::ParseIPLiteralToNumber(dns_ip_string, &dns_ip_number)) { | |
144 global_host_resolver = | |
145 net::CreateAsyncHostResolver(parallelism, dns_ip_number, net_log); | |
146 } else { | |
147 LOG(ERROR) << "Invalid IP address specified for --dns-server: " | |
148 << dns_ip_string; | |
149 } | |
150 } | 140 } |
151 | 141 |
152 if (!global_host_resolver) { | 142 if (!global_host_resolver) { |
153 global_host_resolver = | 143 global_host_resolver = |
154 net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); | 144 net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); |
155 } | 145 } |
156 | 146 |
157 // Determine if we should disable IPv6 support. | 147 // Determine if we should disable IPv6 support. |
158 if (!command_line.HasSwitch(switches::kEnableIPv6)) { | 148 if (!command_line.HasSwitch(switches::kEnableIPv6)) { |
159 if (command_line.HasSwitch(switches::kDisableIPv6)) { | 149 if (command_line.HasSwitch(switches::kDisableIPv6)) { |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 new net::HttpNetworkLayer( | 606 new net::HttpNetworkLayer( |
617 new net::HttpNetworkSession(system_params))); | 607 new net::HttpNetworkSession(system_params))); |
618 globals_->system_ftp_transaction_factory.reset( | 608 globals_->system_ftp_transaction_factory.reset( |
619 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 609 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
620 globals_->system_request_context = | 610 globals_->system_request_context = |
621 ConstructSystemRequestContext(globals_, net_log_); | 611 ConstructSystemRequestContext(globals_, net_log_); |
622 | 612 |
623 sdch_manager_->set_sdch_fetcher( | 613 sdch_manager_->set_sdch_fetcher( |
624 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 614 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
625 } | 615 } |
OLD | NEW |