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

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: DCHECK is silly. 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 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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicString.h ('k') | third_party/WebKit/Source/wtf/text/StringImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698