Index: chrome/browser/io_thread.cc |
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
index 7663c8a7418b60268085214e8950c1d9059049ff..b44263794d98e15d388d9a195409828b19bb3b43 100644 |
--- a/chrome/browser/io_thread.cc |
+++ b/chrome/browser/io_thread.cc |
@@ -21,6 +21,7 @@ |
#include "build/build_config.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/extensions/event_router_forwarder.h" |
+#include "chrome/browser/net/async_dns_field_trial.h" |
#include "chrome/browser/net/chrome_net_log.h" |
#include "chrome/browser/net/chrome_network_delegate.h" |
#include "chrome/browser/net/chrome_url_request_context.h" |
@@ -109,10 +110,13 @@ class SystemURLRequestContext : public URLRequestContextWithUserAgent { |
net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { |
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ bool allow_async_dns_field_trial = true; |
+ |
size_t parallelism = net::HostResolver::kDefaultParallelism; |
// Use the concurrency override from the command-line, if any. |
if (command_line.HasSwitch(switches::kHostResolverParallelism)) { |
+ allow_async_dns_field_trial = false; |
std::string s = |
command_line.GetSwitchValueASCII(switches::kHostResolverParallelism); |
@@ -129,6 +133,7 @@ net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { |
// Use the retry attempts override from the command-line, if any. |
if (command_line.HasSwitch(switches::kHostResolverRetryAttempts)) { |
+ allow_async_dns_field_trial = false; |
std::string s = |
command_line.GetSwitchValueASCII(switches::kHostResolverRetryAttempts); |
// Parse the switch (it should be a non-negative integer). |
@@ -141,14 +146,24 @@ net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { |
} |
net::HostResolver* global_host_resolver = NULL; |
+ bool use_async = false; |
if (command_line.HasSwitch(switches::kEnableAsyncDns)) { |
- global_host_resolver = |
- net::CreateAsyncHostResolver(parallelism, retry_attempts, net_log); |
+ allow_async_dns_field_trial = false; |
+ use_async = true; |
+ } else if (command_line.HasSwitch(switches::kDisableAsyncDns)) { |
+ allow_async_dns_field_trial = false; |
+ use_async = false; |
} |
- if (!global_host_resolver) { |
+ if (allow_async_dns_field_trial) |
+ use_async = chrome_browser_net::ConfigureAsyncDnsFieldTrial(); |
+ |
+ if (use_async) { |
+ global_host_resolver = |
+ net::CreateAsyncHostResolver(parallelism, retry_attempts, net_log); |
+ } else { |
global_host_resolver = |
- net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); |
+ net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); |
} |
// Determine if we should disable IPv6 support. |