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

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

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
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_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
52 // Thread safety: This class is not threadsafe, and must only be called 52 // Thread safety: This class is not threadsafe, and must only be called
53 // from one thread! 53 // from one thread!
54 // 54 //
55 // The HostResolverImpl enforces limits on the maximum number of concurrent 55 // The HostResolverImpl enforces limits on the maximum number of concurrent
56 // threads using PrioritizedDispatcher::Limits. 56 // threads using PrioritizedDispatcher::Limits.
57 // 57 //
58 // Jobs are ordered in the queue based on their priority and order of arrival. 58 // Jobs are ordered in the queue based on their priority and order of arrival.
59 class NET_EXPORT HostResolverImpl 59 class NET_EXPORT HostResolverImpl
60 : public HostResolver, 60 : public HostResolver,
61 NON_EXPORTED_BASE(public base::NonThreadSafe), 61 NON_EXPORTED_BASE(public base::NonThreadSafe),
62 public NetworkChangeNotifier::IPAddressObserver, 62 public NetworkChangeNotifier::NetworkChangeObserver,
63 public NetworkChangeNotifier::DNSObserver { 63 public NetworkChangeNotifier::DNSObserver {
64 public: 64 public:
65 // Parameters for ProcTask which resolves hostnames using HostResolveProc. 65 // Parameters for ProcTask which resolves hostnames using HostResolveProc.
66 // 66 //
67 // |resolver_proc| is used to perform the actual resolves; it must be 67 // |resolver_proc| is used to perform the actual resolves; it must be
68 // thread-safe since it is run from multiple worker threads. If 68 // thread-safe since it is run from multiple worker threads. If
69 // |resolver_proc| is NULL then the default host resolver procedure is 69 // |resolver_proc| is NULL then the default host resolver procedure is
70 // used (which is SystemHostResolverProc except if overridden). 70 // used (which is SystemHostResolverProc except if overridden).
71 // 71 //
72 // For each attempt, we could start another attempt if host is not resolved 72 // For each attempt, we could start another attempt if host is not resolved
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void RemoveJob(Job* job); 208 void RemoveJob(Job* job);
209 209
210 // Aborts all in progress jobs with ERR_NETWORK_CHANGED and notifies their 210 // Aborts all in progress jobs with ERR_NETWORK_CHANGED and notifies their
211 // requests. Might start new jobs. 211 // requests. Might start new jobs.
212 void AbortAllInProgressJobs(); 212 void AbortAllInProgressJobs();
213 213
214 // 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
215 // a DnsClient with a valid DnsConfig. 215 // a DnsClient with a valid DnsConfig.
216 void TryServingAllJobsFromHosts(); 216 void TryServingAllJobsFromHosts();
217 217
218 // NetworkChangeNotifier::IPAddressObserver: 218 // NetworkChangeNotifier::NetworkChangeObserver:
219 virtual void OnIPAddressChanged() OVERRIDE; 219 virtual void OnNetworkChanged(
220 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
220 221
221 // NetworkChangeNotifier::DNSObserver: 222 // NetworkChangeNotifier::DNSObserver:
222 virtual void OnDNSChanged() OVERRIDE; 223 virtual void OnDNSChanged() OVERRIDE;
223 224
224 // True if have a DnsClient with a valid DnsConfig. 225 // True if have a DnsClient with a valid DnsConfig.
225 bool HaveDnsConfig() const; 226 bool HaveDnsConfig() const;
226 227
227 // Called when a host name is successfully resolved and DnsTask was run on it 228 // Called when a host name is successfully resolved and DnsTask was run on it
228 // and resulted in |net_error|. 229 // and resulted in |net_error|.
229 void OnDnsTaskResolve(int net_error); 230 void OnDnsTaskResolve(int net_error);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 HostResolverFlags additional_resolver_flags_; 275 HostResolverFlags additional_resolver_flags_;
275 276
276 NetLog* net_log_; 277 NetLog* net_log_;
277 278
278 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); 279 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl);
279 }; 280 };
280 281
281 } // namespace net 282 } // namespace net
282 283
283 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ 284 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698