| 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 |
| 739 |
| 740 |
| 725 // CPP-defined type names for the transition period where we want to | 741 // CPP-defined type names for the transition period where we want to |
| 726 // support both reference counting and garbage collection based on a | 742 // support both reference counting and garbage collection based on a |
| 727 // compile-time flag. | 743 // compile-time flag. |
| 728 // | 744 // |
| 729 // C++11 template aliases were initially used (with clang only, not | 745 // C++11 template aliases were initially used (with clang only, not |
| 730 // with GCC nor MSVC.) However, supporting both CPP defines and | 746 // with GCC nor MSVC.) However, supporting both CPP defines and |
| 731 // template aliases is problematic from outside a WebCore namespace | 747 // template aliases is problematic from outside a WebCore namespace |
| 732 // when Oilpan is disabled: e.g., | 748 // when Oilpan is disabled: e.g., |
| 733 // WebCore::RefCountedWillBeGarbageCollected as a template alias would | 749 // WebCore::RefCountedWillBeGarbageCollected as a template alias would |
| 734 // uniquely resolve from within any namespace, but if it is backed by | 750 // 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 | 751 // a CPP #define, it would expand to WebCore::RefCounted, and not the |
| 736 // required WTF::RefCounted. | 752 // required WTF::RefCounted. |
| 737 // | 753 // |
| 738 // Having the CPP expansion instead be fully namespace qualified, and the | 754 // Having the CPP expansion instead be fully namespace qualified, and the |
| 739 // transition type be unqualified, would dually not work for template | 755 // transition type be unqualified, would dually not work for template |
| 740 // aliases. So, slightly unfortunately, fall back/down to the lowest | 756 // aliases. So, slightly unfortunately, fall back/down to the lowest |
| 741 // commmon denominator of using CPP macros only. | 757 // commmon denominator of using CPP macros only. |
| 742 #if ENABLE(OILPAN) | 758 #if ENABLE(OILPAN) |
| 743 #define PassRefPtrWillBeRawPtr WTF::RawPtr | 759 #define PassRefPtrWillBeRawPtr WTF::RawPtr |
| 744 #define RefCountedWillBeGarbageCollected WebCore::GarbageCollected | 760 #define RefCountedWillBeGarbageCollected WebCore::GarbageCollected |
| 745 #define RefCountedWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinal
ized | 761 #define RefCountedWillBeGarbageCollectedFinalized WebCore::GarbageCollectedFinal
ized |
| 746 #define RefCountedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected | 762 #define RefCountedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected |
| 747 #define ThreadSafeRefCountedWillBeGarbageCollected WebCore::GarbageCollected | 763 #define ThreadSafeRefCountedWillBeGarbageCollected WebCore::GarbageCollected |
| 748 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WebCore::GarbageColl
ectedFinalized | 764 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WebCore::GarbageColl
ectedFinalized |
| 765 #define TreeSharedWillBeRefCountedGarbageCollected WebCore::RefCountedGarbageCol
lected |
| 749 #define PersistentWillBeMember WebCore::Member | 766 #define PersistentWillBeMember WebCore::Member |
| 750 #define RefPtrWillBePersistent WebCore::Persistent | 767 #define RefPtrWillBePersistent WebCore::Persistent |
| 751 #define RefPtrWillBeRawPtr WTF::RawPtr | 768 #define RefPtrWillBeRawPtr WTF::RawPtr |
| 752 #define RefPtrWillBeMember WebCore::Member | 769 #define RefPtrWillBeMember WebCore::Member |
| 753 #define RefPtrWillBeCrossThreadPersistent WebCore::CrossThreadPersistent | 770 #define RefPtrWillBeCrossThreadPersistent WebCore::CrossThreadPersistent |
| 754 #define RawPtrWillBeMember WebCore::Member | 771 #define RawPtrWillBeMember WebCore::Member |
| 755 #define RawPtrWillBeWeakMember WebCore::WeakMember | 772 #define RawPtrWillBeWeakMember WebCore::WeakMember |
| 756 #define OwnPtrWillBeMember WebCore::Member | 773 #define OwnPtrWillBeMember WebCore::Member |
| 757 #define OwnPtrWillBePersistent WebCore::Persistent | 774 #define OwnPtrWillBePersistent WebCore::Persistent |
| 758 #define OwnPtrWillBeRawPtr WTF::RawPtr | 775 #define OwnPtrWillBeRawPtr WTF::RawPtr |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 DummyBase() { } | 838 DummyBase() { } |
| 822 ~DummyBase() { } | 839 ~DummyBase() { } |
| 823 }; | 840 }; |
| 824 | 841 |
| 825 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr | 842 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr |
| 826 #define RefCountedWillBeGarbageCollected WTF::RefCounted | 843 #define RefCountedWillBeGarbageCollected WTF::RefCounted |
| 827 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted | 844 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted |
| 828 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted | 845 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted |
| 829 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted | 846 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted |
| 830 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo
unted | 847 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo
unted |
| 848 #define TreeSharedWillBeRefCountedGarbageCollected WebCore::TreeShared |
| 831 #define PersistentWillBeMember WebCore::Persistent | 849 #define PersistentWillBeMember WebCore::Persistent |
| 832 #define RefPtrWillBePersistent WTF::RefPtr | 850 #define RefPtrWillBePersistent WTF::RefPtr |
| 833 #define RefPtrWillBeRawPtr WTF::RefPtr | 851 #define RefPtrWillBeRawPtr WTF::RefPtr |
| 834 #define RefPtrWillBeMember WTF::RefPtr | 852 #define RefPtrWillBeMember WTF::RefPtr |
| 835 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr | 853 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr |
| 836 #define RawPtrWillBeMember WTF::RawPtr | 854 #define RawPtrWillBeMember WTF::RawPtr |
| 837 #define RawPtrWillBeWeakMember WTF::RawPtr | 855 #define RawPtrWillBeWeakMember WTF::RawPtr |
| 838 #define OwnPtrWillBeMember WTF::OwnPtr | 856 #define OwnPtrWillBeMember WTF::OwnPtr |
| 839 #define OwnPtrWillBePersistent WTF::OwnPtr | 857 #define OwnPtrWillBePersistent WTF::OwnPtr |
| 840 #define OwnPtrWillBeRawPtr WTF::OwnPtr | 858 #define OwnPtrWillBeRawPtr WTF::OwnPtr |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 }; | 1093 }; |
| 1076 | 1094 |
| 1077 template<typename T, typename U, typename V, typename W, typename X> | 1095 template<typename T, typename U, typename V, typename W, typename X> |
| 1078 struct NeedsTracing<HashMap<T, U, V, W, X> > { | 1096 struct NeedsTracing<HashMap<T, U, V, W, X> > { |
| 1079 static const bool value = false; | 1097 static const bool value = false; |
| 1080 }; | 1098 }; |
| 1081 | 1099 |
| 1082 } // namespace WTF | 1100 } // namespace WTF |
| 1083 | 1101 |
| 1084 #endif | 1102 #endif |
| OLD | NEW |