Index: net/cookies/canonical_cookie.h |
diff --git a/net/cookies/canonical_cookie.h b/net/cookies/canonical_cookie.h |
index a55674052422314f3fa9e8d84491bde7fb0ab662..05504ebc16797c9147ab9bb424860b77f9f9e610 100644 |
--- a/net/cookies/canonical_cookie.h |
+++ b/net/cookies/canonical_cookie.h |
@@ -9,6 +9,8 @@ |
#include <vector> |
#include "base/basictypes.h" |
+#include "base/containers/hash_tables.h" |
+#include "base/hash.h" |
#include "base/time/time.h" |
#include "net/base/net_export.h" |
#include "net/cookies/cookie_constants.h" |
@@ -166,6 +168,28 @@ class NET_EXPORT CanonicalCookie { |
typedef std::vector<CanonicalCookie> CookieList; |
+struct CanonicalCookieHasher { |
+ std::size_t operator()(const CanonicalCookie& cookie) const { |
+ return base::SuperFastHash(cookie.Name().c_str(), cookie.Name().size()) + |
+ 3 * base::SuperFastHash(cookie.Domain().c_str(), |
+ cookie.Domain().size()) + |
+ 7 * base::SuperFastHash(cookie.Path().c_str(), cookie.Path().size()); |
+ } |
+}; |
+ |
+struct CanonicalCookieComparer { |
+ bool operator()(const CanonicalCookie& cookie1, |
+ const CanonicalCookie& cookie2) const { |
+ return cookie1.Name() == cookie2.Name() && |
+ cookie1.Domain() == cookie2.Domain() && |
+ cookie1.Path() == cookie2.Path(); |
+ } |
+}; |
+ |
+typedef base::hash_set<CanonicalCookie, |
+ CanonicalCookieHasher, |
+ CanonicalCookieComparer> CookieHashSet; |
+ |
} // namespace net |
#endif // NET_COOKIES_CANONICAL_COOKIE_H_ |