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