| 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 #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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // from one thread! | 55 // from one thread! |
| 56 // | 56 // |
| 57 // The HostResolverImpl enforces limits on the maximum number of concurrent | 57 // The HostResolverImpl enforces limits on the maximum number of concurrent |
| 58 // threads using PrioritizedDispatcher::Limits. | 58 // threads using PrioritizedDispatcher::Limits. |
| 59 // | 59 // |
| 60 // Jobs are ordered in the queue based on their priority and order of arrival. | 60 // Jobs are ordered in the queue based on their priority and order of arrival. |
| 61 class NET_EXPORT HostResolverImpl | 61 class NET_EXPORT HostResolverImpl |
| 62 : public HostResolver, | 62 : public HostResolver, |
| 63 NON_EXPORTED_BASE(public base::NonThreadSafe), | 63 NON_EXPORTED_BASE(public base::NonThreadSafe), |
| 64 public NetworkChangeNotifier::IPAddressObserver, | 64 public NetworkChangeNotifier::IPAddressObserver, |
| 65 public NetworkChangeNotifier::ConnectionTypeObserver, |
| 65 public NetworkChangeNotifier::DNSObserver { | 66 public NetworkChangeNotifier::DNSObserver { |
| 66 public: | 67 public: |
| 67 // Parameters for ProcTask which resolves hostnames using HostResolveProc. | 68 // Parameters for ProcTask which resolves hostnames using HostResolveProc. |
| 68 // | 69 // |
| 69 // |resolver_proc| is used to perform the actual resolves; it must be | 70 // |resolver_proc| is used to perform the actual resolves; it must be |
| 70 // thread-safe since it is run from multiple worker threads. If | 71 // thread-safe since it is run from multiple worker threads. If |
| 71 // |resolver_proc| is NULL then the default host resolver procedure is | 72 // |resolver_proc| is NULL then the default host resolver procedure is |
| 72 // used (which is SystemHostResolverProc except if overridden). | 73 // used (which is SystemHostResolverProc except if overridden). |
| 73 // | 74 // |
| 74 // For each attempt, we could start another attempt if host is not resolved | 75 // For each attempt, we could start another attempt if host is not resolved |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // slots. | 234 // slots. |
| 234 void AbortDnsTasks(); | 235 void AbortDnsTasks(); |
| 235 | 236 |
| 236 // Attempts to serve each Job in |jobs_| from the HOSTS file if we have | 237 // Attempts to serve each Job in |jobs_| from the HOSTS file if we have |
| 237 // a DnsClient with a valid DnsConfig. | 238 // a DnsClient with a valid DnsConfig. |
| 238 void TryServingAllJobsFromHosts(); | 239 void TryServingAllJobsFromHosts(); |
| 239 | 240 |
| 240 // NetworkChangeNotifier::IPAddressObserver: | 241 // NetworkChangeNotifier::IPAddressObserver: |
| 241 void OnIPAddressChanged() override; | 242 void OnIPAddressChanged() override; |
| 242 | 243 |
| 244 // NetworkChangeNotifier::ConnectionTypeObserver: |
| 245 void OnConnectionTypeChanged( |
| 246 NetworkChangeNotifier::ConnectionType type) override; |
| 247 |
| 243 // NetworkChangeNotifier::DNSObserver: | 248 // NetworkChangeNotifier::DNSObserver: |
| 244 void OnDNSChanged() override; | 249 void OnDNSChanged() override; |
| 245 void OnInitialDNSConfigRead() override; | 250 void OnInitialDNSConfigRead() override; |
| 246 | 251 |
| 247 void UpdateDNSConfig(bool config_changed); | 252 void UpdateDNSConfig(bool config_changed); |
| 248 | 253 |
| 249 // True if have a DnsClient with a valid DnsConfig. | 254 // True if have a DnsClient with a valid DnsConfig. |
| 250 bool HaveDnsConfig() const; | 255 bool HaveDnsConfig() const; |
| 251 | 256 |
| 252 // Called when a host name is successfully resolved and DnsTask was run on it | 257 // Called when a host name is successfully resolved and DnsTask was run on it |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // This function is only exposed so it can be unit-tested. | 324 // This function is only exposed so it can be unit-tested. |
| 320 // TODO(tfarina): It would be better to change the tests so this function | 325 // TODO(tfarina): It would be better to change the tests so this function |
| 321 // gets exercised indirectly through HostResolverImpl. | 326 // gets exercised indirectly through HostResolverImpl. |
| 322 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, | 327 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, |
| 323 uint16_t port, | 328 uint16_t port, |
| 324 AddressList* address_list); | 329 AddressList* address_list); |
| 325 | 330 |
| 326 } // namespace net | 331 } // namespace net |
| 327 | 332 |
| 328 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ | 333 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ |
| OLD | NEW |