OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 }; | 173 }; |
174 | 174 |
175 scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) { | 175 scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) { |
176 TRACE_EVENT0("startup", "IOThread::CreateGlobalHostResolver"); | 176 TRACE_EVENT0("startup", "IOThread::CreateGlobalHostResolver"); |
177 const base::CommandLine& command_line = | 177 const base::CommandLine& command_line = |
178 *base::CommandLine::ForCurrentProcess(); | 178 *base::CommandLine::ForCurrentProcess(); |
179 | 179 |
180 net::HostResolver::Options options; | 180 net::HostResolver::Options options; |
181 | 181 |
182 // Use the concurrency override from the command-line, if any. | |
183 if (command_line.HasSwitch(switches::kHostResolverParallelism)) { | |
184 std::string s = | |
185 command_line.GetSwitchValueASCII(switches::kHostResolverParallelism); | |
186 | |
187 // Parse the switch (it should be a positive integer formatted as decimal). | |
188 int n; | |
189 if (base::StringToInt(s, &n) && n > 0) { | |
190 options.max_concurrent_resolves = static_cast<size_t>(n); | |
191 } else { | |
192 LOG(ERROR) << "Invalid switch for host resolver parallelism: " << s; | |
193 } | |
194 } | |
195 | |
196 // Use the retry attempts override from the command-line, if any. | 182 // Use the retry attempts override from the command-line, if any. |
197 if (command_line.HasSwitch(switches::kHostResolverRetryAttempts)) { | 183 if (command_line.HasSwitch(switches::kHostResolverRetryAttempts)) { |
198 std::string s = | 184 std::string s = |
199 command_line.GetSwitchValueASCII(switches::kHostResolverRetryAttempts); | 185 command_line.GetSwitchValueASCII(switches::kHostResolverRetryAttempts); |
200 // Parse the switch (it should be a non-negative integer). | 186 // Parse the switch (it should be a non-negative integer). |
201 int n; | 187 int n; |
202 if (base::StringToInt(s, &n) && n >= 0) { | 188 if (base::StringToInt(s, &n) && n >= 0) { |
203 options.max_retry_attempts = static_cast<size_t>(n); | 189 options.max_retry_attempts = static_cast<size_t>(n); |
204 } else { | 190 } else { |
205 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; | 191 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1447 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1462 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1448 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1463 net::QuicVersion version = supported_versions[i]; | 1449 net::QuicVersion version = supported_versions[i]; |
1464 if (net::QuicVersionToString(version) == quic_version) { | 1450 if (net::QuicVersionToString(version) == quic_version) { |
1465 return version; | 1451 return version; |
1466 } | 1452 } |
1467 } | 1453 } |
1468 | 1454 |
1469 return net::QUIC_VERSION_UNSUPPORTED; | 1455 return net::QUIC_VERSION_UNSUPPORTED; |
1470 } | 1456 } |
OLD | NEW |