| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Google Inc. All rights reserved. | 2 * Copyright (C) 2008 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Use the low 32-bits of the 64-bit LinkHash as the key for HashSets. | 40 // Use the low 32-bits of the 64-bit LinkHash as the key for HashSets. |
| 41 struct LinkHashHash { | 41 struct LinkHashHash { |
| 42 STATIC_ONLY(LinkHashHash); | 42 STATIC_ONLY(LinkHashHash); |
| 43 static unsigned GetHash(LinkHash key) { return static_cast<unsigned>(key); } | 43 static unsigned GetHash(LinkHash key) { return static_cast<unsigned>(key); } |
| 44 static bool Equal(LinkHash a, LinkHash b) { return a == b; } | 44 static bool Equal(LinkHash a, LinkHash b) { return a == b; } |
| 45 static const bool safe_to_compare_to_empty_or_deleted = true; | 45 static const bool safe_to_compare_to_empty_or_deleted = true; |
| 46 | 46 |
| 47 // See AlreadyHashed::avoidDeletedValue. | 47 // See AlreadyHashed::avoidDeletedValue. |
| 48 static unsigned AvoidDeletedValue(LinkHash hash64) { | 48 static unsigned AvoidDeletedValue(LinkHash hash64) { |
| 49 ASSERT(hash64); | 49 DCHECK(hash64); |
| 50 unsigned hash = static_cast<unsigned>(hash64); | 50 unsigned hash = static_cast<unsigned>(hash64); |
| 51 unsigned new_hash = hash | (!(hash + 1) << 31); | 51 unsigned new_hash = hash | (!(hash + 1) << 31); |
| 52 ASSERT(new_hash); | 52 DCHECK(new_hash); |
| 53 ASSERT(new_hash != 0xFFFFFFFF); | 53 ASSERT(new_hash != 0xFFFFFFFF); |
| 54 return new_hash; | 54 return new_hash; |
| 55 } | 55 } |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Resolves the potentially relative URL "attributeURL" relative to the given | 58 // Resolves the potentially relative URL "attributeURL" relative to the given |
| 59 // base URL, and returns the hash of the string that will be used for visited | 59 // base URL, and returns the hash of the string that will be used for visited |
| 60 // link coloring. It will return the special value of 0 if attributeURL does not | 60 // link coloring. It will return the special value of 0 if attributeURL does not |
| 61 // look like a relative URL. | 61 // look like a relative URL. |
| 62 PLATFORM_EXPORT LinkHash VisitedLinkHash(const KURL& base, | 62 PLATFORM_EXPORT LinkHash VisitedLinkHash(const KURL& base, |
| 63 const AtomicString& attribute_url); | 63 const AtomicString& attribute_url); |
| 64 | 64 |
| 65 } // namespace blink | 65 } // namespace blink |
| 66 | 66 |
| 67 #endif // LinkHash_h | 67 #endif // LinkHash_h |
| OLD | NEW |