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

Unified Diff: Source/wtf/HashTable.h

Issue 180273022: Don't deallocate the HashTable backing explicitly when it is managed by GC. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashTable.h
diff --git a/Source/wtf/HashTable.h b/Source/wtf/HashTable.h
index 1289ad48d6c4be60639102583a9b3161c093c0db..84ed89cceef318cc87bf332a52d9e8540a1a7874 100644
--- a/Source/wtf/HashTable.h
+++ b/Source/wtf/HashTable.h
@@ -280,10 +280,12 @@ namespace WTF {
HashTable();
~HashTable()
{
- if (LIKELY(!m_table))
- return;
- deallocateTable(m_table, m_tableSize);
- m_table = 0;
+ if (!Allocator::isGarbageCollected) {
tkent 2014/03/05 01:12:40 nit: We prefer early return. { if (Allocator:
+ if (LIKELY(!m_table))
+ return;
+ deallocateTable(m_table, m_tableSize);
+ m_table = 0;
+ }
}
HashTable(const HashTable&);
@@ -887,13 +889,15 @@ namespace WTF {
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::deallocateTable(ValueType* table, unsigned size)
{
- if (Traits::needsDestruction) {
- for (unsigned i = 0; i < size; ++i) {
- if (!isDeletedBucket(table[i]))
- table[i].~ValueType();
+ if (!Allocator::isGarbageCollected) {
+ if (Traits::needsDestruction) {
+ for (unsigned i = 0; i < size; ++i) {
+ if (!isDeletedBucket(table[i]))
+ table[i].~ValueType();
+ }
}
+ Allocator::backingFree(table);
}
- Allocator::backingFree(table);
}
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698