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

Side by Side Diff: net/dns/host_resolver_impl.h

Issue 2811183003: Change Cronet's "disable_ipv6" to "disable_ipv6_on_wifi" (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 #ifndef NET_DNS_HOST_RESOLVER_IMPL_H_ 5 #ifndef NET_DNS_HOST_RESOLVER_IMPL_H_
6 #define NET_DNS_HOST_RESOLVER_IMPL_H_ 6 #define NET_DNS_HOST_RESOLVER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 HostCache::EntryStaleness* stale_info, 154 HostCache::EntryStaleness* stale_info,
155 const NetLogWithSource& source_net_log); 155 const NetLogWithSource& source_net_log);
156 156
157 void InitializePersistence( 157 void InitializePersistence(
158 const PersistCallback& persist_callback, 158 const PersistCallback& persist_callback,
159 std::unique_ptr<const base::Value> old_data) override; 159 std::unique_ptr<const base::Value> old_data) override;
160 160
161 void SetDefaultAddressFamily(AddressFamily address_family) override; 161 void SetDefaultAddressFamily(AddressFamily address_family) override;
162 AddressFamily GetDefaultAddressFamily() const override; 162 AddressFamily GetDefaultAddressFamily() const override;
163 163
164 void SetNoIPv6OnWifi() override;
165 bool GetNoIPv6OnWifi() override;
166
164 void set_proc_params_for_test(const ProcTaskParams& proc_params) { 167 void set_proc_params_for_test(const ProcTaskParams& proc_params) {
165 proc_params_ = proc_params; 168 proc_params_ = proc_params;
166 } 169 }
167 170
168 protected: 171 protected:
169 // Just like the public constructor, but allows the task runner used for 172 // Just like the public constructor, but allows the task runner used for
170 // blocking tasks to be specified. Intended for testing only. 173 // blocking tasks to be specified. Intended for testing only.
171 HostResolverImpl(const Options& options, 174 HostResolverImpl(const Options& options,
172 NetLog* net_log, 175 NetLog* net_log,
173 scoped_refptr<base::TaskRunner> worker_task_runner); 176 scoped_refptr<base::TaskRunner> worker_task_runner);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Returns the (hostname, address_family) key to use for |info|, choosing an 252 // Returns the (hostname, address_family) key to use for |info|, choosing an
250 // "effective" address family by inheriting the resolver's default address 253 // "effective" address family by inheriting the resolver's default address
251 // family when the request leaves it unspecified. 254 // family when the request leaves it unspecified.
252 Key GetEffectiveKeyForRequest(const RequestInfo& info, 255 Key GetEffectiveKeyForRequest(const RequestInfo& info,
253 const IPAddress* ip_address, 256 const IPAddress* ip_address,
254 const NetLogWithSource& net_log); 257 const NetLogWithSource& net_log);
255 258
256 // Probes IPv6 support and returns true if IPv6 support is enabled. 259 // Probes IPv6 support and returns true if IPv6 support is enabled.
257 // Results are cached, i.e. when called repeatedly this method returns result 260 // Results are cached, i.e. when called repeatedly this method returns result
258 // from the first probe for some time before probing again. 261 // from the first probe for some time before probing again.
259 virtual bool IsIPv6Reachable(const NetLogWithSource& net_log); 262 bool IsIPv6Reachable(const NetLogWithSource& net_log);
263
264 // Attempts to connect a UDP socket to |dest|:53. Virtual for testing.
265 virtual bool IsGloballyReachable(const IPAddress& dest,
266 const NetLogWithSource& net_log);
260 267
261 // Asynchronously checks if only loopback IPs are available. 268 // Asynchronously checks if only loopback IPs are available.
262 virtual void RunLoopbackProbeJob(); 269 virtual void RunLoopbackProbeJob();
263 270
264 // Records the result in cache if cache is present. 271 // Records the result in cache if cache is present.
265 void CacheResult(const Key& key, 272 void CacheResult(const Key& key,
266 const HostCache::Entry& entry, 273 const HostCache::Entry& entry,
267 base::TimeDelta ttl); 274 base::TimeDelta ttl);
268 275
269 // Removes |job| from |jobs_|, only if it exists, but does not delete it. 276 // Removes |job| from |jobs_|, only if it exists, but does not delete it.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // to measure performance of DnsConfigService: http://crbug.com/125599 353 // to measure performance of DnsConfigService: http://crbug.com/125599
347 bool received_dns_config_; 354 bool received_dns_config_;
348 355
349 // Number of consecutive failures of DnsTask, counted when fallback succeeds. 356 // Number of consecutive failures of DnsTask, counted when fallback succeeds.
350 unsigned num_dns_failures_; 357 unsigned num_dns_failures_;
351 358
352 // Address family to use when the request doesn't specify one. See 359 // Address family to use when the request doesn't specify one. See
353 // http://crbug.com/696569 for why the option is needed. 360 // http://crbug.com/696569 for why the option is needed.
354 AddressFamily default_address_family_; 361 AddressFamily default_address_family_;
355 362
363 // True if IPv6 should not be attempted when on a wifi connection. See
pauljensen 2017/04/12 18:16:40 nit: wifi->WiFi
mgersh 2017/04/12 18:26:42 Done.
364 // http://crbug.com/696569 for further context.
pauljensen 2017/04/12 18:16:40 nit: http->https
mgersh 2017/04/12 18:26:42 Done.
365 bool assume_ipv6_failure_on_wifi_;
366
367 // Cache current connection type for easier testing.
368 NetworkChangeNotifier::ConnectionType current_connection_type_;
pauljensen 2017/04/12 18:16:40 Can we remove this? Caches are tricky and it does
mgersh 2017/04/12 18:26:42 It's actually used for testing. If I do it this wa
pauljensen 2017/04/12 18:58:11 How about net::test::MockNetworkChangeNotifier (ht
mgersh 2017/04/13 14:57:10 Done.
369
356 // True if DnsConfigService detected that system configuration depends on 370 // True if DnsConfigService detected that system configuration depends on
357 // local IPv6 connectivity. Disables probing. 371 // local IPv6 connectivity. Disables probing.
358 bool use_local_ipv6_; 372 bool use_local_ipv6_;
359 373
360 base::TimeTicks last_ipv6_probe_time_; 374 base::TimeTicks last_ipv6_probe_time_;
361 bool last_ipv6_probe_result_; 375 bool last_ipv6_probe_result_;
362 376
363 // True iff ProcTask has successfully resolved a hostname known to have IPv6 377 // True iff ProcTask has successfully resolved a hostname known to have IPv6
364 // addresses using ADDRESS_FAMILY_UNSPECIFIED. Reset on IP address change. 378 // addresses using ADDRESS_FAMILY_UNSPECIFIED. Reset on IP address change.
365 bool resolved_known_ipv6_hostname_; 379 bool resolved_known_ipv6_hostname_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // This function is only exposed so it can be unit-tested. 411 // This function is only exposed so it can be unit-tested.
398 // TODO(tfarina): It would be better to change the tests so this function 412 // TODO(tfarina): It would be better to change the tests so this function
399 // gets exercised indirectly through HostResolverImpl. 413 // gets exercised indirectly through HostResolverImpl.
400 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, 414 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host,
401 uint16_t port, 415 uint16_t port,
402 AddressList* address_list); 416 AddressList* address_list);
403 417
404 } // namespace net 418 } // namespace net
405 419
406 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ 420 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698