| 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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 private: | 836 private: |
| 837 | 837 |
| 838 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ | 838 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ |
| 839 type::~type() { } | 839 type::~type() { } |
| 840 | 840 |
| 841 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ | 841 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ |
| 842 DEFINE_STATIC_REF(type, name, arguments) | 842 DEFINE_STATIC_REF(type, name, arguments) |
| 843 | 843 |
| 844 #endif // ENABLE(OILPAN) | 844 #endif // ENABLE(OILPAN) |
| 845 | 845 |
| 846 // Abstraction for injecting calls to an object's 'dispose()' method |
| 847 // on leaving a stack scope, ensuring earlier release of resources |
| 848 // than waiting until the object is eventually GCed. |
| 849 template<typename T> |
| 850 class ScopedDisposal { |
| 851 STACK_ALLOCATED(); |
| 852 public: |
| 853 ScopedDisposal(T* object) |
| 854 : m_object(object) |
| 855 { |
| 856 static_assert(IsGarbageCollectedType<T>::value, "can only be used with g
arbage collected types"); |
| 857 } |
| 858 |
| 859 ~ScopedDisposal() |
| 860 { |
| 861 if (m_object) |
| 862 m_object->dispose(); |
| 863 } |
| 864 |
| 865 void clear() { m_object.clear(); } |
| 866 |
| 867 private: |
| 868 Member<T> m_object; |
| 869 }; |
| 870 |
| 846 } // namespace blink | 871 } // namespace blink |
| 847 | 872 |
| 848 namespace WTF { | 873 namespace WTF { |
| 849 | 874 |
| 850 template <typename T> struct VectorTraits<blink::Member<T>> : VectorTraitsBase<b
link::Member<T>> { | 875 template <typename T> struct VectorTraits<blink::Member<T>> : VectorTraitsBase<b
link::Member<T>> { |
| 851 static const bool needsDestruction = false; | 876 static const bool needsDestruction = false; |
| 852 static const bool canInitializeWithMemset = true; | 877 static const bool canInitializeWithMemset = true; |
| 853 static const bool canMoveWithMemcpy = true; | 878 static const bool canMoveWithMemcpy = true; |
| 854 }; | 879 }; |
| 855 | 880 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 template<typename T> | 1059 template<typename T> |
| 1035 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1060 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
| 1036 }; | 1061 }; |
| 1037 | 1062 |
| 1038 template<typename T> | 1063 template<typename T> |
| 1039 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1064 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
| 1040 | 1065 |
| 1041 } // namespace WTF | 1066 } // namespace WTF |
| 1042 | 1067 |
| 1043 #endif | 1068 #endif |
| OLD | NEW |