| 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 16 matching lines...) Expand all Loading... |
| 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/StdLibExtras.h" | 34 #include "wtf/StdLibExtras.h" |
| 35 | 35 |
| 36 // | 36 // |
| 37 // STACK_ALLOCATED(): Use if the object is only stack allocated. Heap objects | 37 // STACK_ALLOCATED(): Use if the object is only stack allocated. |
| 38 // should be in Members but you do not need the trace method as they are on | |
| 39 // the stack. (Down the line these might turn in to raw pointers, but for | |
| 40 // now Members indicates that we have thought about them and explicitly | |
| 41 // taken care of them.) | |
| 42 // | 38 // |
| 43 // DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can | 39 // DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can |
| 44 // be a part object. If it has Members you need a trace method and the | 40 // be a part object. |
| 45 // containing object needs to call that trace method. | |
| 46 // | 41 // |
| 47 // ALLOW_ONLY_INLINE_ALLOCATION(): Allows only placement new operator. | 42 // ALLOW_ONLY_INLINE_ALLOCATION(): Allows only placement new operator. |
| 48 // This disallows general allocation of this object but allows to put | 43 // This disallows general allocation of this object but allows to put |
| 49 // the object as a value object in collections. If these have Members you | 44 // the object as a value object in collections. |
| 50 // need to have a trace method. That trace method will be called | |
| 51 // automatically by the Heap collections. | |
| 52 // | 45 // |
| 53 #define DISALLOW_ALLOCATION() \ | 46 #define DISALLOW_ALLOCATION() \ |
| 54 private: \ | 47 private: \ |
| 55 void* operator new(size_t) = delete; \ | 48 void* operator new(size_t) = delete; \ |
| 56 void* operator new(size_t, NotNullTag, void*) = delete; \ | 49 void* operator new(size_t, NotNullTag, void*) = delete; \ |
| 57 void* operator new(size_t, void*) = delete; | 50 void* operator new(size_t, void*) = delete; |
| 58 | 51 |
| 59 #define ALLOW_ONLY_INLINE_ALLOCATION()
\ | 52 #define ALLOW_ONLY_INLINE_ALLOCATION()
\ |
| 60 public:
\ | 53 public:
\ |
| 61 void* operator new(size_t, NotNullTag, void* location) { return location
; } \ | 54 void* operator new(size_t, NotNullTag, void* location) { return location
; } \ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 virtual ~type(); \ | 87 virtual ~type(); \ |
| 95 private: | 88 private: |
| 96 | 89 |
| 97 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ | 90 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ |
| 98 type::~type() { } | 91 type::~type() { } |
| 99 | 92 |
| 100 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ | 93 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ |
| 101 DEFINE_STATIC_REF(type, name, arguments) | 94 DEFINE_STATIC_REF(type, name, arguments) |
| 102 | 95 |
| 103 #endif | 96 #endif |
| OLD | NEW |