Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5518)

Unified Diff: chrome/browser/io_thread.cc

Issue 10828373: [net] Add AsyncDns field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/net/async_dns_field_trial.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/net/async_dns_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698