Index: net/dns/host_resolver.h |
diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h |
index 840aeb80e35de806ec97caa2ef86e07825b78e3b..3581889b13daad628630ccda019fe16748dcaa2f 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; |
@@ -155,14 +155,6 @@ class NET_EXPORT HostResolver { |
RequestHandle* out_req, |
const BoundNetLog& net_log) = 0; |
- // Resolves the given hostname (or IP address literal) out of cache or HOSTS |
- // file (if enabled) only. This is guaranteed to complete synchronously. |
- // This acts like |Resolve()| if the hostname is IP literal, or cached value |
- // or HOSTS entry exists. Otherwise, ERR_DNS_CACHE_MISS is returned. |
- virtual int ResolveFromCache(const RequestInfo& info, |
- AddressList* addresses, |
- const BoundNetLog& net_log) = 0; |
- |
// Changes the priority of the specified request. |req| is the handle returned |
// by Resolve(). ChangeRequestPriority must NOT be called after the request's |
// completion callback has already run or the request was canceled. |
@@ -175,6 +167,52 @@ class NET_EXPORT HostResolver { |
// has already run or the request was canceled. |
virtual void CancelRequest(RequestHandle req) = 0; |
+ // Resolves the given hostname (or IP address literal) out of cache or HOSTS |
+ // file (if enabled) only. This is guaranteed to complete synchronously. |
+ // This acts like |Resolve()| if the hostname is IP literal, or cached value |
+ // or HOSTS entry exists. Otherwise, ERR_DNS_CACHE_MISS is returned. |
+ virtual int ResolveFromCache(const RequestInfo& info, |
+ AddressList* addresses, |
+ const BoundNetLog& net_log) = 0; |
+ |
+ // 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. |
+ virtual int ResolveStaleFromCache(const RequestInfo& info, |
+ AddressList* addresses, |
+ HostCache::EntryStaleness* 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 a fresh result is available in cache, populates |addresses| and returns |
+ // it synchronously. |
+ // |
+ // Otherwise, starts a network request, returns ERR_IO_PENDING, and: |
+ // |
+ // If a stale result is available in cache, returns it through |
+ // |*stale_error|, |*stale_addresses|, and |*stale_info|. |
+ // |
+ // If no result is available in cache, sets |*stale_error| to |
+ // ERR_DNS_CACHE_MISS. |
+ // |
+ // In either asynchronous case: |
+ // |
+ // If |out_req| is non-NULL, then |*out_req| will be filled with a handle to |
+ // the async request. This handle is not valid after the request has |
+ // completed. |
+ int ResolveStale(const RequestInfo& info, |
+ RequestPriority priority, |
+ AddressList* addresses, |
+ const CompletionCallback& callback, |
+ RequestHandle* out_req, |
+ int* stale_error, |
+ AddressList* stale_addresses, |
+ HostCache::EntryStaleness* stale_info, |
+ const BoundNetLog& net_log); |
+ |
// Enable or disable the built-in asynchronous DnsClient. |
virtual void SetDnsClientEnabled(bool enabled); |