OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Provides utility structures for inserting a CanonicalCookie into a hash set. | 5 // Provides utility structures for inserting a CanonicalCookie into a hash set. |
6 // Two cookies are considered equal if their names, domains, and paths are | 6 // Two cookies are considered equal if their names, domains, and paths are |
7 // equivalent. | 7 // equivalent. |
8 | 8 |
9 #ifndef CHROME_BROWSER_BROWSING_DATA_CANONICAL_COOKIE_HASH_H_ | 9 #ifndef CHROME_BROWSER_BROWSING_DATA_CANONICAL_COOKIE_HASH_H_ |
10 #define CHROME_BROWSER_BROWSING_DATA_CANONICAL_COOKIE_HASH_H_ | 10 #define CHROME_BROWSER_BROWSING_DATA_CANONICAL_COOKIE_HASH_H_ |
11 | 11 |
| 12 #include <stddef.h> |
| 13 |
12 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
13 #include "net/cookies/canonical_cookie.h" | 15 #include "net/cookies/canonical_cookie.h" |
14 | 16 |
15 namespace canonical_cookie { | 17 namespace canonical_cookie { |
16 | 18 |
17 // Returns a fast hash of a cookie, based on its name, domain, and path. | 19 // Returns a fast hash of a cookie, based on its name, domain, and path. |
18 size_t FastHash(const net::CanonicalCookie& cookie); | 20 size_t FastHash(const net::CanonicalCookie& cookie); |
19 | 21 |
20 struct CanonicalCookieHasher { | 22 struct CanonicalCookieHasher { |
21 std::size_t operator()(const net::CanonicalCookie& cookie) const { | 23 std::size_t operator()(const net::CanonicalCookie& cookie) const { |
(...skipping 10 matching lines...) Expand all Loading... |
32 } | 34 } |
33 }; | 35 }; |
34 | 36 |
35 typedef base::hash_set<net::CanonicalCookie, | 37 typedef base::hash_set<net::CanonicalCookie, |
36 CanonicalCookieHasher, | 38 CanonicalCookieHasher, |
37 CanonicalCookieComparer> CookieHashSet; | 39 CanonicalCookieComparer> CookieHashSet; |
38 | 40 |
39 }; // namespace canonical_cookie | 41 }; // namespace canonical_cookie |
40 | 42 |
41 #endif // CHROME_BROWSER_BROWSING_DATA_CANONICAL_COOKIE_HASH_H_ | 43 #endif // CHROME_BROWSER_BROWSING_DATA_CANONICAL_COOKIE_HASH_H_ |
OLD | NEW |