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

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: Clarify a couple comments. Created 4 years, 4 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_cache_unittest.cc ('k') | 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 8af61f170f15a000b8c028e01ddffdbf55dbe44d..ed45ee1f3964cde221118115cbd3a701de8a1980 100644
--- a/net/dns/host_resolver.h
+++ b/net/dns/host_resolver.h
@@ -76,6 +76,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) {
@@ -106,7 +108,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_;
@@ -125,6 +137,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_;
};
// Set Options.max_concurrent_resolves to this to select a default level
« no previous file with comments | « net/dns/host_cache_unittest.cc ('k') | net/dns/host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698