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

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

Issue 456633002: Oilpan: Assert that updator functions of HashMap, HashSet, and Vector should not be used during wea… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/wtf/Vector.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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 template<typename Key, typename Value, typename Extractor, typename HashFunc tions, typename Traits, typename KeyTraits, typename Allocator> 764 template<typename Key, typename Value, typename Extractor, typename HashFunc tions, typename Traits, typename KeyTraits, typename Allocator>
765 inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTrait s, Allocator>::initializeBucket(ValueType& bucket) 765 inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTrait s, Allocator>::initializeBucket(ValueType& bucket)
766 { 766 {
767 HashTableBucketInitializer<Traits::emptyValueIsZero>::template initializ e<Traits>(bucket); 767 HashTableBucketInitializer<Traits::emptyValueIsZero>::template initializ e<Traits>(bucket);
768 } 768 }
769 769
770 template<typename Key, typename Value, typename Extractor, typename HashFunc tions, typename Traits, typename KeyTraits, typename Allocator> 770 template<typename Key, typename Value, typename Extractor, typename HashFunc tions, typename Traits, typename KeyTraits, typename Allocator>
771 template<typename HashTranslator, typename T, typename Extra> 771 template<typename HashTranslator, typename T, typename Extra>
772 typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::AddResult HashTable<Key, Value, Extractor, HashFunctions, Traits, Ke yTraits, Allocator>::add(const T& key, const Extra& extra) 772 typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::AddResult HashTable<Key, Value, Extractor, HashFunctions, Traits, Ke yTraits, Allocator>::add(const T& key, const Extra& extra)
773 { 773 {
774 ASSERT(Allocator::isAllocationAllowed());
774 if (!m_table) 775 if (!m_table)
775 expand(); 776 expand();
776 777
777 ASSERT(m_table); 778 ASSERT(m_table);
778 779
779 ValueType* table = m_table; 780 ValueType* table = m_table;
780 size_t k = 0; 781 size_t k = 0;
781 size_t sizeMask = tableSizeMask(); 782 size_t sizeMask = tableSizeMask();
782 unsigned h = HashTranslator::hash(key); 783 unsigned h = HashTranslator::hash(key);
783 size_t i = h & sizeMask; 784 size_t i = h & sizeMask;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 if (shouldExpand()) 827 if (shouldExpand())
827 entry = expand(entry); 828 entry = expand(entry);
828 829
829 return AddResult(this, entry, true); 830 return AddResult(this, entry, true);
830 } 831 }
831 832
832 template<typename Key, typename Value, typename Extractor, typename HashFunc tions, typename Traits, typename KeyTraits, typename Allocator> 833 template<typename Key, typename Value, typename Extractor, typename HashFunc tions, typename Traits, typename KeyTraits, typename Allocator>
833 template<typename HashTranslator, typename T, typename Extra> 834 template<typename HashTranslator, typename T, typename Extra>
834 typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::AddResult HashTable<Key, Value, Extractor, HashFunctions, Traits, Ke yTraits, Allocator>::addPassingHashCode(const T& key, const Extra& extra) 835 typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::AddResult HashTable<Key, Value, Extractor, HashFunctions, Traits, Ke yTraits, Allocator>::addPassingHashCode(const T& key, const Extra& extra)
835 { 836 {
837 ASSERT(Allocator::isAllocationAllowed());
836 if (!m_table) 838 if (!m_table)
837 expand(); 839 expand();
838 840
839 FullLookupType lookupResult = fullLookupForWriting<HashTranslator>(key); 841 FullLookupType lookupResult = fullLookupForWriting<HashTranslator>(key);
840 842
841 ValueType* entry = lookupResult.first.first; 843 ValueType* entry = lookupResult.first.first;
842 bool found = lookupResult.first.second; 844 bool found = lookupResult.first.second;
843 unsigned h = lookupResult.second; 845 unsigned h = lookupResult.second;
844 846
845 if (found) 847 if (found)
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 CollectionIterator end(toBeRemoved.end()); 1343 CollectionIterator end(toBeRemoved.end());
1342 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) 1344 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it)
1343 collection.remove(*it); 1345 collection.remove(*it);
1344 } 1346 }
1345 1347
1346 } // namespace WTF 1348 } // namespace WTF
1347 1349
1348 #include "wtf/HashIterators.h" 1350 #include "wtf/HashIterators.h"
1349 1351
1350 #endif // WTF_HashTable_h 1352 #endif // WTF_HashTable_h
OLDNEW
« no previous file with comments | « no previous file | Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698