| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Handle_h | 31 #ifndef Handle_h |
| 32 #define Handle_h | 32 #define Handle_h |
| 33 | 33 |
| 34 #include "wtf/HashFunctions.h" | 34 #include "wtf/StdLibExtras.h" |
| 35 #include "wtf/PassOwnPtr.h" | |
| 36 #include "wtf/RawPtr.h" | |
| 37 #include "wtf/RefCounted.h" | |
| 38 #include "wtf/TypeTraits.h" | |
| 39 #include "wtf/text/AtomicString.h" | |
| 40 | 35 |
| 41 // Classes that contain heap references but aren't themselves heap | |
| 42 // allocated, have some extra macros available which allows their use | |
| 43 // to be restricted to cases where the garbage collector is able | |
| 44 // to discover their heap references. | |
| 45 // | 36 // |
| 46 // STACK_ALLOCATED(): Use if the object is only stack allocated. Heap objects | 37 // STACK_ALLOCATED(): Use if the object is only stack allocated. Heap objects |
| 47 // should be in Members but you do not need the trace method as they are on | 38 // should be in Members but you do not need the trace method as they are on |
| 48 // the stack. (Down the line these might turn in to raw pointers, but for | 39 // the stack. (Down the line these might turn in to raw pointers, but for |
| 49 // now Members indicates that we have thought about them and explicitly | 40 // now Members indicates that we have thought about them and explicitly |
| 50 // taken care of them.) | 41 // taken care of them.) |
| 51 // | 42 // |
| 52 // DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can | 43 // DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can |
| 53 // be a part object. If it has Members you need a trace method and the | 44 // be a part object. If it has Members you need a trace method and the |
| 54 // containing object needs to call that trace method. | 45 // containing object needs to call that trace method. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 83 |
| 93 #else | 84 #else |
| 94 #define STACK_ALLOCATED() DISALLOW_ALLOCATION() | 85 #define STACK_ALLOCATED() DISALLOW_ALLOCATION() |
| 95 #endif | 86 #endif |
| 96 | 87 |
| 97 namespace blink { | 88 namespace blink { |
| 98 | 89 |
| 99 class Visitor { | 90 class Visitor { |
| 100 public: | 91 public: |
| 101 template<typename T> | 92 template<typename T> |
| 102 void mark(T* t) | |
| 103 { | |
| 104 } | |
| 105 template<typename T> | |
| 106 void trace(const T* t) | 93 void trace(const T* t) |
| 107 { | 94 { |
| 108 } | 95 } |
| 109 template<typename T> | 96 template<typename T> |
| 110 void trace(T* t) | 97 void trace(T* t) |
| 111 { | 98 { |
| 112 } | 99 } |
| 113 template<typename T> | 100 template<typename T> |
| 114 void trace(const T& t) | 101 void trace(const T& t) |
| 115 { | 102 { |
| 116 } | 103 } |
| 117 }; | 104 }; |
| 118 | 105 |
| 119 #define WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TYPE) | |
| 120 | |
| 121 template<typename T> | |
| 122 class DummyBase { | |
| 123 public: | |
| 124 DummyBase() { } | |
| 125 ~DummyBase() { } | |
| 126 }; | |
| 127 | |
| 128 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED WTF_MAKE_FAST_ALLOCATED | |
| 129 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ | 106 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ |
| 130 public: \ | 107 public: \ |
| 131 ~type(); \ | 108 ~type(); \ |
| 132 private: | 109 private: |
| 133 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \ | 110 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \ |
| 134 public: \ | 111 public: \ |
| 135 virtual ~type(); \ | 112 virtual ~type(); \ |
| 136 private: | 113 private: |
| 137 | 114 |
| 138 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ | 115 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ |
| 139 type::~type() { } | 116 type::~type() { } |
| 140 | 117 |
| 141 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ | 118 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ |
| 142 DEFINE_STATIC_REF(type, name, arguments) | 119 DEFINE_STATIC_REF(type, name, arguments) |
| 143 | 120 |
| 144 } // namespace blink | 121 } // namespace blink |
| 145 | 122 |
| 146 #endif | 123 #endif |
| OLD | NEW |