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_BASE_HOST_RESOLVER_IMPL_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_IMPL_H_ |
6 #define NET_BASE_HOST_RESOLVER_IMPL_H_ | 6 #define NET_BASE_HOST_RESOLVER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // from one thread! | 52 // from one thread! |
53 // | 53 // |
54 // The HostResolverImpl enforces limits on the maximum number of concurrent | 54 // The HostResolverImpl enforces limits on the maximum number of concurrent |
55 // threads using PrioritizedDispatcher::Limits. | 55 // threads using PrioritizedDispatcher::Limits. |
56 // | 56 // |
57 // Jobs are ordered in the queue based on their priority and order of arrival. | 57 // Jobs are ordered in the queue based on their priority and order of arrival. |
58 class NET_EXPORT HostResolverImpl | 58 class NET_EXPORT HostResolverImpl |
59 : public HostResolver, | 59 : public HostResolver, |
60 NON_EXPORTED_BASE(public base::NonThreadSafe), | 60 NON_EXPORTED_BASE(public base::NonThreadSafe), |
61 public NetworkChangeNotifier::IPAddressObserver, | 61 public NetworkChangeNotifier::IPAddressObserver, |
62 public NetworkChangeNotifier::DNSObserver, | |
63 public base::SupportsWeakPtr<HostResolverImpl> { | 62 public base::SupportsWeakPtr<HostResolverImpl> { |
64 public: | 63 public: |
65 // Parameters for ProcTask which resolves hostnames using HostResolveProc. | 64 // Parameters for ProcTask which resolves hostnames using HostResolveProc. |
66 // | 65 // |
67 // |resolver_proc| is used to perform the actual resolves; it must be | 66 // |resolver_proc| is used to perform the actual resolves; it must be |
68 // thread-safe since it is run from multiple worker threads. If | 67 // thread-safe since it is run from multiple worker threads. If |
69 // |resolver_proc| is NULL then the default host resolver procedure is | 68 // |resolver_proc| is NULL then the default host resolver procedure is |
70 // used (which is SystemHostResolverProc except if overridden). | 69 // used (which is SystemHostResolverProc except if overridden). |
71 // | 70 // |
72 // For each attempt, we could start another attempt if host is not resolved | 71 // For each attempt, we could start another attempt if host is not resolved |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Might start new jobs. | 211 // Might start new jobs. |
213 void AbortAllInProgressJobs(); | 212 void AbortAllInProgressJobs(); |
214 | 213 |
215 // Attempts to serve each Job in |jobs_| from the HOSTS file if we have | 214 // Attempts to serve each Job in |jobs_| from the HOSTS file if we have |
216 // a DnsClient with a valid DnsConfig. | 215 // a DnsClient with a valid DnsConfig. |
217 void TryServingAllJobsFromHosts(); | 216 void TryServingAllJobsFromHosts(); |
218 | 217 |
219 // NetworkChangeNotifier::IPAddressObserver: | 218 // NetworkChangeNotifier::IPAddressObserver: |
220 virtual void OnIPAddressChanged() OVERRIDE; | 219 virtual void OnIPAddressChanged() OVERRIDE; |
221 | 220 |
222 // NetworkChangeNotifier::DNSObserver: | |
223 virtual void OnDNSChanged(unsigned detail) OVERRIDE; | |
224 | |
225 // DnsConfigService callback: | 221 // DnsConfigService callback: |
226 void OnDnsConfigChanged(const DnsConfig& dns_config); | 222 void OnDnsConfigChanged(const DnsConfig& dns_config); |
227 | 223 |
228 // True if have a DnsClient with a valid DnsConfig. | 224 // True if have a DnsClient with a valid DnsConfig. |
229 bool HaveDnsConfig() const; | 225 bool HaveDnsConfig() const; |
230 | 226 |
231 // Allows the tests to catch slots leaking out of the dispatcher. | 227 // Allows the tests to catch slots leaking out of the dispatcher. |
232 size_t num_running_jobs_for_tests() const { | 228 size_t num_running_jobs_for_tests() const { |
233 return dispatcher_.num_running_jobs(); | 229 return dispatcher_.num_running_jobs(); |
234 } | 230 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 HostResolverFlags additional_resolver_flags_; | 267 HostResolverFlags additional_resolver_flags_; |
272 | 268 |
273 NetLog* net_log_; | 269 NetLog* net_log_; |
274 | 270 |
275 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 271 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
276 }; | 272 }; |
277 | 273 |
278 } // namespace net | 274 } // namespace net |
279 | 275 |
280 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 276 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
OLD | NEW |