OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 else if (trial->group() == parallel_9) | 115 else if (trial->group() == parallel_9) |
116 parallelism = 9; | 116 parallelism = 9; |
117 else if (trial->group() == parallel_10) | 117 else if (trial->group() == parallel_10) |
118 parallelism = 10; | 118 parallelism = 10; |
119 else if (trial->group() == parallel_14) | 119 else if (trial->group() == parallel_14) |
120 parallelism = 14; | 120 parallelism = 14; |
121 else if (trial->group() == parallel_20) | 121 else if (trial->group() == parallel_20) |
122 parallelism = 20; | 122 parallelism = 20; |
123 } | 123 } |
124 | 124 |
| 125 size_t retry_attempts = net::HostResolver::kDefaultRetryAttempts; |
| 126 |
| 127 // Use the retry attempts override from the command-line, if any. |
| 128 if (command_line.HasSwitch(switches::kHostResolverRetryAttempts)) { |
| 129 std::string s = |
| 130 command_line.GetSwitchValueASCII(switches::kHostResolverRetryAttempts); |
| 131 // Parse the switch (it should be a non-negative integer). |
| 132 int n; |
| 133 if (base::StringToInt(s, &n) && n >= 0) { |
| 134 retry_attempts = static_cast<size_t>(n); |
| 135 } else { |
| 136 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; |
| 137 } |
| 138 } |
| 139 |
125 net::HostResolver* global_host_resolver = | 140 net::HostResolver* global_host_resolver = |
126 net::CreateSystemHostResolver(parallelism, net_log); | 141 net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); |
127 | 142 |
128 // Determine if we should disable IPv6 support. | 143 // Determine if we should disable IPv6 support. |
129 if (!command_line.HasSwitch(switches::kEnableIPv6)) { | 144 if (!command_line.HasSwitch(switches::kEnableIPv6)) { |
130 if (command_line.HasSwitch(switches::kDisableIPv6)) { | 145 if (command_line.HasSwitch(switches::kDisableIPv6)) { |
131 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 146 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
132 } else { | 147 } else { |
133 net::HostResolverImpl* host_resolver_impl = | 148 net::HostResolverImpl* host_resolver_impl = |
134 global_host_resolver->GetAsHostResolverImpl(); | 149 global_host_resolver->GetAsHostResolverImpl(); |
135 if (host_resolver_impl != NULL) { | 150 if (host_resolver_impl != NULL) { |
136 // Use probe to decide if support is warranted. | 151 // Use probe to decide if support is warranted. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 system_params.network_delegate = globals_->system_network_delegate.get(); | 667 system_params.network_delegate = globals_->system_network_delegate.get(); |
653 system_params.net_log = net_log_; | 668 system_params.net_log = net_log_; |
654 globals_->system_http_transaction_factory.reset( | 669 globals_->system_http_transaction_factory.reset( |
655 new net::HttpNetworkLayer( | 670 new net::HttpNetworkLayer( |
656 new net::HttpNetworkSession(system_params))); | 671 new net::HttpNetworkSession(system_params))); |
657 globals_->system_ftp_transaction_factory.reset( | 672 globals_->system_ftp_transaction_factory.reset( |
658 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 673 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
659 globals_->system_request_context = | 674 globals_->system_request_context = |
660 ConstructSystemRequestContext(globals_, net_log_); | 675 ConstructSystemRequestContext(globals_, net_log_); |
661 } | 676 } |
OLD | NEW |