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

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

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 3 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
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_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
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "net/base/net_export.h" 20 #include "net/base/net_export.h"
21 #include "net/base/network_change_notifier.h" 21 #include "net/base/network_change_notifier.h"
22 #include "net/dns/host_cache.h" 22 #include "net/dns/host_cache.h"
23 #include "net/dns/host_resolver.h" 23 #include "net/dns/host_resolver.h"
24 #include "net/dns/host_resolver_proc.h" 24 #include "net/dns/host_resolver_proc.h"
25 25
26 namespace net { 26 namespace net {
27 27
28 class AddressList; 28 class AddressList;
29 class BoundNetLog; 29 class NetLogWithSource;
30 class DnsClient; 30 class DnsClient;
31 class IPAddress; 31 class IPAddress;
32 class NetLog; 32 class NetLog;
33 33
34 // For each hostname that is requested, HostResolver creates a 34 // For each hostname that is requested, HostResolver creates a
35 // HostResolverImpl::Job. When this job gets dispatched it creates a ProcTask 35 // HostResolverImpl::Job. When this job gets dispatched it creates a ProcTask
36 // which runs the given HostResolverProc on a worker thread (a WorkerPool 36 // which runs the given HostResolverProc on a worker thread (a WorkerPool
37 // thread, in production code.) If requests for that same host are made during 37 // thread, in production code.) If requests for that same host are made during
38 // the job's lifetime, they are attached to the existing job rather than 38 // the job's lifetime, they are attached to the existing job rather than
39 // creating a new one. This avoids doing parallel resolves for the same host. 39 // creating a new one. This avoids doing parallel resolves for the same host.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // not pre-configured with a valid DnsConfig, a new config is fetched from 131 // not pre-configured with a valid DnsConfig, a new config is fetched from
132 // NetworkChangeNotifier. 132 // NetworkChangeNotifier.
133 void SetDnsClient(std::unique_ptr<DnsClient> dns_client); 133 void SetDnsClient(std::unique_ptr<DnsClient> dns_client);
134 134
135 // HostResolver methods: 135 // HostResolver methods:
136 int Resolve(const RequestInfo& info, 136 int Resolve(const RequestInfo& info,
137 RequestPriority priority, 137 RequestPriority priority,
138 AddressList* addresses, 138 AddressList* addresses,
139 const CompletionCallback& callback, 139 const CompletionCallback& callback,
140 std::unique_ptr<Request>* out_req, 140 std::unique_ptr<Request>* out_req,
141 const BoundNetLog& source_net_log) override; 141 const NetLogWithSource& source_net_log) override;
142 int ResolveFromCache(const RequestInfo& info, 142 int ResolveFromCache(const RequestInfo& info,
143 AddressList* addresses, 143 AddressList* addresses,
144 const BoundNetLog& source_net_log) override; 144 const NetLogWithSource& source_net_log) override;
145 void SetDnsClientEnabled(bool enabled) override; 145 void SetDnsClientEnabled(bool enabled) override;
146 HostCache* GetHostCache() override; 146 HostCache* GetHostCache() override;
147 std::unique_ptr<base::Value> GetDnsConfigAsValue() const override; 147 std::unique_ptr<base::Value> GetDnsConfigAsValue() const override;
148 148
149 // Like |ResolveFromCache()|, but can return a stale result if the 149 // Like |ResolveFromCache()|, but can return a stale result if the
150 // implementation supports it. Fills in |*stale_info| if a response is 150 // implementation supports it. Fills in |*stale_info| if a response is
151 // returned to indicate how stale (or not) it is. 151 // returned to indicate how stale (or not) it is.
152 int ResolveStaleFromCache(const RequestInfo& info, 152 int ResolveStaleFromCache(const RequestInfo& info,
153 AddressList* addresses, 153 AddressList* addresses,
154 HostCache::EntryStaleness* stale_info, 154 HostCache::EntryStaleness* stale_info,
155 const BoundNetLog& source_net_log); 155 const NetLogWithSource& source_net_log);
156 156
157 void InitializePersistence( 157 void InitializePersistence(
158 const PersistCallback& persist_callback, 158 const PersistCallback& persist_callback,
159 std::unique_ptr<const base::Value> old_data) override; 159 std::unique_ptr<const base::Value> old_data) override;
160 160
161 void set_proc_params_for_test(const ProcTaskParams& proc_params) { 161 void set_proc_params_for_test(const ProcTaskParams& proc_params) {
162 proc_params_ = proc_params; 162 proc_params_ = proc_params;
163 } 163 }
164 164
165 protected: 165 protected:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // entry's staleness (if an entry is returned). 197 // entry's staleness (if an entry is returned).
198 // 198 //
199 // If |allow_stale| is false, then stale cache entries will not be returned, 199 // If |allow_stale| is false, then stale cache entries will not be returned,
200 // and |stale_info| must be null. 200 // and |stale_info| must be null.
201 int ResolveHelper(const Key& key, 201 int ResolveHelper(const Key& key,
202 const RequestInfo& info, 202 const RequestInfo& info,
203 const IPAddress* ip_address, 203 const IPAddress* ip_address,
204 AddressList* addresses, 204 AddressList* addresses,
205 bool allow_stale, 205 bool allow_stale,
206 HostCache::EntryStaleness* stale_info, 206 HostCache::EntryStaleness* stale_info,
207 const BoundNetLog& request_net_log); 207 const NetLogWithSource& request_net_log);
208 208
209 // Tries to resolve |key| as an IP, returns true and sets |net_error| if 209 // Tries to resolve |key| as an IP, returns true and sets |net_error| if
210 // succeeds, returns false otherwise. 210 // succeeds, returns false otherwise.
211 bool ResolveAsIP(const Key& key, 211 bool ResolveAsIP(const Key& key,
212 const RequestInfo& info, 212 const RequestInfo& info,
213 const IPAddress* ip_address, 213 const IPAddress* ip_address,
214 int* net_error, 214 int* net_error,
215 AddressList* addresses); 215 AddressList* addresses);
216 216
217 // If |key| is not found in cache returns false, otherwise returns 217 // If |key| is not found in cache returns false, otherwise returns
(...skipping 23 matching lines...) Expand all
241 // |addresses| with the loopback IP. Otherwise returns false. 241 // |addresses| with the loopback IP. Otherwise returns false.
242 bool ServeLocalhost(const Key& key, 242 bool ServeLocalhost(const Key& key,
243 const RequestInfo& info, 243 const RequestInfo& info,
244 AddressList* addresses); 244 AddressList* addresses);
245 245
246 // Returns the (hostname, address_family) key to use for |info|, choosing an 246 // Returns the (hostname, address_family) key to use for |info|, choosing an
247 // "effective" address family by inheriting the resolver's default address 247 // "effective" address family by inheriting the resolver's default address
248 // family when the request leaves it unspecified. 248 // family when the request leaves it unspecified.
249 Key GetEffectiveKeyForRequest(const RequestInfo& info, 249 Key GetEffectiveKeyForRequest(const RequestInfo& info,
250 const IPAddress* ip_address, 250 const IPAddress* ip_address,
251 const BoundNetLog& net_log); 251 const NetLogWithSource& net_log);
252 252
253 // Probes IPv6 support and returns true if IPv6 support is enabled. 253 // Probes IPv6 support and returns true if IPv6 support is enabled.
254 // Results are cached, i.e. when called repeatedly this method returns result 254 // Results are cached, i.e. when called repeatedly this method returns result
255 // from the first probe for some time before probing again. 255 // from the first probe for some time before probing again.
256 virtual bool IsIPv6Reachable(const BoundNetLog& net_log); 256 virtual bool IsIPv6Reachable(const NetLogWithSource& net_log);
257 257
258 // Asynchronously checks if only loopback IPs are available. 258 // Asynchronously checks if only loopback IPs are available.
259 virtual void RunLoopbackProbeJob(); 259 virtual void RunLoopbackProbeJob();
260 260
261 // Records the result in cache if cache is present. 261 // Records the result in cache if cache is present.
262 void CacheResult(const Key& key, 262 void CacheResult(const Key& key,
263 const HostCache::Entry& entry, 263 const HostCache::Entry& entry,
264 base::TimeDelta ttl); 264 base::TimeDelta ttl);
265 265
266 // Removes |job| from |jobs_|, only if it exists. 266 // Removes |job| from |jobs_|, only if it exists.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // This function is only exposed so it can be unit-tested. 390 // This function is only exposed so it can be unit-tested.
391 // TODO(tfarina): It would be better to change the tests so this function 391 // TODO(tfarina): It would be better to change the tests so this function
392 // gets exercised indirectly through HostResolverImpl. 392 // gets exercised indirectly through HostResolverImpl.
393 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, 393 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host,
394 uint16_t port, 394 uint16_t port,
395 AddressList* address_list); 395 AddressList* address_list);
396 396
397 } // namespace net 397 } // namespace net
398 398
399 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ 399 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698