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

Unified Diff: net/dns/host_resolver.h

Issue 2083643003: DNS: Let requests specify a callback for future cache hits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: net/dns/host_resolver.h
diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h
index 5c371e43ad533e66ed0f366c36f5f17bb73e1bf7..44d488b189a78977889fa63b172011a888b47475 100644
--- a/net/dns/host_resolver.h
+++ b/net/dns/host_resolver.h
@@ -64,6 +64,8 @@ class NET_EXPORT HostResolver {
class NET_EXPORT RequestInfo {
public:
explicit RequestInfo(const HostPortPair& host_port_pair);
+ RequestInfo(const RequestInfo& request_info);
+ ~RequestInfo();
const HostPortPair& host_port_pair() const { return host_port_pair_; }
void set_host_port_pair(const HostPortPair& host_port_pair) {
@@ -94,7 +96,17 @@ class NET_EXPORT HostResolver {
bool is_my_ip_address() const { return is_my_ip_address_; }
void set_is_my_ip_address(bool b) { is_my_ip_address_ = b; }
+ using CacheHitCallback = base::Callback<void(const RequestInfo&)>;
+ const CacheHitCallback& cache_hit_callback() const {
+ return cache_hit_callback_;
+ }
+ void set_cache_hit_callback(const CacheHitCallback& callback) {
+ cache_hit_callback_ = callback;
+ }
+
private:
+ RequestInfo();
+
// The hostname to resolve, and the port to use in resulting sockaddrs.
HostPortPair host_port_pair_;
@@ -113,6 +125,10 @@ class NET_EXPORT HostResolver {
// Indicates a request for myIpAddress (to differentiate from other requests
// for localhost, currently used by Chrome OS).
bool is_my_ip_address_;
+
+ // A callback that will be called when another request reads the cache data
+ // returned (and possibly written) by this request.
+ CacheHitCallback cache_hit_callback_;
};
// Opaque type used to cancel a request.

Powered by Google App Engine
This is Rietveld 408576698