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

Unified Diff: net/dns/host_resolver.h

Issue 1903263002: DNS: Expose stale results through HostResolverImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dns_stale1
Patch Set: rebase Created 4 years, 8 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 | « no previous file | net/dns/host_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver.h
diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h
index 4e19e63af3f8311c507d195e3ecb933829995a34..6a3f334ce30acb97757d2d7b20712cce8233fbc1 100644
--- a/net/dns/host_resolver.h
+++ b/net/dns/host_resolver.h
@@ -18,6 +18,7 @@
#include "net/base/net_export.h"
#include "net/base/prioritized_dispatcher.h"
#include "net/base/request_priority.h"
+#include "net/dns/host_cache.h"
namespace base {
class Value;
@@ -27,7 +28,6 @@ namespace net {
class AddressList;
class BoundNetLog;
-class HostCache;
class HostResolverProc;
class NetLog;
@@ -163,6 +163,38 @@ class NET_EXPORT HostResolver {
AddressList* addresses,
const BoundNetLog& net_log) = 0;
+ // Like |ResolveFromCache()|, but can return a stale response. If it does,
+ // fills in |stale_info| with details on why the response is not valid.
+ // (Defaults to calling |ResolveFromCache()| if not overridden.)
Randy Smith (Not in Mondays) 2016/04/28 16:29:55 This implies that |stale_info| is not filled in if
Julia Tuttle 2016/04/29 17:34:47 Oh, it's supposed to (and does) always fill in sta
+ virtual int ResolveStaleFromCache(const RequestInfo& info,
+ AddressList* addresses,
+ HostCache::StaleEntryInfo* stale_info,
+ const BoundNetLog& net_log);
+
+ // Uses |ResolveStaleFromCache| and |Resolve| to get fresh data (either from
+ // the cache or from the network) but also return stale data if any is
+ // available.
+ //
+ // If fresh data is available in cache, populates |addresses| and returns
+ // synchronously. Sets |*stale_error| to ERR_UNEXPECTED, since it should not
+ // be used.
+ //
+ // If stale data is available in cache, starts a network request like
+ // |Resolve()|, but also returns the stale data through |stale_error|,
+ // |stale_addresses|, and |stale_info|.
+ //
+ // If no data is available in cache, starts a network request like
+ // |Resolve()| and sets |*stale_error| to ERR_DNS_CACHE_MISS.
Randy Smith (Not in Mondays) 2016/04/28 16:29:55 Confirming: All cases that start a network request
Julia Tuttle 2016/04/29 17:34:47 Yup. Should be clearer in the new version of the c
+ int ResolveStale(const RequestInfo& info,
+ RequestPriority priority,
+ AddressList* addresses,
+ const CompletionCallback& callback,
+ RequestHandle* out_req,
+ int* stale_error,
+ AddressList* stale_addresses,
+ HostCache::StaleEntryInfo* stale_info,
+ const BoundNetLog& net_log);
+
// Cancels the specified request. |req| is the handle returned by Resolve().
// After a request is canceled, its completion callback will not be called.
// CancelRequest must NOT be called after the request's completion callback
« no previous file with comments | « no previous file | net/dns/host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698