OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } | 515 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } |
516 | 516 |
517 template<typename U> | 517 template<typename U> |
518 Member(const Persistent<U>& other) : m_raw(other) { } | 518 Member(const Persistent<U>& other) : m_raw(other) { } |
519 | 519 |
520 Member(const Member& other) : m_raw(other) { } | 520 Member(const Member& other) : m_raw(other) { } |
521 | 521 |
522 template<typename U> | 522 template<typename U> |
523 Member(const Member<U>& other) : m_raw(other) { } | 523 Member(const Member<U>& other) : m_raw(other) { } |
524 | 524 |
| 525 // FIXME: Oilpan: Get rid of these ASAP; this is only here to make |
| 526 // Node hierarchy transition easier. |
| 527 template<typename U> |
| 528 Member(const PassRefPtr<U>& other) : m_raw(other.get()) { } |
| 529 |
| 530 template<typename U> |
| 531 Member(const RefPtr<U>& other) : m_raw(other.get()) { } |
| 532 |
525 T* release() | 533 T* release() |
526 { | 534 { |
527 T* result = m_raw; | 535 T* result = m_raw; |
528 m_raw = 0; | 536 m_raw = 0; |
529 return result; | 537 return result; |
530 } | 538 } |
531 | 539 |
532 template<typename U> | 540 template<typename U> |
533 U* as() const | 541 U* as() const |
534 { | 542 { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 // Comparison operators between (Weak)Members and Persistents | 731 // Comparison operators between (Weak)Members and Persistents |
724 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } | 732 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } |
725 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t Member<U>& b) { return a.get() != b.get(); } | 733 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t Member<U>& b) { return a.get() != b.get(); } |
726 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() == b.get(); } | 734 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() == b.get(); } |
727 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() != b.get(); } | 735 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() != b.get(); } |
728 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Member<U>& b) { return a.get() == b.get(); } | 736 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Member<U>& b) { return a.get() == b.get(); } |
729 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Member<U>& b) { return a.get() != b.get(); } | 737 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Member<U>& b) { return a.get() != b.get(); } |
730 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() == b.get(); } | 738 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() == b.get(); } |
731 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() != b.get(); } | 739 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() != b.get(); } |
732 | 740 |
| 741 // FIXME: Oilpan: Get rid of these ASAP; only here to make Node transition easie
r. |
| 742 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t RefPtr<U>& b) { return a.get() == b.get(); } |
| 743 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t RefPtr<U>& b) { return a.get() != b.get(); } |
| 744 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } |
| 745 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, cons
t Member<U>& b) { return a.get() != b.get(); } |
| 746 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t PassRefPtr<U>& b) { return a.get() == b.get(); } |
| 747 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t PassRefPtr<U>& b) { return a.get() != b.get(); } |
| 748 template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a,
const Member<U>& b) { return a.get() == b.get(); } |
| 749 template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a,
const Member<U>& b) { return a.get() != b.get(); } |
| 750 |
733 // CPP-defined type names for the transition period where we want to | 751 // CPP-defined type names for the transition period where we want to |
734 // support both reference counting and garbage collection based on a | 752 // support both reference counting and garbage collection based on a |
735 // compile-time flag. | 753 // compile-time flag. |
736 // | 754 // |
737 // C++11 template aliases were initially used (with clang only, not | 755 // C++11 template aliases were initially used (with clang only, not |
738 // with GCC nor MSVC.) However, supporting both CPP defines and | 756 // with GCC nor MSVC.) However, supporting both CPP defines and |
739 // template aliases is problematic from outside a WebCore namespace | 757 // template aliases is problematic from outside a WebCore namespace |
740 // when Oilpan is disabled: e.g., | 758 // when Oilpan is disabled: e.g., |
741 // WebCore::RefCountedWillBeGarbageCollected as a template alias would | 759 // WebCore::RefCountedWillBeGarbageCollected as a template alias would |
742 // uniquely resolve from within any namespace, but if it is backed by | 760 // uniquely resolve from within any namespace, but if it is backed by |
743 // a CPP #define, it would expand to WebCore::RefCounted, and not the | 761 // a CPP #define, it would expand to WebCore::RefCounted, and not the |
744 // required WTF::RefCounted. | 762 // required WTF::RefCounted. |
745 // | 763 // |
746 // Having the CPP expansion instead be fully namespace qualified, and the | 764 // Having the CPP expansion instead be fully namespace qualified, and the |
747 // transition type be unqualified, would dually not work for template | 765 // transition type be unqualified, would dually not work for template |
748 // aliases. So, slightly unfortunately, fall back/down to the lowest | 766 // aliases. So, slightly unfortunately, fall back/down to the lowest |
749 // commmon denominator of using CPP macros only. | 767 // commmon denominator of using CPP macros only. |
750 #if ENABLE(OILPAN) | 768 #if ENABLE(OILPAN) |
751 #define PassRefPtrWillBeRawPtr WTF::RawPtr | 769 #define PassRefPtrWillBeRawPtr WTF::RawPtr |
752 #define RefCountedWillBeGarbageCollected WebCore::GarbageCollected | 770 #define RefCountedWillBeGarbageCollected WebCore::GarbageCollected |
753 #define RefCountedWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinal
ized | 771 #define RefCountedWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinal
ized |
754 #define RefCountedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected | 772 #define RefCountedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected |
755 #define ThreadSafeRefCountedWillBeGarbageCollected WebCore::GarbageCollected | 773 #define ThreadSafeRefCountedWillBeGarbageCollected WebCore::GarbageCollected |
756 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WebCore::GarbageColl
ectedFinalized | 774 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WebCore::GarbageColl
ectedFinalized |
| 775 #define TreeSharedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected |
757 #define PersistentWillBeMember WebCore::Member | 776 #define PersistentWillBeMember WebCore::Member |
758 #define RefPtrWillBePersistent WebCore::Persistent | 777 #define RefPtrWillBePersistent WebCore::Persistent |
759 #define RefPtrWillBeRawPtr WTF::RawPtr | 778 #define RefPtrWillBeRawPtr WTF::RawPtr |
760 #define RefPtrWillBeMember WebCore::Member | 779 #define RefPtrWillBeMember WebCore::Member |
761 #define RefPtrWillBeCrossThreadPersistent WebCore::CrossThreadPersistent | 780 #define RefPtrWillBeCrossThreadPersistent WebCore::CrossThreadPersistent |
762 #define RawPtrWillBeMember WebCore::Member | 781 #define RawPtrWillBeMember WebCore::Member |
763 #define RawPtrWillBeWeakMember WebCore::WeakMember | 782 #define RawPtrWillBeWeakMember WebCore::WeakMember |
764 #define OwnPtrWillBeMember WebCore::Member | 783 #define OwnPtrWillBeMember WebCore::Member |
765 #define OwnPtrWillBePersistent WebCore::Persistent | 784 #define OwnPtrWillBePersistent WebCore::Persistent |
766 #define OwnPtrWillBeRawPtr WTF::RawPtr | 785 #define OwnPtrWillBeRawPtr WTF::RawPtr |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 DummyBase() { } | 850 DummyBase() { } |
832 ~DummyBase() { } | 851 ~DummyBase() { } |
833 }; | 852 }; |
834 | 853 |
835 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr | 854 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr |
836 #define RefCountedWillBeGarbageCollected WTF::RefCounted | 855 #define RefCountedWillBeGarbageCollected WTF::RefCounted |
837 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted | 856 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted |
838 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted | 857 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted |
839 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted | 858 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted |
840 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo
unted | 859 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo
unted |
| 860 #define TreeSharedWillBeRefCountedGarbageCollected WebCore::TreeShared |
841 #define PersistentWillBeMember WebCore::Persistent | 861 #define PersistentWillBeMember WebCore::Persistent |
842 #define RefPtrWillBePersistent WTF::RefPtr | 862 #define RefPtrWillBePersistent WTF::RefPtr |
843 #define RefPtrWillBeRawPtr WTF::RefPtr | 863 #define RefPtrWillBeRawPtr WTF::RefPtr |
844 #define RefPtrWillBeMember WTF::RefPtr | 864 #define RefPtrWillBeMember WTF::RefPtr |
845 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr | 865 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr |
846 #define RawPtrWillBeMember WTF::RawPtr | 866 #define RawPtrWillBeMember WTF::RawPtr |
847 #define RawPtrWillBeWeakMember WTF::RawPtr | 867 #define RawPtrWillBeWeakMember WTF::RawPtr |
848 #define OwnPtrWillBeMember WTF::OwnPtr | 868 #define OwnPtrWillBeMember WTF::OwnPtr |
849 #define OwnPtrWillBePersistent WTF::OwnPtr | 869 #define OwnPtrWillBePersistent WTF::OwnPtr |
850 #define OwnPtrWillBeRawPtr WTF::OwnPtr | 870 #define OwnPtrWillBeRawPtr WTF::OwnPtr |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
neCapacity> > *> { | 1115 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
neCapacity> > *> { |
1096 // All heap allocated node pointers need visiting to keep the nodes alive, | 1116 // All heap allocated node pointers need visiting to keep the nodes alive, |
1097 // regardless of whether they contain pointers to other heap allocated | 1117 // regardless of whether they contain pointers to other heap allocated |
1098 // objects. | 1118 // objects. |
1099 static const bool value = true; | 1119 static const bool value = true; |
1100 }; | 1120 }; |
1101 | 1121 |
1102 } // namespace WTF | 1122 } // namespace WTF |
1103 | 1123 |
1104 #endif | 1124 #endif |
OLD | NEW |