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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 private: | 214 private: |
215 DISALLOW_COPY_AND_ASSIGN(SystemURLRequestContext); | 215 DISALLOW_COPY_AND_ASSIGN(SystemURLRequestContext); |
216 }; | 216 }; |
217 | 217 |
218 std::unique_ptr<net::HostResolver> CreateGlobalHostResolver( | 218 std::unique_ptr<net::HostResolver> CreateGlobalHostResolver( |
219 net::NetLog* net_log) { | 219 net::NetLog* net_log) { |
220 TRACE_EVENT0("startup", "IOThread::CreateGlobalHostResolver"); | 220 TRACE_EVENT0("startup", "IOThread::CreateGlobalHostResolver"); |
221 const base::CommandLine& command_line = | 221 const base::CommandLine& command_line = |
222 *base::CommandLine::ForCurrentProcess(); | 222 *base::CommandLine::ForCurrentProcess(); |
223 | 223 |
224 net::HostResolver::Options options; | 224 net::HostResolver::Options options; |
mmenke
2017/05/30 21:46:46
I'm leaving max_retry_attempts in options, though
| |
225 | |
226 // Use the retry attempts override from the command-line, if any. | |
227 if (command_line.HasSwitch(switches::kHostResolverRetryAttempts)) { | |
228 std::string s = | |
229 command_line.GetSwitchValueASCII(switches::kHostResolverRetryAttempts); | |
230 // Parse the switch (it should be a non-negative integer). | |
231 int n; | |
232 if (base::StringToInt(s, &n) && n >= 0) { | |
233 options.max_retry_attempts = static_cast<size_t>(n); | |
234 } else { | |
235 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s; | |
236 } | |
237 } | |
238 | |
239 std::unique_ptr<net::HostResolver> global_host_resolver; | 225 std::unique_ptr<net::HostResolver> global_host_resolver; |
240 #if defined OS_CHROMEOS | 226 #if defined OS_CHROMEOS |
241 global_host_resolver = | 227 global_host_resolver = |
242 chromeos::HostResolverImplChromeOS::CreateSystemResolver(options, | 228 chromeos::HostResolverImplChromeOS::CreateSystemResolver(options, |
243 net_log); | 229 net_log); |
244 #else | 230 #else |
245 global_host_resolver = | 231 global_host_resolver = |
246 net::HostResolver::CreateSystemResolver(options, net_log); | 232 net::HostResolver::CreateSystemResolver(options, net_log); |
247 #endif | 233 #endif |
248 | 234 |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1031 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); | 1017 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); |
1032 } | 1018 } |
1033 | 1019 |
1034 params->http_09_on_non_default_ports_enabled = | 1020 params->http_09_on_non_default_ports_enabled = |
1035 http_09_on_non_default_ports_enabled; | 1021 http_09_on_non_default_ports_enabled; |
1036 } | 1022 } |
1037 | 1023 |
1038 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { | 1024 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { |
1039 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); | 1025 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); |
1040 } | 1026 } |
OLD | NEW |