Index: net/dns/dns_hosts.h |
diff --git a/net/dns/dns_hosts.h b/net/dns/dns_hosts.h |
index e55772b7e35f95913f13f7b9f9cf0523d508a57e..2ce7c52dc16fb5e2eb80835a3b6aea3d506bbeac 100644 |
--- a/net/dns/dns_hosts.h |
+++ b/net/dns/dns_hosts.h |
@@ -9,25 +9,31 @@ |
#include <map> |
#include <string> |
-#include <unordered_map> |
#include <utility> |
#include <vector> |
+#include "base/containers/hash_tables.h" |
#include "base/files/file_path.h" |
-#include "base/strings/string_piece.h" |
#include "net/base/address_family.h" |
#include "net/base/ip_address.h" |
#include "net/base/net_export.h" |
namespace net { |
+ typedef std::pair<std::string, AddressFamily> DnsHostsKey; |
+}; |
-using DnsHostsKey = std::pair<std::string, AddressFamily>; |
+namespace BASE_HASH_NAMESPACE { |
-struct DnsHostsKeyHash { |
- std::size_t operator()(const DnsHostsKey& key) const { |
+template<> |
+struct hash<net::DnsHostsKey> { |
+ std::size_t operator()(const net::DnsHostsKey& key) const { |
return base::StringPieceHash()(key.first) + key.second; |
} |
}; |
+ |
+} // namespace BASE_HASH_NAMESPACE |
+ |
+namespace net { |
// There are OS-specific variations in how commas in the hosts file behave. |
enum ParseHostsCommaMode { |
@@ -50,7 +56,13 @@ |
// 127.0.0.1 localhost |
// 10.0.0.1 localhost |
// The expected resolution of localhost is 127.0.0.1. |
-using DnsHosts = std::unordered_map<DnsHostsKey, IPAddress, DnsHostsKeyHash>; |
+#if !defined(OS_ANDROID) |
+typedef base::hash_map<DnsHostsKey, IPAddress> DnsHosts; |
+#else |
+// Android's hash_map doesn't support ==, so fall back to map. (Chromium on |
+// Android doesn't use the built-in DNS resolver anyway, so it's irrelevant.) |
+typedef std::map<DnsHostsKey, IPAddress> DnsHosts; |
+#endif |
// Parses |contents| (as read from /etc/hosts or equivalent) and stores results |
// in |dns_hosts|. Invalid lines are ignored (as in most implementations). |