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

Unified Diff: net/dns/host_resolver_impl.h

Issue 1903263002: DNS: Expose stale results through HostResolverImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dns_stale1
Patch Set: Remove ResolveStaleFromCache from HostResolver but not Impl Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/host_resolver.cc ('k') | net/dns/host_resolver_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_impl.h
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h
index b3126633fdc8eda660742a2be7a1b088197a0e99..9ab01ca03ea1a6d3ea4a828249d546537a127f4f 100644
--- a/net/dns/host_resolver_impl.h
+++ b/net/dns/host_resolver_impl.h
@@ -138,16 +138,24 @@ class NET_EXPORT HostResolverImpl
const CompletionCallback& callback,
RequestHandle* out_req,
const BoundNetLog& source_net_log) override;
- int ResolveFromCache(const RequestInfo& info,
- AddressList* addresses,
- const BoundNetLog& source_net_log) override;
void ChangeRequestPriority(RequestHandle req,
RequestPriority priority) override;
void CancelRequest(RequestHandle req) override;
+ int ResolveFromCache(const RequestInfo& info,
+ AddressList* addresses,
+ const BoundNetLog& source_net_log) override;
void SetDnsClientEnabled(bool enabled) override;
HostCache* GetHostCache() override;
std::unique_ptr<base::Value> GetDnsConfigAsValue() const override;
+ // Like |ResolveFromCache()|, but can return a stale result if the
+ // implementation supports it. Fills in |*stale_info| if a response is
+ // returned to indicate how stale (or not) it is.
+ int ResolveStaleFromCache(const RequestInfo& info,
+ AddressList* addresses,
+ HostCache::EntryStaleness* stale_info,
+ const BoundNetLog& source_net_log);
+
void set_proc_params_for_test(const ProcTaskParams& proc_params) {
proc_params_ = proc_params;
}
@@ -181,10 +189,19 @@ class NET_EXPORT HostResolverImpl
// ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is
// incompatible, ERR_DNS_CACHE_MISS if entry was not found in cache and
// HOSTS and is not localhost.
+ //
+ // If |allow_stale| is true, then stale cache entries can be returned.
+ // |stale_info| must be non-null, and will be filled in with details of the
+ // entry's staleness (if an entry is returned).
+ //
+ // If |allow_stale| is false, then stale cache entries will not be returned,
+ // and |stale_info| must be null.
int ResolveHelper(const Key& key,
const RequestInfo& info,
const IPAddress* ip_address,
AddressList* addresses,
+ bool allow_stale,
+ HostCache::EntryStaleness* stale_info,
const BoundNetLog& request_net_log);
// Tries to resolve |key| as an IP, returns true and sets |net_error| if
@@ -198,10 +215,19 @@ class NET_EXPORT HostResolverImpl
// If |key| is not found in cache returns false, otherwise returns
// true, sets |net_error| to the cached error code and fills |addresses|
// if it is a positive entry.
+ //
+ // If |allow_stale| is true, then stale cache entries can be returned.
+ // |stale_info| must be non-null, and will be filled in with details of the
+ // entry's staleness (if an entry is returned).
+ //
+ // If |allow_stale| is false, then stale cache entries will not be returned,
+ // and |stale_info| must be null.
bool ServeFromCache(const Key& key,
const RequestInfo& info,
int* net_error,
- AddressList* addresses);
+ AddressList* addresses,
+ bool allow_stale,
+ HostCache::EntryStaleness* stale_info);
// If we have a DnsClient with a valid DnsConfig, and |key| is found in the
// HOSTS file, returns true and fills |addresses|. Otherwise returns false.
« no previous file with comments | « net/dns/host_resolver.cc ('k') | net/dns/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698