Allow HostCache::Entry to store data for new result type
This change is a huge portion of the plumbing for connecting up the new
result type because HostCache::Entry is (disorganizedly) not just the
caching entry but it is also the general results-passing type used
within HostResolverManager and contains all the logic for merging the
separate results from different DNS transactions.
Keep the address results separate from the metadata results (from HTTPS
records) to allow for easier merging between results from address
queries and the HTTPS query. Merge it all together, based on metadata
priority values, on retrieval using `HostCache::Entry::GetEndpoints()`
Assumes we only have one set of addresses to work with, which doesn't
really match up with our future plans around allowing HTTPS records to
change the target name, but we're going to need to make much bigger
caching changes to make any of that work anyway.
Nothing setup yet to store or use the new data, and everything is still
pulling the old AddressList data from a now-renamed `legacy_addresses`
field. Subsequent CLs will store the new data alongside the old and
then switch to using the new data and deleting internal usage of
AddressList.
Bug: 1264933
Change-Id: I07e234926d36a35a98f6749a7ffd63e41a074ba5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3288069
Reviewed-by: David Benjamin <[email protected]>
Commit-Queue: Eric Orth <[email protected]>
Cr-Commit-Position: refs/heads/main@{#957335}
diff --git a/net/dns/host_resolver_results.h b/net/dns/host_resolver_results.h
index a03442f..972afcf 100644
--- a/net/dns/host_resolver_results.h
+++ b/net/dns/host_resolver_results.h
@@ -6,6 +6,7 @@
#define NET_DNS_HOST_RESOLVER_RESULTS_H_
#include <string>
+#include <tuple>
#include <vector>
#include "net/base/connection_endpoint_metadata.h"
@@ -26,6 +27,14 @@
HostResolverEndpointResult(HostResolverEndpointResult&&);
HostResolverEndpointResult& operator=(HostResolverEndpointResult&&) = default;
+ bool operator==(const HostResolverEndpointResult& other) const {
+ return std::tie(ip_endpoints, metadata) ==
+ std::tie(other.ip_endpoints, other.metadata);
+ }
+ bool operator!=(const HostResolverEndpointResult& other) const {
+ return !(*this == other);
+ }
+
// IP endpoints at which to connect to the service.
std::vector<net::IPEndPoint> ip_endpoints;