Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringHash.h

Issue 2148423003: Use StringView for equalIgnoringCase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add rebaselines. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 StringView by derefing the StringImpl.
104 return equalIgnoringCaseAndNullity(*a, *b);
102 } 105 }
103 106
104 static unsigned hash(const RefPtr<StringImpl>& key) 107 static unsigned hash(const RefPtr<StringImpl>& key)
105 { 108 {
106 return hash(key.get()); 109 return hash(key.get());
107 } 110 }
108 111
109 static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b) 112 static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
110 { 113 {
111 return equal(a.get(), b.get()); 114 return equal(a.get(), b.get());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 169 }
167 }; 170 };
168 171
169 } // namespace WTF 172 } // namespace WTF
170 173
171 using WTF::AlreadyHashed; 174 using WTF::AlreadyHashed;
172 using WTF::CaseFoldingHash; 175 using WTF::CaseFoldingHash;
173 using WTF::StringHash; 176 using WTF::StringHash;
174 177
175 #endif 178 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698