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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 else if (trial->group() == parallel_9) | 135 else if (trial->group() == parallel_9) |
136 parallelism = 9; | 136 parallelism = 9; |
137 else if (trial->group() == parallel_10) | 137 else if (trial->group() == parallel_10) |
138 parallelism = 10; | 138 parallelism = 10; |
139 else if (trial->group() == parallel_14) | 139 else if (trial->group() == parallel_14) |
140 parallelism = 14; | 140 parallelism = 14; |
141 else if (trial->group() == parallel_20) | 141 else if (trial->group() == parallel_20) |
142 parallelism = 20; | 142 parallelism = 20; |
143 } | 143 } |
144 | 144 |
| 145 size_t retry_attempts = net::HostResolver::kDefaultRetryAttempts; |
| 146 |
| 147 // Use the retry attempts override from the command-line, if any. |
| 148 if (command_line.HasSwitch(switches::kHostResolverRetryAttempts)) { |
| 149 std::string s = |
| 150 command_line.GetSwitchValueASCII(switches::kHostResolverRetryAttempts); |
| 151 // Parse the switch (it should be a non-negative integer). |
| 152 int n; |
| 153 if (base::StringToInt(s, &n) && n >= 0) { |
| 154 retry_attempts = static_cast<size_t>(n); |
| 155 } else { |
| 156 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; |
| 157 } |
| 158 } |
| 159 |
145 net::HostResolver* global_host_resolver = | 160 net::HostResolver* global_host_resolver = |
146 net::CreateSystemHostResolver(parallelism, net_log); | 161 net::CreateSystemHostResolver(parallelism, retry_attempts, net_log); |
147 | 162 |
148 // Determine if we should disable IPv6 support. | 163 // Determine if we should disable IPv6 support. |
149 if (!command_line.HasSwitch(switches::kEnableIPv6)) { | 164 if (!command_line.HasSwitch(switches::kEnableIPv6)) { |
150 if (command_line.HasSwitch(switches::kDisableIPv6)) { | 165 if (command_line.HasSwitch(switches::kDisableIPv6)) { |
151 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 166 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
152 } else { | 167 } else { |
153 net::HostResolverImpl* host_resolver_impl = | 168 net::HostResolverImpl* host_resolver_impl = |
154 global_host_resolver->GetAsHostResolverImpl(); | 169 global_host_resolver->GetAsHostResolverImpl(); |
155 if (host_resolver_impl != NULL) { | 170 if (host_resolver_impl != NULL) { |
156 // Use probe to decide if support is warranted. | 171 // Use probe to decide if support is warranted. |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 system_params.network_delegate = globals_->system_network_delegate.get(); | 689 system_params.network_delegate = globals_->system_network_delegate.get(); |
675 system_params.net_log = net_log_; | 690 system_params.net_log = net_log_; |
676 globals_->system_http_transaction_factory.reset( | 691 globals_->system_http_transaction_factory.reset( |
677 new net::HttpNetworkLayer( | 692 new net::HttpNetworkLayer( |
678 new net::HttpNetworkSession(system_params))); | 693 new net::HttpNetworkSession(system_params))); |
679 globals_->system_ftp_transaction_factory.reset( | 694 globals_->system_ftp_transaction_factory.reset( |
680 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 695 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
681 globals_->system_request_context = | 696 globals_->system_request_context = |
682 ConstructSystemRequestContext(globals_, net_log_); | 697 ConstructSystemRequestContext(globals_, net_log_); |
683 } | 698 } |
OLD | NEW |