| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WTF_Allocator_h | 5 #ifndef WTF_Allocator_h |
| 6 #define WTF_Allocator_h | 6 #define WTF_Allocator_h |
| 7 | 7 |
| 8 #include "wtf/Assertions.h" | 8 #include "wtf/Assertions.h" |
| 9 #include "wtf/StdLibExtras.h" | 9 #include "wtf/StdLibExtras.h" |
| 10 #include "wtf/allocator/Partitions.h" | 10 #include "wtf/allocator/Partitions.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 __attribute__((annotate("blink_stack_allocated"))) void* operator new( \ | 75 __attribute__((annotate("blink_stack_allocated"))) void* operator new( \ |
| 76 size_t) = delete; \ | 76 size_t) = delete; \ |
| 77 void* operator new(size_t, NotNullTag, void*) = delete; \ | 77 void* operator new(size_t, NotNullTag, void*) = delete; \ |
| 78 void* operator new(size_t, void*) = delete; \ | 78 void* operator new(size_t, void*) = delete; \ |
| 79 \ | 79 \ |
| 80 public: | 80 public: |
| 81 #else | 81 #else |
| 82 #define STACK_ALLOCATED() DISALLOW_NEW() | 82 #define STACK_ALLOCATED() DISALLOW_NEW() |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 #if COMPILER(CLANG) |
| 86 #define STATIC_ALLOCATED_SINGLETON() \ |
| 87 __attribute__((annotate("blink_gc_singleton_type"))) |
| 88 #else |
| 89 #define STATIC_ALLOCATED_SINGLETON() |
| 90 #endif |
| 91 |
| 85 // Provides customizable overrides of fastMalloc/fastFree and operator | 92 // Provides customizable overrides of fastMalloc/fastFree and operator |
| 86 // new/delete | 93 // new/delete |
| 87 // | 94 // |
| 88 // Provided functionality: | 95 // Provided functionality: |
| 89 // Macro: USING_FAST_MALLOC | 96 // Macro: USING_FAST_MALLOC |
| 90 // | 97 // |
| 91 // Example usage: | 98 // Example usage: |
| 92 // class Widget { | 99 // class Widget { |
| 93 // USING_FAST_MALLOC(Widget) | 100 // USING_FAST_MALLOC(Widget) |
| 94 // ... | 101 // ... |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Furthermore, the |WITH_TYPE_NAME| variant does not work if |type| is a | 147 // Furthermore, the |WITH_TYPE_NAME| variant does not work if |type| is a |
| 141 // template argument; |USING_FAST_MALLOC| does. | 148 // template argument; |USING_FAST_MALLOC| does. |
| 142 #define USING_FAST_MALLOC(type) \ | 149 #define USING_FAST_MALLOC(type) \ |
| 143 USING_FAST_MALLOC_INTERNAL(type, WTF_HEAP_PROFILER_TYPE_NAME(type)) | 150 USING_FAST_MALLOC_INTERNAL(type, WTF_HEAP_PROFILER_TYPE_NAME(type)) |
| 144 #define USING_FAST_MALLOC_WITH_TYPE_NAME(type) \ | 151 #define USING_FAST_MALLOC_WITH_TYPE_NAME(type) \ |
| 145 USING_FAST_MALLOC_INTERNAL(type, #type) | 152 USING_FAST_MALLOC_INTERNAL(type, #type) |
| 146 | 153 |
| 147 } // namespace WTF | 154 } // namespace WTF |
| 148 | 155 |
| 149 #endif /* WTF_Allocator_h */ | 156 #endif /* WTF_Allocator_h */ |
| OLD | NEW |