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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // not pre-configured with a valid DnsConfig, a new config is fetched from | 122 // not pre-configured with a valid DnsConfig, a new config is fetched from |
123 // NetworkChangeNotifier. | 123 // NetworkChangeNotifier. |
124 void SetDnsClient(scoped_ptr<DnsClient> dns_client); | 124 void SetDnsClient(scoped_ptr<DnsClient> dns_client); |
125 | 125 |
126 // HostResolver methods: | 126 // HostResolver methods: |
127 virtual int Resolve(const RequestInfo& info, | 127 virtual int Resolve(const RequestInfo& info, |
128 RequestPriority priority, | 128 RequestPriority priority, |
129 AddressList* addresses, | 129 AddressList* addresses, |
130 const CompletionCallback& callback, | 130 const CompletionCallback& callback, |
131 RequestHandle* out_req, | 131 RequestHandle* out_req, |
132 const BoundNetLog& source_net_log) OVERRIDE; | 132 const BoundNetLog& source_net_log) override; |
133 virtual int ResolveFromCache(const RequestInfo& info, | 133 virtual int ResolveFromCache(const RequestInfo& info, |
134 AddressList* addresses, | 134 AddressList* addresses, |
135 const BoundNetLog& source_net_log) OVERRIDE; | 135 const BoundNetLog& source_net_log) override; |
136 virtual void CancelRequest(RequestHandle req) OVERRIDE; | 136 virtual void CancelRequest(RequestHandle req) override; |
137 virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE; | 137 virtual void SetDefaultAddressFamily(AddressFamily address_family) override; |
138 virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; | 138 virtual AddressFamily GetDefaultAddressFamily() const override; |
139 virtual void SetDnsClientEnabled(bool enabled) OVERRIDE; | 139 virtual void SetDnsClientEnabled(bool enabled) override; |
140 virtual HostCache* GetHostCache() OVERRIDE; | 140 virtual HostCache* GetHostCache() override; |
141 virtual base::Value* GetDnsConfigAsValue() const OVERRIDE; | 141 virtual base::Value* GetDnsConfigAsValue() const override; |
142 | 142 |
143 void set_proc_params_for_test(const ProcTaskParams& proc_params) { | 143 void set_proc_params_for_test(const ProcTaskParams& proc_params) { |
144 proc_params_ = proc_params; | 144 proc_params_ = proc_params; |
145 } | 145 } |
146 | 146 |
147 private: | 147 private: |
148 friend class HostResolverImplTest; | 148 friend class HostResolverImplTest; |
149 class Job; | 149 class Job; |
150 class ProcTask; | 150 class ProcTask; |
151 class LoopbackProbeJob; | 151 class LoopbackProbeJob; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Aborts all in progress DnsTasks. In-progress jobs will fall back to | 213 // Aborts all in progress DnsTasks. In-progress jobs will fall back to |
214 // ProcTasks. Might start new jobs, if any jobs were taking up two dispatcher | 214 // ProcTasks. Might start new jobs, if any jobs were taking up two dispatcher |
215 // slots. | 215 // slots. |
216 void AbortDnsTasks(); | 216 void AbortDnsTasks(); |
217 | 217 |
218 // Attempts to serve each Job in |jobs_| from the HOSTS file if we have | 218 // Attempts to serve each Job in |jobs_| from the HOSTS file if we have |
219 // a DnsClient with a valid DnsConfig. | 219 // a DnsClient with a valid DnsConfig. |
220 void TryServingAllJobsFromHosts(); | 220 void TryServingAllJobsFromHosts(); |
221 | 221 |
222 // NetworkChangeNotifier::IPAddressObserver: | 222 // NetworkChangeNotifier::IPAddressObserver: |
223 virtual void OnIPAddressChanged() OVERRIDE; | 223 virtual void OnIPAddressChanged() override; |
224 | 224 |
225 // NetworkChangeNotifier::DNSObserver: | 225 // NetworkChangeNotifier::DNSObserver: |
226 virtual void OnDNSChanged() OVERRIDE; | 226 virtual void OnDNSChanged() override; |
227 | 227 |
228 // True if have a DnsClient with a valid DnsConfig. | 228 // True if have a DnsClient with a valid DnsConfig. |
229 bool HaveDnsConfig() const; | 229 bool HaveDnsConfig() const; |
230 | 230 |
231 // Called when a host name is successfully resolved and DnsTask was run on it | 231 // Called when a host name is successfully resolved and DnsTask was run on it |
232 // and resulted in |net_error|. | 232 // and resulted in |net_error|. |
233 void OnDnsTaskResolve(int net_error); | 233 void OnDnsTaskResolve(int net_error); |
234 | 234 |
235 // Allows the tests to catch slots leaking out of the dispatcher. One | 235 // Allows the tests to catch slots leaking out of the dispatcher. One |
236 // HostResolverImpl::Job could occupy multiple PrioritizedDispatcher job | 236 // HostResolverImpl::Job could occupy multiple PrioritizedDispatcher job |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_; | 290 base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_; |
291 | 291 |
292 base::WeakPtrFactory<HostResolverImpl> probe_weak_ptr_factory_; | 292 base::WeakPtrFactory<HostResolverImpl> probe_weak_ptr_factory_; |
293 | 293 |
294 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 294 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
295 }; | 295 }; |
296 | 296 |
297 } // namespace net | 297 } // namespace net |
298 | 298 |
299 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ | 299 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ |
OLD | NEW |