OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 | 1543 |
1544 template<typename T> | 1544 template<typename T> |
1545 static T& getOther(T* other) | 1545 static T& getOther(T* other) |
1546 { | 1546 { |
1547 return *other; | 1547 return *other; |
1548 } | 1548 } |
1549 | 1549 |
1550 static void enterNoAllocationScope() | 1550 static void enterNoAllocationScope() |
1551 { | 1551 { |
1552 #if ENABLE(ASSERT) | 1552 #if ENABLE(ASSERT) |
1553 ThreadStateFor<AnyThread>::state()->enterNoAllocationScope(); | 1553 ThreadStateFor<AnyThreadAffinity>::state()->enterNoAllocationScope(); |
1554 #endif | 1554 #endif |
1555 } | 1555 } |
1556 | 1556 |
1557 static void leaveNoAllocationScope() | 1557 static void leaveNoAllocationScope() |
1558 { | 1558 { |
1559 #if ENABLE(ASSERT) | 1559 #if ENABLE(ASSERT) |
1560 ThreadStateFor<AnyThread>::state()->leaveNoAllocationScope(); | 1560 ThreadStateFor<AnyThreadAffinity>::state()->leaveNoAllocationScope(); |
1561 #endif | 1561 #endif |
1562 } | 1562 } |
1563 | 1563 |
1564 private: | 1564 private: |
1565 template<typename T, size_t u, typename V> friend class WTF::Vector; | 1565 template<typename T, size_t u, typename V> friend class WTF::Vector; |
1566 template<typename T, typename U, typename V, typename W> friend class WTF::H
ashSet; | 1566 template<typename T, typename U, typename V, typename W> friend class WTF::H
ashSet; |
1567 template<typename T, typename U, typename V, typename W, typename X, typenam
e Y> friend class WTF::HashMap; | 1567 template<typename T, typename U, typename V, typename W, typename X, typenam
e Y> friend class WTF::HashMap; |
1568 }; | 1568 }; |
1569 | 1569 |
1570 template<typename Value> | 1570 template<typename Value> |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 }; | 1754 }; |
1755 | 1755 |
1756 template<typename T> | 1756 template<typename T> |
1757 struct ThreadingTrait<WeakMember<T> > { | 1757 struct ThreadingTrait<WeakMember<T> > { |
1758 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; | 1758 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; |
1759 }; | 1759 }; |
1760 | 1760 |
1761 template<typename Key, typename Value, typename T, typename U, typename V> | 1761 template<typename Key, typename Value, typename T, typename U, typename V> |
1762 struct ThreadingTrait<HashMap<Key, Value, T, U, V, HeapAllocator> > { | 1762 struct ThreadingTrait<HashMap<Key, Value, T, U, V, HeapAllocator> > { |
1763 static const ThreadAffinity Affinity = | 1763 static const ThreadAffinity Affinity = |
1764 (ThreadingTrait<Key>::Affinity == MainThreadOnly) | 1764 (ThreadingTrait<Key>::Affinity == MainThreadAffinity) |
1765 && (ThreadingTrait<Value>::Affinity == MainThreadOnly) ? MainThreadOnly
: AnyThread; | 1765 && (ThreadingTrait<Value>::Affinity == MainThreadAffinity) ? MainThreadA
ffinity : AnyThreadAffinity; |
1766 }; | 1766 }; |
1767 | 1767 |
1768 template<typename First, typename Second> | 1768 template<typename First, typename Second> |
1769 struct ThreadingTrait<WTF::KeyValuePair<First, Second> > { | 1769 struct ThreadingTrait<WTF::KeyValuePair<First, Second> > { |
1770 static const ThreadAffinity Affinity = | 1770 static const ThreadAffinity Affinity = |
1771 (ThreadingTrait<First>::Affinity == MainThreadOnly) | 1771 (ThreadingTrait<First>::Affinity == MainThreadAffinity) |
1772 && (ThreadingTrait<Second>::Affinity == MainThreadOnly) ? MainThreadOnly
: AnyThread; | 1772 && (ThreadingTrait<Second>::Affinity == MainThreadAffinity) ? MainThread
Affinity : AnyThreadAffinity; |
1773 }; | 1773 }; |
1774 | 1774 |
1775 template<typename T, typename U, typename V> | 1775 template<typename T, typename U, typename V> |
1776 struct ThreadingTrait<HashSet<T, U, V, HeapAllocator> > { | 1776 struct ThreadingTrait<HashSet<T, U, V, HeapAllocator> > { |
1777 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; | 1777 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; |
1778 }; | 1778 }; |
1779 | 1779 |
1780 | 1780 |
1781 template<typename T, size_t inlineCapacity> | 1781 template<typename T, size_t inlineCapacity> |
1782 struct ThreadingTrait<Vector<T, inlineCapacity, HeapAllocator> > { | 1782 struct ThreadingTrait<Vector<T, inlineCapacity, HeapAllocator> > { |
(...skipping 13 matching lines...) Expand all Loading... |
1796 template<typename T, typename U, typename V> | 1796 template<typename T, typename U, typename V> |
1797 struct ThreadingTrait<HashCountedSet<T, U, V, HeapAllocator> > { | 1797 struct ThreadingTrait<HashCountedSet<T, U, V, HeapAllocator> > { |
1798 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; | 1798 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; |
1799 }; | 1799 }; |
1800 | 1800 |
1801 template<typename Table> | 1801 template<typename Table> |
1802 struct ThreadingTrait<HeapHashTableBacking<Table> > { | 1802 struct ThreadingTrait<HeapHashTableBacking<Table> > { |
1803 typedef typename Table::KeyType Key; | 1803 typedef typename Table::KeyType Key; |
1804 typedef typename Table::ValueType Value; | 1804 typedef typename Table::ValueType Value; |
1805 static const ThreadAffinity Affinity = | 1805 static const ThreadAffinity Affinity = |
1806 (ThreadingTrait<Key>::Affinity == MainThreadOnly) | 1806 (ThreadingTrait<Key>::Affinity == MainThreadAffinity) |
1807 && (ThreadingTrait<Value>::Affinity == MainThreadOnly) ? MainThreadOnly
: AnyThread; | 1807 && (ThreadingTrait<Value>::Affinity == MainThreadAffinity) ? MainThreadA
ffinity : AnyThreadAffinity; |
1808 }; | 1808 }; |
1809 | 1809 |
1810 template<typename T, typename U, typename V, typename W, typename X> | 1810 template<typename T, typename U, typename V, typename W, typename X> |
1811 struct ThreadingTrait<HeapHashMap<T, U, V, W, X> > : public ThreadingTrait<HashM
ap<T, U, V, W, X, HeapAllocator> > { }; | 1811 struct ThreadingTrait<HeapHashMap<T, U, V, W, X> > : public ThreadingTrait<HashM
ap<T, U, V, W, X, HeapAllocator> > { }; |
1812 | 1812 |
1813 template<typename T, typename U, typename V> | 1813 template<typename T, typename U, typename V> |
1814 struct ThreadingTrait<HeapHashSet<T, U, V> > : public ThreadingTrait<HashSet<T,
U, V, HeapAllocator> > { }; | 1814 struct ThreadingTrait<HeapHashSet<T, U, V> > : public ThreadingTrait<HashSet<T,
U, V, HeapAllocator> > { }; |
1815 | 1815 |
1816 template<typename T, size_t inlineCapacity> | 1816 template<typename T, size_t inlineCapacity> |
1817 struct ThreadingTrait<HeapVector<T, inlineCapacity> > : public ThreadingTrait<Ve
ctor<T, inlineCapacity, HeapAllocator> > { }; | 1817 struct ThreadingTrait<HeapVector<T, inlineCapacity> > : public ThreadingTrait<Ve
ctor<T, inlineCapacity, HeapAllocator> > { }; |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2385 }; | 2385 }; |
2386 | 2386 |
2387 template<typename T> | 2387 template<typename T> |
2388 struct IfWeakMember<WeakMember<T> > { | 2388 struct IfWeakMember<WeakMember<T> > { |
2389 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } | 2389 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } |
2390 }; | 2390 }; |
2391 | 2391 |
2392 } | 2392 } |
2393 | 2393 |
2394 #endif // Heap_h | 2394 #endif // Heap_h |
OLD | NEW |