| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved | 2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved |
| 3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), lengt
h); | 91 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), lengt
h); |
| 92 } | 92 } |
| 93 | 93 |
| 94 static inline unsigned hash(const char* data) | 94 static inline unsigned hash(const char* data) |
| 95 { | 95 { |
| 96 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), strle
n(data)); | 96 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), strle
n(data)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 static inline bool equal(const StringImpl* a, const StringImpl* b) | 99 static inline bool equal(const StringImpl* a, const StringImpl* b) |
| 100 { | 100 { |
| 101 return equalIgnoringCaseNonNull(a, b); | 101 DCHECK(a); |
| 102 DCHECK(b); |
| 103 // Save one branch inside each StringView by derefing the StringImpl, |
| 104 // and another branch inside the compare function by skipping the null |
| 105 // checks. |
| 106 return equalIgnoringCaseAndNullity(*a, *b); |
| 102 } | 107 } |
| 103 | 108 |
| 104 static unsigned hash(const RefPtr<StringImpl>& key) | 109 static unsigned hash(const RefPtr<StringImpl>& key) |
| 105 { | 110 { |
| 106 return hash(key.get()); | 111 return hash(key.get()); |
| 107 } | 112 } |
| 108 | 113 |
| 109 static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b) | 114 static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b) |
| 110 { | 115 { |
| 111 return equal(a.get(), b.get()); | 116 return equal(a.get(), b.get()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 171 } |
| 167 }; | 172 }; |
| 168 | 173 |
| 169 } // namespace WTF | 174 } // namespace WTF |
| 170 | 175 |
| 171 using WTF::AlreadyHashed; | 176 using WTF::AlreadyHashed; |
| 172 using WTF::CaseFoldingHash; | 177 using WTF::CaseFoldingHash; |
| 173 using WTF::StringHash; | 178 using WTF::StringHash; |
| 174 | 179 |
| 175 #endif | 180 #endif |
| OLD | NEW |