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

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

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/non_thread_safe.h" 11 #include "base/non_thread_safe.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Creates a HostResolver that first uses the local cache |cache|, and then 66 // Creates a HostResolver that first uses the local cache |cache|, and then
67 // falls back to |resolver_proc|. 67 // falls back to |resolver_proc|.
68 // 68 //
69 // If |cache| is NULL, then no caching is used. Otherwise we take 69 // If |cache| is NULL, then no caching is used. Otherwise we take
70 // ownership of the |cache| pointer, and will free it during destructor. 70 // ownership of the |cache| pointer, and will free it during destructor.
71 // 71 //
72 // |resolver_proc| is used to perform the actual resolves; it must be 72 // |resolver_proc| is used to perform the actual resolves; it must be
73 // thread-safe since it is run from multiple worker threads. If 73 // thread-safe since it is run from multiple worker threads. If
74 // |resolver_proc| is NULL then the default host resolver procedure is 74 // |resolver_proc| is NULL then the default host resolver procedure is
75 // used (which is SystemHostResolverProc except if overridden). 75 // used (which is SystemHostResolverProc except if overridden).
76 // |notifier| must outlive HostResolverImpl. It can optionally be NULL, in
77 // which case HostResolverImpl will not respond to network changes.
78 // |max_jobs| specifies the maximum number of threads that the host resolver 76 // |max_jobs| specifies the maximum number of threads that the host resolver
79 // will use. Use SetPoolConstraints() to specify finer-grain settings. 77 // will use. Use SetPoolConstraints() to specify finer-grain settings.
80 HostResolverImpl(HostResolverProc* resolver_proc, 78 HostResolverImpl(HostResolverProc* resolver_proc,
81 HostCache* cache, 79 HostCache* cache,
82 NetworkChangeNotifier* notifier,
83 size_t max_jobs); 80 size_t max_jobs);
84 81
85 // HostResolver methods: 82 // HostResolver methods:
86 virtual int Resolve(const RequestInfo& info, 83 virtual int Resolve(const RequestInfo& info,
87 AddressList* addresses, 84 AddressList* addresses,
88 CompletionCallback* callback, 85 CompletionCallback* callback,
89 RequestHandle* out_req, 86 RequestHandle* out_req,
90 const BoundNetLog& net_log); 87 const BoundNetLog& net_log);
91 virtual void CancelRequest(RequestHandle req); 88 virtual void CancelRequest(RequestHandle req);
92 virtual void AddObserver(HostResolver::Observer* observer); 89 virtual void AddObserver(HostResolver::Observer* observer);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // The procedure to use for resolving host names. This will be NULL, except 237 // The procedure to use for resolving host names. This will be NULL, except
241 // in the case of unit-tests which inject custom host resolving behaviors. 238 // in the case of unit-tests which inject custom host resolving behaviors.
242 scoped_refptr<HostResolverProc> resolver_proc_; 239 scoped_refptr<HostResolverProc> resolver_proc_;
243 240
244 // Address family to use when the request doesn't specify one. 241 // Address family to use when the request doesn't specify one.
245 AddressFamily default_address_family_; 242 AddressFamily default_address_family_;
246 243
247 // TODO(eroman): hack for http://crbug.com/15513 244 // TODO(eroman): hack for http://crbug.com/15513
248 bool shutdown_; 245 bool shutdown_;
249 246
250 NetworkChangeNotifier* const network_change_notifier_;
251
252 // Indicate if probing is done after each network change event to set address 247 // Indicate if probing is done after each network change event to set address
253 // family. 248 // family.
254 // When false, explicit setting of address family is used. 249 // When false, explicit setting of address family is used.
255 bool ipv6_probe_monitoring_; 250 bool ipv6_probe_monitoring_;
256 251
257 // The last un-cancelled IPv6ProbeJob (if any). 252 // The last un-cancelled IPv6ProbeJob (if any).
258 scoped_refptr<IPv6ProbeJob> ipv6_probe_job_; 253 scoped_refptr<IPv6ProbeJob> ipv6_probe_job_;
259 254
260 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); 255 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl);
261 }; 256 };
262 257
263 } // namespace net 258 } // namespace net
264 259
265 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ 260 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698