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

Unified Diff: chrome/browser/io_thread.cc

Issue 3019007: Add a command line flag to change the default number of parallel DNS requests... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address jar's comments Created 10 years, 5 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 | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
===================================================================
--- chrome/browser/io_thread.cc (revision 52747)
+++ chrome/browser/io_thread.cc (working copy)
@@ -27,8 +27,26 @@
net::HostResolver* CreateGlobalHostResolver() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- net::HostResolver* global_host_resolver = net::CreateSystemHostResolver();
+ size_t parallelism = net::HostResolver::kDefaultParallelism;
+
+ // Use the concurrency override from the command-line, if any.
+ if (command_line.HasSwitch(switches::kHostResolverParallelism)) {
+ std::string s =
+ command_line.GetSwitchValueASCII(switches::kHostResolverParallelism);
+
+ // Parse the switch (it should be a positive integer formatted as decimal).
+ int n;
+ if (StringToInt(s, &n) && n > 0) {
+ parallelism = static_cast<size_t>(n);
+ } else {
+ LOG(ERROR) << "Invalid switch for host resolver parallelism: " << s;
+ }
+ }
+
+ net::HostResolver* global_host_resolver =
+ net::CreateSystemHostResolver(parallelism);
+
// Determine if we should disable IPv6 support.
if (!command_line.HasSwitch(switches::kEnableIPv6)) {
if (command_line.HasSwitch(switches::kDisableIPv6)) {
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698