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

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

Issue 2833123002: Replace ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/wtf (Closed)
Patch Set: wtf Created 3 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 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 David Levin <levin@chromium.org> 4 * Copyright (C) 2008 David Levin <levin@chromium.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 Extractor, 984 Extractor,
985 HashFunctions, 985 HashFunctions,
986 Traits, 986 Traits,
987 KeyTraits, 987 KeyTraits,
988 Allocator>::ReserveCapacityForSize(unsigned new_size) { 988 Allocator>::ReserveCapacityForSize(unsigned new_size) {
989 unsigned new_capacity = CalculateCapacity(new_size); 989 unsigned new_capacity = CalculateCapacity(new_size);
990 if (new_capacity < KeyTraits::kMinimumTableSize) 990 if (new_capacity < KeyTraits::kMinimumTableSize)
991 new_capacity = KeyTraits::kMinimumTableSize; 991 new_capacity = KeyTraits::kMinimumTableSize;
992 992
993 if (new_capacity > Capacity()) { 993 if (new_capacity > Capacity()) {
994 RELEASE_ASSERT(!static_cast<int>( 994 CHECK(!static_cast<int>(
995 new_capacity >> 995 new_capacity >>
996 31)); // HashTable capacity should not overflow 32bit int. 996 31)); // HashTable capacity should not overflow 32bit int.
997 Rehash(new_capacity, 0); 997 Rehash(new_capacity, 0);
998 } 998 }
999 } 999 }
1000 1000
1001 template <typename Key, 1001 template <typename Key,
1002 typename Value, 1002 typename Value,
1003 typename Extractor, 1003 typename Extractor,
1004 typename HashFunctions, 1004 typename HashFunctions,
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 Value* 1617 Value*
1618 HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>:: 1618 HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::
1619 Expand(Value* entry) { 1619 Expand(Value* entry) {
1620 unsigned new_size; 1620 unsigned new_size;
1621 if (!table_size_) { 1621 if (!table_size_) {
1622 new_size = KeyTraits::kMinimumTableSize; 1622 new_size = KeyTraits::kMinimumTableSize;
1623 } else if (MustRehashInPlace()) { 1623 } else if (MustRehashInPlace()) {
1624 new_size = table_size_; 1624 new_size = table_size_;
1625 } else { 1625 } else {
1626 new_size = table_size_ * 2; 1626 new_size = table_size_ * 2;
1627 RELEASE_ASSERT(new_size > table_size_); 1627 CHECK_GT(new_size, table_size_);
1628 } 1628 }
1629 1629
1630 return Rehash(new_size, entry); 1630 return Rehash(new_size, entry);
1631 } 1631 }
1632 1632
1633 template <typename Key, 1633 template <typename Key,
1634 typename Value, 1634 typename Value,
1635 typename Extractor, 1635 typename Extractor,
1636 typename HashFunctions, 1636 typename HashFunctions,
1637 typename Traits, 1637 typename Traits,
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 CollectionIterator end(to_be_removed.end()); 2275 CollectionIterator end(to_be_removed.end());
2276 for (CollectionIterator it(to_be_removed.begin()); it != end; ++it) 2276 for (CollectionIterator it(to_be_removed.begin()); it != end; ++it)
2277 collection.erase(*it); 2277 collection.erase(*it);
2278 } 2278 }
2279 2279
2280 } // namespace WTF 2280 } // namespace WTF
2281 2281
2282 #include "platform/wtf/HashIterators.h" 2282 #include "platform/wtf/HashIterators.h"
2283 2283
2284 #endif // WTF_HashTable_h 2284 #endif // WTF_HashTable_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/Deque.h ('k') | third_party/WebKit/Source/platform/wtf/StackUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698