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

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

Issue 1865063003: CL for perf tryjob on android Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/wtf/Functional.h ('k') | third_party/WebKit/Source/wtf/Optional.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 624 }
625 625
626 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 626 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
627 void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocato r>::reserveCapacityForSize(unsigned newSize) 627 void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocato r>::reserveCapacityForSize(unsigned newSize)
628 { 628 {
629 unsigned newCapacity = calculateCapacity(newSize); 629 unsigned newCapacity = calculateCapacity(newSize);
630 if (newCapacity < KeyTraits::minimumTableSize) 630 if (newCapacity < KeyTraits::minimumTableSize)
631 newCapacity = KeyTraits::minimumTableSize; 631 newCapacity = KeyTraits::minimumTableSize;
632 632
633 if (newCapacity > capacity()) { 633 if (newCapacity > capacity()) {
634 RELEASE_ASSERT(!static_cast<int>(newCapacity >> 31)); // HashTable capac ity should not overflow 32bit int. 634 CHECK(!static_cast<int>(newCapacity >> 31)); // HashTable capacity shoul d not overflow 32bit int.
635 rehash(newCapacity, 0); 635 rehash(newCapacity, 0);
636 } 636 }
637 } 637 }
638 638
639 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 639 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
640 template <typename HashTranslator, typename T> 640 template <typename HashTranslator, typename T>
641 inline Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(const T& key) 641 inline Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::lookup(const T& key)
642 { 642 {
643 return const_cast<Value*>(const_cast<const HashTable*>(this)->lookup<HashTra nslator>(key)); 643 return const_cast<Value*>(const_cast<const HashTable*>(this)->lookup<HashTra nslator>(key));
644 } 644 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 1048 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
1049 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expand(Value* entry) 1049 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expand(Value* entry)
1050 { 1050 {
1051 unsigned newSize; 1051 unsigned newSize;
1052 if (!m_tableSize) { 1052 if (!m_tableSize) {
1053 newSize = KeyTraits::minimumTableSize; 1053 newSize = KeyTraits::minimumTableSize;
1054 } else if (mustRehashInPlace()) { 1054 } else if (mustRehashInPlace()) {
1055 newSize = m_tableSize; 1055 newSize = m_tableSize;
1056 } else { 1056 } else {
1057 newSize = m_tableSize * 2; 1057 newSize = m_tableSize * 2;
1058 RELEASE_ASSERT(newSize > m_tableSize); 1058 CHECK_GT(newSize, m_tableSize);
1059 } 1059 }
1060 1060
1061 return rehash(newSize, entry); 1061 return rehash(newSize, entry);
1062 } 1062 }
1063 1063
1064 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator> 1064 template <typename Key, typename Value, typename Extractor, typename HashFunctio ns, typename Traits, typename KeyTraits, typename Allocator>
1065 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expandBuffer(unsigned newTableSize, Value* entry, bool& success) 1065 Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca tor>::expandBuffer(unsigned newTableSize, Value* entry, bool& success)
1066 { 1066 {
1067 success = false; 1067 success = false;
1068 ASSERT(m_tableSize < newTableSize); 1068 ASSERT(m_tableSize < newTableSize);
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 CollectionIterator end(toBeRemoved.end()); 1522 CollectionIterator end(toBeRemoved.end());
1523 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) 1523 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it)
1524 collection.remove(*it); 1524 collection.remove(*it);
1525 } 1525 }
1526 1526
1527 } // namespace WTF 1527 } // namespace WTF
1528 1528
1529 #include "wtf/HashIterators.h" 1529 #include "wtf/HashIterators.h"
1530 1530
1531 #endif // WTF_HashTable_h 1531 #endif // WTF_HashTable_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/Functional.h ('k') | third_party/WebKit/Source/wtf/Optional.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698