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

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

Issue 1898873006: Cronet: Use stale DNS cache entries experimentally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dns_stale2
Patch Set: Add integration test, rebase, format, &c. Created 4 years, 5 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_H_ 5 #ifndef NET_DNS_HOST_RESOLVER_H_
6 #define NET_DNS_HOST_RESOLVER_H_ 6 #define NET_DNS_HOST_RESOLVER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "net/dns/host_cache.h" 21 #include "net/dns/host_cache.h"
22 22
23 namespace base { 23 namespace base {
24 class Value; 24 class Value;
25 } 25 }
26 26
27 namespace net { 27 namespace net {
28 28
29 class AddressList; 29 class AddressList;
30 class BoundNetLog; 30 class BoundNetLog;
31 class HostResolverImpl;
31 class HostResolverProc; 32 class HostResolverProc;
32 class NetLog; 33 class NetLog;
33 34
34 // This class represents the task of resolving hostnames (or IP address 35 // This class represents the task of resolving hostnames (or IP address
35 // literal) to an AddressList object. 36 // literal) to an AddressList object.
36 // 37 //
37 // HostResolver can handle multiple requests at a time, so when cancelling a 38 // HostResolver can handle multiple requests at a time, so when cancelling a
38 // request the RequestHandle that was returned by Resolve() needs to be 39 // request the RequestHandle that was returned by Resolve() needs to be
39 // given. A simpler alternative for consumers that only have 1 outstanding 40 // given. A simpler alternative for consumers that only have 1 outstanding
40 // request at a time is to create a SingleRequestHostResolver wrapper around 41 // request at a time is to create a SingleRequestHostResolver wrapper around
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Returns the current DNS configuration |this| is using, as a Value, or 186 // Returns the current DNS configuration |this| is using, as a Value, or
186 // nullptr if it's configured to always use the system host resolver. 187 // nullptr if it's configured to always use the system host resolver.
187 virtual std::unique_ptr<base::Value> GetDnsConfigAsValue() const; 188 virtual std::unique_ptr<base::Value> GetDnsConfigAsValue() const;
188 189
189 // Creates a HostResolver implementation that queries the underlying system. 190 // Creates a HostResolver implementation that queries the underlying system.
190 // (Except if a unit-test has changed the global HostResolverProc using 191 // (Except if a unit-test has changed the global HostResolverProc using
191 // ScopedHostResolverProc to intercept requests to the system). 192 // ScopedHostResolverProc to intercept requests to the system).
192 static std::unique_ptr<HostResolver> CreateSystemResolver( 193 static std::unique_ptr<HostResolver> CreateSystemResolver(
193 const Options& options, 194 const Options& options,
194 NetLog* net_log); 195 NetLog* net_log);
196 // Same, but explicitly returns the HostResolverImpl. Only used by
197 // StaleHostResolver in cronet.
198 static std::unique_ptr<HostResolverImpl> CreateSystemResolverImpl(
xunjieli 2016/07/25 17:18:15 Is this preferred over doing a runtime cast of Hos
Julia Tuttle 2016/07/25 19:29:16 They're both ugly; I think this is slightly less u
xunjieli 2016/07/25 21:09:14 Acknowledged.
199 const Options& options,
200 NetLog* net_log);
195 201
196 // As above, but uses default parameters. 202 // As above, but uses default parameters.
197 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); 203 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log);
204 // Same, but explicitly returns the HostResolverImpl. Only used by
205 // StaleHostResolver in cronet.
206 static std::unique_ptr<HostResolverImpl> CreateDefaultResolverImpl(
207 NetLog* net_log);
198 208
199 protected: 209 protected:
200 HostResolver(); 210 HostResolver();
201 211
202 private: 212 private:
203 DISALLOW_COPY_AND_ASSIGN(HostResolver); 213 DISALLOW_COPY_AND_ASSIGN(HostResolver);
204 }; 214 };
205 215
206 } // namespace net 216 } // namespace net
207 217
208 #endif // NET_DNS_HOST_RESOLVER_H_ 218 #endif // NET_DNS_HOST_RESOLVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698