| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 m_raw = 0; | 353 m_raw = 0; |
| 354 return result; | 354 return result; |
| 355 } | 355 } |
| 356 | 356 |
| 357 T& operator*() const { return *m_raw; } | 357 T& operator*() const { return *m_raw; } |
| 358 | 358 |
| 359 bool operator!() const { return !m_raw; } | 359 bool operator!() const { return !m_raw; } |
| 360 | 360 |
| 361 operator T*() const { return m_raw; } | 361 operator T*() const { return m_raw; } |
| 362 operator RawPtr<T>() const { return m_raw; } | 362 operator RawPtr<T>() const { return m_raw; } |
| 363 // FIXME: Oilpan: Remove this ASAP. Only here to make Node transition easier
. | |
| 364 template<typename U> | |
| 365 operator PassRefPtr<U>() { return PassRefPtr<U>(m_raw); } | |
| 366 | 363 |
| 367 T* operator->() const { return *this; } | 364 T* operator->() const { return *this; } |
| 368 | 365 |
| 369 Persistent& operator=(const Persistent& other) | 366 Persistent& operator=(const Persistent& other) |
| 370 { | 367 { |
| 371 m_raw = other; | 368 m_raw = other; |
| 372 return *this; | 369 return *this; |
| 373 } | 370 } |
| 374 | 371 |
| 375 template<typename U> | 372 template<typename U> |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } | 519 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } |
| 523 | 520 |
| 524 template<typename U> | 521 template<typename U> |
| 525 Member(const Persistent<U>& other) : m_raw(other) { } | 522 Member(const Persistent<U>& other) : m_raw(other) { } |
| 526 | 523 |
| 527 Member(const Member& other) : m_raw(other) { } | 524 Member(const Member& other) : m_raw(other) { } |
| 528 | 525 |
| 529 template<typename U> | 526 template<typename U> |
| 530 Member(const Member<U>& other) : m_raw(other) { } | 527 Member(const Member<U>& other) : m_raw(other) { } |
| 531 | 528 |
| 532 // FIXME: Oilpan: Get rid of these ASAP; this is only here to make | |
| 533 // Node hierarchy transition easier. | |
| 534 template<typename U> | |
| 535 Member(const PassRefPtr<U>& other) : m_raw(other.get()) { } | |
| 536 | |
| 537 template<typename U> | |
| 538 Member(const RefPtr<U>& other) : m_raw(other.get()) { } | |
| 539 | |
| 540 T* release() | 529 T* release() |
| 541 { | 530 { |
| 542 T* result = m_raw; | 531 T* result = m_raw; |
| 543 m_raw = 0; | 532 m_raw = 0; |
| 544 return result; | 533 return result; |
| 545 } | 534 } |
| 546 | 535 |
| 547 template<typename U> | 536 template<typename U> |
| 548 U* as() const | 537 U* as() const |
| 549 { | 538 { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 return *this; | 582 return *this; |
| 594 } | 583 } |
| 595 | 584 |
| 596 void swap(Member<T>& other) { std::swap(m_raw, other.m_raw); } | 585 void swap(Member<T>& other) { std::swap(m_raw, other.m_raw); } |
| 597 | 586 |
| 598 T* get() const { return m_raw; } | 587 T* get() const { return m_raw; } |
| 599 | 588 |
| 600 void clear() { m_raw = 0; } | 589 void clear() { m_raw = 0; } |
| 601 | 590 |
| 602 | 591 |
| 603 // FIXME: Oilpan: Remove this ASAP. Only here to make Node transition easier
. | |
| 604 template<typename U> | |
| 605 operator PassRefPtr<U>() { return PassRefPtr<U>(m_raw); } | |
| 606 | |
| 607 protected: | 592 protected: |
| 608 void verifyTypeIsGarbageCollected() const | 593 void verifyTypeIsGarbageCollected() const |
| 609 { | 594 { |
| 610 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); | 595 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
| 611 } | 596 } |
| 612 | 597 |
| 613 T* m_raw; | 598 T* m_raw; |
| 614 | 599 |
| 615 template<bool x, WTF::WeakHandlingFlag y, ShouldWeakPointersBeMarkedStrongly
z, typename U, typename V> friend struct CollectionBackingTraceTrait; | 600 template<bool x, WTF::WeakHandlingFlag y, ShouldWeakPointersBeMarkedStrongly
z, typename U, typename V> friend struct CollectionBackingTraceTrait; |
| 616 friend class Visitor; | 601 friend class Visitor; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 // Comparison operators between (Weak)Members and Persistents | 729 // Comparison operators between (Weak)Members and Persistents |
| 745 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } | 730 template<typename T, typename U> inline bool operator==(const Member<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 Member<U>& b) { return a.get() != b.get(); } | 731 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t Member<U>& b) { return a.get() != b.get(); } |
| 747 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() == b.get(); } | 732 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() == b.get(); } |
| 748 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() != b.get(); } | 733 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t Persistent<U>& b) { return a.get() != b.get(); } |
| 749 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Member<U>& b) { return a.get() == b.get(); } | 734 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Member<U>& b) { return a.get() == b.get(); } |
| 750 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Member<U>& b) { return a.get() != b.get(); } | 735 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Member<U>& b) { return a.get() != b.get(); } |
| 751 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() == b.get(); } | 736 template<typename T, typename U> inline bool operator==(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() == b.get(); } |
| 752 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() != b.get(); } | 737 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
const Persistent<U>& b) { return a.get() != b.get(); } |
| 753 | 738 |
| 754 // FIXME: Oilpan: Get rid of these ASAP; only here to make Node transition easie
r. | |
| 755 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t RefPtr<U>& b) { return a.get() == b.get(); } | |
| 756 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t RefPtr<U>& b) { return a.get() != b.get(); } | |
| 757 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, cons
t Member<U>& b) { return a.get() == b.get(); } | |
| 758 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, cons
t Member<U>& b) { return a.get() != b.get(); } | |
| 759 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons
t PassRefPtr<U>& b) { return a.get() == b.get(); } | |
| 760 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons
t PassRefPtr<U>& b) { return a.get() != b.get(); } | |
| 761 template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a,
const Member<U>& b) { return a.get() == b.get(); } | |
| 762 template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a,
const Member<U>& b) { return a.get() != b.get(); } | |
| 763 | |
| 764 // CPP-defined type names for the transition period where we want to | 739 // CPP-defined type names for the transition period where we want to |
| 765 // support both reference counting and garbage collection based on a | 740 // support both reference counting and garbage collection based on a |
| 766 // compile-time flag. | 741 // compile-time flag. |
| 767 // | 742 // |
| 768 // C++11 template aliases were initially used (with clang only, not | 743 // C++11 template aliases were initially used (with clang only, not |
| 769 // with GCC nor MSVC.) However, supporting both CPP defines and | 744 // with GCC nor MSVC.) However, supporting both CPP defines and |
| 770 // template aliases is problematic from outside a WebCore namespace | 745 // template aliases is problematic from outside a WebCore namespace |
| 771 // when Oilpan is disabled: e.g., | 746 // when Oilpan is disabled: e.g., |
| 772 // WebCore::RefCountedWillBeGarbageCollected as a template alias would | 747 // WebCore::RefCountedWillBeGarbageCollected as a template alias would |
| 773 // uniquely resolve from within any namespace, but if it is backed by | 748 // uniquely resolve from within any namespace, but if it is backed by |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WebCore::Is
GarbageCollectedType<T>::value> { | 1176 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WebCore::Is
GarbageCollectedType<T>::value> { |
| 1202 }; | 1177 }; |
| 1203 | 1178 |
| 1204 template<typename T> | 1179 template<typename T> |
| 1205 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, Web
Core::IsGarbageCollectedType<T>::value> { | 1180 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, Web
Core::IsGarbageCollectedType<T>::value> { |
| 1206 }; | 1181 }; |
| 1207 | 1182 |
| 1208 } // namespace WTF | 1183 } // namespace WTF |
| 1209 | 1184 |
| 1210 #endif | 1185 #endif |
| OLD | NEW |