| 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 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 template<bool isWeak, bool markWeakMembersStrongly, typename Key, typename Value
, typename Traits> | 1475 template<bool isWeak, bool markWeakMembersStrongly, typename Key, typename Value
, typename Traits> |
| 1476 struct CollectionBackingTraceTrait<true, isWeak, markWeakMembersStrongly, WTF::K
eyValuePair<Key, Value>, Traits> : public BaseVisitKeyValuePairTrait<markWeakMem
bersStrongly, Key, Value, Traits> { | 1476 struct CollectionBackingTraceTrait<true, isWeak, markWeakMembersStrongly, WTF::K
eyValuePair<Key, Value>, Traits> : public BaseVisitKeyValuePairTrait<markWeakMem
bersStrongly, Key, Value, Traits> { |
| 1477 }; | 1477 }; |
| 1478 | 1478 |
| 1479 | 1479 |
| 1480 // TFX (member) | 1480 // TFX (member) |
| 1481 template<bool markWeakMembersStrongly, typename T, typename Traits> | 1481 template<bool markWeakMembersStrongly, typename T, typename Traits> |
| 1482 struct CollectionBackingTraceTrait<true, false, markWeakMembersStrongly, Member<
T>, Traits> { | 1482 struct CollectionBackingTraceTrait<true, false, markWeakMembersStrongly, Member<
T>, Traits> { |
| 1483 static void mark(WebCore::Visitor* visitor, Member<T> self) | 1483 static void mark(WebCore::Visitor* visitor, Member<T> self) |
| 1484 { | 1484 { |
| 1485 visitor->mark(self.raw()); | 1485 visitor->mark(self.get()); |
| 1486 } | 1486 } |
| 1487 }; | 1487 }; |
| 1488 | 1488 |
| 1489 // FTT (weak member) | 1489 // FTT (weak member) |
| 1490 template<typename T, typename Traits> | 1490 template<typename T, typename Traits> |
| 1491 struct CollectionBackingTraceTrait<false, true, true, WeakMember<T>, Traits> { | 1491 struct CollectionBackingTraceTrait<false, true, true, WeakMember<T>, Traits> { |
| 1492 static void mark(WebCore::Visitor* visitor, WeakMember<T> self) | 1492 static void mark(WebCore::Visitor* visitor, WeakMember<T> self) |
| 1493 { | 1493 { |
| 1494 // This can mark weak members as if they were strong. The reason we | 1494 // This can mark weak members as if they were strong. The reason we |
| 1495 // need this is that we don't do weak processing unless we reach the | 1495 // need this is that we don't do weak processing unless we reach the |
| 1496 // backing only through the hash table. Reaching it in any other way | 1496 // backing only through the hash table. Reaching it in any other way |
| 1497 // makes it impossible to update the size and deleted slot count of the | 1497 // makes it impossible to update the size and deleted slot count of the |
| 1498 // table, and exposes us to weak processing during iteration issues. | 1498 // table, and exposes us to weak processing during iteration issues. |
| 1499 visitor->mark(self.raw()); | 1499 visitor->mark(self.get()); |
| 1500 } | 1500 } |
| 1501 }; | 1501 }; |
| 1502 | 1502 |
| 1503 // Catch-all for things that have a way to trace. For things that contain weak | 1503 // Catch-all for things that have a way to trace. For things that contain weak |
| 1504 // pointers they will generally be visited weakly even if | 1504 // pointers they will generally be visited weakly even if |
| 1505 // markWeakMembersStrongly is true. This is what you want. | 1505 // markWeakMembersStrongly is true. This is what you want. |
| 1506 template<bool isWeak, bool markWeakMembersStrongly, typename T, typename Traits> | 1506 template<bool isWeak, bool markWeakMembersStrongly, typename T, typename Traits> |
| 1507 struct CollectionBackingTraceTrait<true, isWeak, markWeakMembersStrongly, T, Tra
its> { | 1507 struct CollectionBackingTraceTrait<true, isWeak, markWeakMembersStrongly, T, Tra
its> { |
| 1508 static void mark(WebCore::Visitor* visitor, T& t) | 1508 static void mark(WebCore::Visitor* visitor, T& t) |
| 1509 { | 1509 { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 struct IfWeakMember; | 1566 struct IfWeakMember; |
| 1567 | 1567 |
| 1568 template<typename T> | 1568 template<typename T> |
| 1569 struct IfWeakMember { | 1569 struct IfWeakMember { |
| 1570 template<typename U> | 1570 template<typename U> |
| 1571 static bool isDead(Visitor*, const U&) { return false; } | 1571 static bool isDead(Visitor*, const U&) { return false; } |
| 1572 }; | 1572 }; |
| 1573 | 1573 |
| 1574 template<typename T> | 1574 template<typename T> |
| 1575 struct IfWeakMember<WeakMember<T> > { | 1575 struct IfWeakMember<WeakMember<T> > { |
| 1576 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.raw()); } | 1576 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } |
| 1577 }; | 1577 }; |
| 1578 | 1578 |
| 1579 template<typename K, typename V, typename HashFunctions, typename KeyTraits, typ
ename ValueTraits> | 1579 template<typename K, typename V, typename HashFunctions, typename KeyTraits, typ
ename ValueTraits> |
| 1580 void processWeakOffHeapHashMap(Visitor* visitor, void* self) | 1580 void processWeakOffHeapHashMap(Visitor* visitor, void* self) |
| 1581 { | 1581 { |
| 1582 typedef HashMap<K, V, WTF::DefaultAllocator, HashFunctions, KeyTraits, Value
Traits> Map; | 1582 typedef HashMap<K, V, WTF::DefaultAllocator, HashFunctions, KeyTraits, Value
Traits> Map; |
| 1583 Map* map = reinterpret_cast<Map*>(self); | 1583 Map* map = reinterpret_cast<Map*>(self); |
| 1584 // Collect up keys here because we can't modify a hash map while iterating | 1584 // Collect up keys here because we can't modify a hash map while iterating |
| 1585 // over it. | 1585 // over it. |
| 1586 Vector<K> deletionKeys; | 1586 Vector<K> deletionKeys; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 // to export. This forces it to export all the methods from ThreadHeap. | 1631 // to export. This forces it to export all the methods from ThreadHeap. |
| 1632 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf
o*); | 1632 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf
o*); |
| 1633 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); | 1633 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); |
| 1634 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; | 1634 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; |
| 1635 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; | 1635 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; |
| 1636 #endif | 1636 #endif |
| 1637 | 1637 |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 #endif // Heap_h | 1640 #endif // Heap_h |
| OLD | NEW |