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

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

Issue 2585673002: Replace ASSERT, ENABLE(ASSERT), and ASSERT_NOT_REACHED in wtf (Closed)
Patch Set: Fix an Asan issue with LinkedHashSetNodeBase::unlink Created 4 years 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // but all our current uses of it are for strings. 139 // but all our current uses of it are for strings.
140 struct AlreadyHashed : IntHash<unsigned> { 140 struct AlreadyHashed : IntHash<unsigned> {
141 STATIC_ONLY(AlreadyHashed); 141 STATIC_ONLY(AlreadyHashed);
142 static unsigned hash(unsigned key) { return key; } 142 static unsigned hash(unsigned key) { return key; }
143 143
144 // To use a hash value as a key for a hash table, we need to eliminate the 144 // To use a hash value as a key for a hash table, we need to eliminate the
145 // "deleted" value, which is negative one. That could be done by changing 145 // "deleted" value, which is negative one. That could be done by changing
146 // the string hash function to never generate negative one, but this works 146 // the string hash function to never generate negative one, but this works
147 // and is still relatively efficient. 147 // and is still relatively efficient.
148 static unsigned avoidDeletedValue(unsigned hash) { 148 static unsigned avoidDeletedValue(unsigned hash) {
149 ASSERT(hash); 149 DCHECK(hash);
150 unsigned newHash = hash | (!(hash + 1) << 31); 150 unsigned newHash = hash | (!(hash + 1) << 31);
151 ASSERT(newHash); 151 DCHECK(newHash);
152 ASSERT(newHash != 0xFFFFFFFF); 152 DCHECK_NE(newHash, 0xFFFFFFFF);
153 return newHash; 153 return newHash;
154 } 154 }
155 }; 155 };
156 156
157 } // namespace WTF 157 } // namespace WTF
158 158
159 using WTF::AlreadyHashed; 159 using WTF::AlreadyHashed;
160 using WTF::CaseFoldingHash; 160 using WTF::CaseFoldingHash;
161 using WTF::StringHash; 161 using WTF::StringHash;
162 162
163 #endif 163 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringConcatenate.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