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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 template<typename T> | 424 template<typename T> |
425 void registerWeakCell(T** cell) | 425 void registerWeakCell(T** cell) |
426 { | 426 { |
427 Derived::fromHelper(this)->registerWeakCellWithCallback(reinterpret_cast
<void**>(cell), &handleWeakCell<T>); | 427 Derived::fromHelper(this)->registerWeakCellWithCallback(reinterpret_cast
<void**>(cell), &handleWeakCell<T>); |
428 } | 428 } |
429 | 429 |
430 // The following trace methods are for off-heap collections. | 430 // The following trace methods are for off-heap collections. |
431 template<typename T, size_t inlineCapacity> | 431 template<typename T, size_t inlineCapacity> |
432 void trace(const Vector<T, inlineCapacity>& vector) | 432 void trace(const Vector<T, inlineCapacity>& vector) |
433 { | 433 { |
434 OffHeapCollectionTraceTrait<Vector<T, inlineCapacity, WTF::DefaultAlloca
tor> >::trace(Derived::fromHelper(this), vector); | 434 OffHeapCollectionTraceTrait<Vector<T, inlineCapacity, WTF::DefaultAlloca
tor>>::trace(Derived::fromHelper(this), vector); |
435 } | 435 } |
436 | 436 |
437 template<typename T, size_t N> | 437 template<typename T, size_t N> |
438 void trace(const Deque<T, N>& deque) | 438 void trace(const Deque<T, N>& deque) |
439 { | 439 { |
440 OffHeapCollectionTraceTrait<Deque<T, N> >::trace(Derived::fromHelper(thi
s), deque); | 440 OffHeapCollectionTraceTrait<Deque<T, N>>::trace(Derived::fromHelper(this
), deque); |
441 } | 441 } |
442 | 442 |
443 #if !ENABLE(OILPAN) | 443 #if !ENABLE(OILPAN) |
444 // These trace methods are needed to allow compiling and calling trace on | 444 // These trace methods are needed to allow compiling and calling trace on |
445 // transition types. We need to support calls in the non-oilpan build | 445 // transition types. We need to support calls in the non-oilpan build |
446 // because a fully transitioned type (which will have its trace method | 446 // because a fully transitioned type (which will have its trace method |
447 // called) might trace a field that is in transition. Once transition types | 447 // called) might trace a field that is in transition. Once transition types |
448 // are removed these can be removed. | 448 // are removed these can be removed. |
449 template<typename T> void trace(const OwnPtr<T>&) { } | 449 template<typename T> void trace(const OwnPtr<T>&) { } |
450 template<typename T> void trace(const RefPtr<T>&) { } | 450 template<typename T> void trace(const RefPtr<T>&) { } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 const int kMaxEagerTraceDepth = 100; | 663 const int kMaxEagerTraceDepth = 100; |
664 | 664 |
665 static int m_traceDepth; | 665 static int m_traceDepth; |
666 bool m_isGlobalMarkingVisitor; | 666 bool m_isGlobalMarkingVisitor; |
667 }; | 667 }; |
668 | 668 |
669 // We trace vectors by using the trace trait on each element, which means you | 669 // We trace vectors by using the trace trait on each element, which means you |
670 // can have vectors of general objects (not just pointers to objects) that can | 670 // can have vectors of general objects (not just pointers to objects) that can |
671 // be traced. | 671 // be traced. |
672 template<typename T, size_t N> | 672 template<typename T, size_t N> |
673 struct OffHeapCollectionTraceTrait<WTF::Vector<T, N, WTF::DefaultAllocator> > { | 673 struct OffHeapCollectionTraceTrait<WTF::Vector<T, N, WTF::DefaultAllocator>> { |
674 typedef WTF::Vector<T, N, WTF::DefaultAllocator> Vector; | 674 typedef WTF::Vector<T, N, WTF::DefaultAllocator> Vector; |
675 | 675 |
676 template<typename VisitorDispatcher> | 676 template<typename VisitorDispatcher> |
677 static void trace(VisitorDispatcher visitor, const Vector& vector) | 677 static void trace(VisitorDispatcher visitor, const Vector& vector) |
678 { | 678 { |
679 if (vector.isEmpty()) | 679 if (vector.isEmpty()) |
680 return; | 680 return; |
681 for (typename Vector::const_iterator it = vector.begin(), end = vector.e
nd(); it != end; ++it) | 681 for (typename Vector::const_iterator it = vector.begin(), end = vector.e
nd(); it != end; ++it) |
682 TraceTrait<T>::trace(visitor, const_cast<T*>(it)); | 682 TraceTrait<T>::trace(visitor, const_cast<T*>(it)); |
683 } | 683 } |
684 }; | 684 }; |
685 | 685 |
686 template<typename T, size_t N> | 686 template<typename T, size_t N> |
687 struct OffHeapCollectionTraceTrait<WTF::Deque<T, N> > { | 687 struct OffHeapCollectionTraceTrait<WTF::Deque<T, N>> { |
688 typedef WTF::Deque<T, N> Deque; | 688 typedef WTF::Deque<T, N> Deque; |
689 | 689 |
690 template<typename VisitorDispatcher> | 690 template<typename VisitorDispatcher> |
691 static void trace(VisitorDispatcher visitor, const Deque& deque) | 691 static void trace(VisitorDispatcher visitor, const Deque& deque) |
692 { | 692 { |
693 if (deque.isEmpty()) | 693 if (deque.isEmpty()) |
694 return; | 694 return; |
695 for (typename Deque::const_iterator it = deque.begin(), end = deque.end(
); it != end; ++it) | 695 for (typename Deque::const_iterator it = deque.begin(), end = deque.end(
); it != end; ++it) |
696 TraceTrait<T>::trace(visitor, const_cast<T*>(&(*it))); | 696 TraceTrait<T>::trace(visitor, const_cast<T*>(&(*it))); |
697 } | 697 } |
698 }; | 698 }; |
699 | 699 |
700 template<typename T, typename Traits = WTF::VectorTraits<T> > | 700 template<typename T, typename Traits = WTF::VectorTraits<T>> |
701 class HeapVectorBacking; | 701 class HeapVectorBacking; |
702 | 702 |
703 template<typename Table> | 703 template<typename Table> |
704 class HeapHashTableBacking { | 704 class HeapHashTableBacking { |
705 public: | 705 public: |
706 static void finalize(void* pointer); | 706 static void finalize(void* pointer); |
707 }; | 707 }; |
708 | 708 |
709 template<typename T> | 709 template<typename T> |
710 class DefaultTraceTrait<T, false> { | 710 class DefaultTraceTrait<T, false> { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 struct GCInfoTrait { | 926 struct GCInfoTrait { |
927 static size_t index() | 927 static size_t index() |
928 { | 928 { |
929 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index(); | 929 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::index(); |
930 } | 930 } |
931 }; | 931 }; |
932 | 932 |
933 } | 933 } |
934 | 934 |
935 #endif | 935 #endif |
OLD | NEW |