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

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

Issue 2447083003: Move fail on suspend logic from URLRequestJob to TcpClientSocket.
Patch Set: . Created 3 years, 6 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
« no previous file with comments | « no previous file | net/dns/host_resolver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/power_monitor/power_observer.h"
16 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
17 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/non_thread_safe.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
20 #include "net/base/net_export.h" 21 #include "net/base/net_export.h"
21 #include "net/base/network_change_notifier.h" 22 #include "net/base/network_change_notifier.h"
22 #include "net/dns/host_cache.h" 23 #include "net/dns/host_cache.h"
23 #include "net/dns/host_resolver.h" 24 #include "net/dns/host_resolver.h"
24 #include "net/dns/host_resolver_proc.h" 25 #include "net/dns/host_resolver_proc.h"
25 26
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // 58 //
58 // The HostResolverImpl enforces limits on the maximum number of concurrent 59 // The HostResolverImpl enforces limits on the maximum number of concurrent
59 // threads using PrioritizedDispatcher::Limits. 60 // threads using PrioritizedDispatcher::Limits.
60 // 61 //
61 // Jobs are ordered in the queue based on their priority and order of arrival. 62 // Jobs are ordered in the queue based on their priority and order of arrival.
62 class NET_EXPORT HostResolverImpl 63 class NET_EXPORT HostResolverImpl
63 : public HostResolver, 64 : public HostResolver,
64 NON_EXPORTED_BASE(public base::NonThreadSafe), 65 NON_EXPORTED_BASE(public base::NonThreadSafe),
65 public NetworkChangeNotifier::IPAddressObserver, 66 public NetworkChangeNotifier::IPAddressObserver,
66 public NetworkChangeNotifier::ConnectionTypeObserver, 67 public NetworkChangeNotifier::ConnectionTypeObserver,
67 public NetworkChangeNotifier::DNSObserver { 68 public NetworkChangeNotifier::DNSObserver,
69 public base::PowerObserver {
68 public: 70 public:
69 // Parameters for ProcTask which resolves hostnames using HostResolveProc. 71 // Parameters for ProcTask which resolves hostnames using HostResolveProc.
70 // 72 //
71 // |resolver_proc| is used to perform the actual resolves; it must be 73 // |resolver_proc| is used to perform the actual resolves; it must be
72 // thread-safe since it may be run from multiple worker threads. If 74 // thread-safe since it may be run from multiple worker threads. If
73 // |resolver_proc| is NULL then the default host resolver procedure is 75 // |resolver_proc| is NULL then the default host resolver procedure is
74 // used (which is SystemHostResolverProc except if overridden). 76 // used (which is SystemHostResolverProc except if overridden).
75 // 77 //
76 // For each attempt, we could start another attempt if host is not resolved 78 // For each attempt, we could start another attempt if host is not resolved
77 // within |unresponsive_delay| time. We keep attempting to resolve the host 79 // within |unresponsive_delay| time. We keep attempting to resolve the host
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void OnIPAddressChanged() override; 292 void OnIPAddressChanged() override;
291 293
292 // NetworkChangeNotifier::ConnectionTypeObserver: 294 // NetworkChangeNotifier::ConnectionTypeObserver:
293 void OnConnectionTypeChanged( 295 void OnConnectionTypeChanged(
294 NetworkChangeNotifier::ConnectionType type) override; 296 NetworkChangeNotifier::ConnectionType type) override;
295 297
296 // NetworkChangeNotifier::DNSObserver: 298 // NetworkChangeNotifier::DNSObserver:
297 void OnDNSChanged() override; 299 void OnDNSChanged() override;
298 void OnInitialDNSConfigRead() override; 300 void OnInitialDNSConfigRead() override;
299 301
302 // base::PowerObserver:
303 void OnSuspend() override;
304
300 void UpdateDNSConfig(bool config_changed); 305 void UpdateDNSConfig(bool config_changed);
301 306
302 // True if have a DnsClient with a valid DnsConfig. 307 // True if have a DnsClient with a valid DnsConfig.
303 bool HaveDnsConfig() const; 308 bool HaveDnsConfig() const;
304 309
305 // Called when a host name is successfully resolved and DnsTask was run on it 310 // Called when a host name is successfully resolved and DnsTask was run on it
306 // and resulted in |net_error|. 311 // and resulted in |net_error|.
307 void OnDnsTaskResolve(int net_error); 312 void OnDnsTaskResolve(int net_error);
308 313
309 void OnCacheEntryEvicted(const HostCache::Key& key, 314 void OnCacheEntryEvicted(const HostCache::Key& key,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // This function is only exposed so it can be unit-tested. 406 // This function is only exposed so it can be unit-tested.
402 // TODO(tfarina): It would be better to change the tests so this function 407 // TODO(tfarina): It would be better to change the tests so this function
403 // gets exercised indirectly through HostResolverImpl. 408 // gets exercised indirectly through HostResolverImpl.
404 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, 409 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host,
405 uint16_t port, 410 uint16_t port,
406 AddressList* address_list); 411 AddressList* address_list);
407 412
408 } // namespace net 413 } // namespace net
409 414
410 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ 415 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/dns/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698