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

Side by Side Diff: third_party/WebKit/Source/wtf/HashTable.h

Issue 1992873004: Replace all occurrences of RELEASE_ASSERT in wtf with CHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Specialized dchecks in utils.h. Created 4 years, 7 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) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 David Levin <levin@chromium.org> 3 * Copyright (C) 2008 David Levin <levin@chromium.org>
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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 622 }
623 623
624 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 624 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
625 void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocato r>::reserveCapacityForSize(unsigned newSize) 625 void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocato r>::reserveCapacityForSize(unsigned newSize)
626 { 626 {
627 unsigned newCapacity = calculateCapacity(newSize); 627 unsigned newCapacity = calculateCapacity(newSize);
628 if (newCapacity < KeyTraits::minimumTableSize) 628 if (newCapacity < KeyTraits::minimumTableSize)
629 newCapacity = KeyTraits::minimumTableSize; 629 newCapacity = KeyTraits::minimumTableSize;
630 630
631 if (newCapacity > capacity()) { 631 if (newCapacity > capacity()) {
632 RELEASE_ASSERT(!static_cast<int>(newCapacity >> 31)); // HashTable capac ity should not overflow 32bit int. 632 CHECK(!static_cast<int>(newCapacity >> 31)); // HashTable capacity shoul d not overflow 32bit int.
633 rehash(newCapacity, 0); 633 rehash(newCapacity, 0);
634 } 634 }
635 } 635 }
636 636
637 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 637 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
638 template <typename HashTranslator, typename T> 638 template <typename HashTranslator, typename T>
639 inline Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(const T& key) 639 inline Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(const T& key)
640 { 640 {
641 return const_cast<Value*>(const_cast<const HashTable*>(this)->lookup<HashTra nslator>(key)); 641 return const_cast<Value*>(const_cast<const HashTable*>(this)->lookup<HashTra nslator>(key));
642 } 642 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 1046 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
1047 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expand(Value* entry) 1047 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expand(Value* entry)
1048 { 1048 {
1049 unsigned newSize; 1049 unsigned newSize;
1050 if (!m_tableSize) { 1050 if (!m_tableSize) {
1051 newSize = KeyTraits::minimumTableSize; 1051 newSize = KeyTraits::minimumTableSize;
1052 } else if (mustRehashInPlace()) { 1052 } else if (mustRehashInPlace()) {
1053 newSize = m_tableSize; 1053 newSize = m_tableSize;
1054 } else { 1054 } else {
1055 newSize = m_tableSize * 2; 1055 newSize = m_tableSize * 2;
1056 RELEASE_ASSERT(newSize > m_tableSize); 1056 CHECK_GT(newSize, m_tableSize);
1057 } 1057 }
1058 1058
1059 return rehash(newSize, entry); 1059 return rehash(newSize, entry);
1060 } 1060 }
1061 1061
1062 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 1062 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
1063 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expandBuffer(unsigned newTableSize, Value* entry, bool& success) 1063 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expandBuffer(unsigned newTableSize, Value* entry, bool& success)
1064 { 1064 {
1065 success = false; 1065 success = false;
1066 ASSERT(m_tableSize < newTableSize); 1066 ASSERT(m_tableSize < newTableSize);
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 CollectionIterator end(toBeRemoved.end()); 1520 CollectionIterator end(toBeRemoved.end());
1521 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) 1521 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it)
1522 collection.remove(*it); 1522 collection.remove(*it);
1523 } 1523 }
1524 1524
1525 } // namespace WTF 1525 } // namespace WTF
1526 1526
1527 #include "wtf/HashIterators.h" 1527 #include "wtf/HashIterators.h"
1528 1528
1529 #endif // WTF_HashTable_h 1529 #endif // WTF_HashTable_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698