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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } | 507 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } |
508 | 508 |
509 template<typename U> | 509 template<typename U> |
510 Member(const Persistent<U>& other) : m_raw(other) { } | 510 Member(const Persistent<U>& other) : m_raw(other) { } |
511 | 511 |
512 Member(const Member& other) : m_raw(other) { } | 512 Member(const Member& other) : m_raw(other) { } |
513 | 513 |
514 template<typename U> | 514 template<typename U> |
515 Member(const Member<U>& other) : m_raw(other) { } | 515 Member(const Member<U>& other) : m_raw(other) { } |
516 | 516 |
| 517 // FIXME: Oilpan: Get rid of these ASAP; this is only here to make |
| 518 // Node hierarchy transition easier. |
| 519 template<typename U> |
| 520 Member(const PassRefPtr<U>& other) : m_raw(other.get()) { } |
| 521 |
| 522 template<typename U> |
| 523 Member(const RefPtr<U>& other) : m_raw(other.get()) { } |
| 524 |
517 T* release() | 525 T* release() |
518 { | 526 { |
519 T* result = m_raw; | 527 T* result = m_raw; |
520 m_raw = 0; | 528 m_raw = 0; |
521 return result; | 529 return result; |
522 } | 530 } |
523 | 531 |
524 template<typename U> | 532 template<typename U> |
525 U* as() const | 533 U* as() const |
526 { | 534 { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 // Comparison operators between (Weak)Members and Persistents | 723 // Comparison operators between (Weak)Members and Persistents |
716 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } | 724 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } |
717 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(); } |
718 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Persistent<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(); } |
719 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(); } |
720 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Member<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(); } |
721 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(); } |
722 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Persistent<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(); } |
723 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(); } |
724 | 732 |
| 733 // FIXME: Oilpan: Get rid of these ASAP; only here to make Node transition easie
r. |
| 734 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t RefPtr<U>& b) { return a.get() == b.get(); } |
| 735 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t RefPtr<U>& b) { return a.get() != b.get(); } |
| 736 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } |
| 737 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, cons
t Member<U>& b) { return a.get() != b.get(); } |
| 738 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t PassRefPtr<U>& b) { return a.get() == b.get(); } |
| 739 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t PassRefPtr<U>& b) { return a.get() != b.get(); } |
| 740 template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a,
const Member<U>& b) { return a.get() == b.get(); } |
| 741 template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a,
const Member<U>& b) { return a.get() != b.get(); } |
| 742 |
725 // CPP-defined type names for the transition period where we want to | 743 // CPP-defined type names for the transition period where we want to |
726 // support both reference counting and garbage collection based on a | 744 // support both reference counting and garbage collection based on a |
727 // compile-time flag. | 745 // compile-time flag. |
728 // | 746 // |
729 // C++11 template aliases were initially used (with clang only, not | 747 // C++11 template aliases were initially used (with clang only, not |
730 // with GCC nor MSVC.) However, supporting both CPP defines and | 748 // with GCC nor MSVC.) However, supporting both CPP defines and |
731 // template aliases is problematic from outside a WebCore namespace | 749 // template aliases is problematic from outside a WebCore namespace |
732 // when Oilpan is disabled: e.g., | 750 // when Oilpan is disabled: e.g., |
733 // WebCore::RefCountedWillBeGarbageCollected as a template alias would | 751 // WebCore::RefCountedWillBeGarbageCollected as a template alias would |
734 // uniquely resolve from within any namespace, but if it is backed by | 752 // uniquely resolve from within any namespace, but if it is backed by |
735 // a CPP #define, it would expand to WebCore::RefCounted, and not the | 753 // a CPP #define, it would expand to WebCore::RefCounted, and not the |
736 // required WTF::RefCounted. | 754 // required WTF::RefCounted. |
737 // | 755 // |
738 // Having the CPP expansion instead be fully namespace qualified, and the | 756 // Having the CPP expansion instead be fully namespace qualified, and the |
739 // transition type be unqualified, would dually not work for template | 757 // transition type be unqualified, would dually not work for template |
740 // aliases. So, slightly unfortunately, fall back/down to the lowest | 758 // aliases. So, slightly unfortunately, fall back/down to the lowest |
741 // commmon denominator of using CPP macros only. | 759 // commmon denominator of using CPP macros only. |
742 #if ENABLE(OILPAN) | 760 #if ENABLE(OILPAN) |
743 #define PassRefPtrWillBeRawPtr WTF::RawPtr | 761 #define PassRefPtrWillBeRawPtr WTF::RawPtr |
744 #define RefCountedWillBeGarbageCollected WebCore::GarbageCollected | 762 #define RefCountedWillBeGarbageCollected WebCore::GarbageCollected |
745 #define RefCountedWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinal
ized | 763 #define RefCountedWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinal
ized |
746 #define RefCountedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected | 764 #define RefCountedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected |
747 #define ThreadSafeRefCountedWillBeGarbageCollected WebCore::GarbageCollected | 765 #define ThreadSafeRefCountedWillBeGarbageCollected WebCore::GarbageCollected |
748 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WebCore::GarbageColl
ectedFinalized | 766 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WebCore::GarbageColl
ectedFinalized |
| 767 #define TreeSharedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected |
749 #define PersistentWillBeMember WebCore::Member | 768 #define PersistentWillBeMember WebCore::Member |
750 #define RefPtrWillBePersistent WebCore::Persistent | 769 #define RefPtrWillBePersistent WebCore::Persistent |
751 #define RefPtrWillBeRawPtr WTF::RawPtr | 770 #define RefPtrWillBeRawPtr WTF::RawPtr |
752 #define RefPtrWillBeMember WebCore::Member | 771 #define RefPtrWillBeMember WebCore::Member |
753 #define RefPtrWillBeCrossThreadPersistent WebCore::CrossThreadPersistent | 772 #define RefPtrWillBeCrossThreadPersistent WebCore::CrossThreadPersistent |
754 #define RawPtrWillBeMember WebCore::Member | 773 #define RawPtrWillBeMember WebCore::Member |
755 #define RawPtrWillBeWeakMember WebCore::WeakMember | 774 #define RawPtrWillBeWeakMember WebCore::WeakMember |
756 #define OwnPtrWillBeMember WebCore::Member | 775 #define OwnPtrWillBeMember WebCore::Member |
757 #define OwnPtrWillBePersistent WebCore::Persistent | 776 #define OwnPtrWillBePersistent WebCore::Persistent |
758 #define OwnPtrWillBeRawPtr WTF::RawPtr | 777 #define OwnPtrWillBeRawPtr WTF::RawPtr |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 DummyBase() { } | 840 DummyBase() { } |
822 ~DummyBase() { } | 841 ~DummyBase() { } |
823 }; | 842 }; |
824 | 843 |
825 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr | 844 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr |
826 #define RefCountedWillBeGarbageCollected WTF::RefCounted | 845 #define RefCountedWillBeGarbageCollected WTF::RefCounted |
827 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted | 846 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted |
828 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted | 847 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted |
829 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted | 848 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted |
830 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo
unted | 849 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo
unted |
| 850 #define TreeSharedWillBeRefCountedGarbageCollected WebCore::TreeShared |
831 #define PersistentWillBeMember WebCore::Persistent | 851 #define PersistentWillBeMember WebCore::Persistent |
832 #define RefPtrWillBePersistent WTF::RefPtr | 852 #define RefPtrWillBePersistent WTF::RefPtr |
833 #define RefPtrWillBeRawPtr WTF::RefPtr | 853 #define RefPtrWillBeRawPtr WTF::RefPtr |
834 #define RefPtrWillBeMember WTF::RefPtr | 854 #define RefPtrWillBeMember WTF::RefPtr |
835 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr | 855 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr |
836 #define RawPtrWillBeMember WTF::RawPtr | 856 #define RawPtrWillBeMember WTF::RawPtr |
837 #define RawPtrWillBeWeakMember WTF::RawPtr | 857 #define RawPtrWillBeWeakMember WTF::RawPtr |
838 #define OwnPtrWillBeMember WTF::OwnPtr | 858 #define OwnPtrWillBeMember WTF::OwnPtr |
839 #define OwnPtrWillBePersistent WTF::OwnPtr | 859 #define OwnPtrWillBePersistent WTF::OwnPtr |
840 #define OwnPtrWillBeRawPtr WTF::OwnPtr | 860 #define OwnPtrWillBeRawPtr WTF::OwnPtr |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 }; | 1095 }; |
1076 | 1096 |
1077 template<typename T, typename U, typename V, typename W, typename X> | 1097 template<typename T, typename U, typename V, typename W, typename X> |
1078 struct NeedsTracing<HashMap<T, U, V, W, X> > { | 1098 struct NeedsTracing<HashMap<T, U, V, W, X> > { |
1079 static const bool value = false; | 1099 static const bool value = false; |
1080 }; | 1100 }; |
1081 | 1101 |
1082 } // namespace WTF | 1102 } // namespace WTF |
1083 | 1103 |
1084 #endif | 1104 #endif |
OLD | NEW |