| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 HEAP_STUBS_H_ | 5 #ifndef HEAP_STUBS_H_ |
| 6 #define HEAP_STUBS_H_ | 6 #define HEAP_STUBS_H_ |
| 7 | 7 |
| 8 #include "stddef.h" | 8 #include "stddef.h" |
| 9 | 9 |
| 10 #define WTF_MAKE_FAST_ALLOCATED \ | 10 #define WTF_MAKE_FAST_ALLOCATED \ |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 #define ALLOW_ONLY_INLINE_ALLOCATION() \ | 136 #define ALLOW_ONLY_INLINE_ALLOCATION() \ |
| 137 public: \ | 137 public: \ |
| 138 void* operator new(size_t, void*); \ | 138 void* operator new(size_t, void*); \ |
| 139 private: \ | 139 private: \ |
| 140 void* operator new(size_t) = delete; | 140 void* operator new(size_t) = delete; |
| 141 | 141 |
| 142 #define GC_PLUGIN_IGNORE(bug) \ | 142 #define GC_PLUGIN_IGNORE(bug) \ |
| 143 __attribute__((annotate("blink_gc_plugin_ignore"))) | 143 __attribute__((annotate("blink_gc_plugin_ignore"))) |
| 144 | 144 |
| 145 #define USING_GARBAGE_COLLECTED_MIXIN(type) \ | 145 #define USING_GARBAGE_COLLECTED_MIXIN(type) \ |
| 146 public: \ | 146 public: \ |
| 147 virtual void adjustAndMark(Visitor*) const {} \ | 147 virtual void adjustAndMark(Visitor*) const override { } \ |
| 148 virtual bool isAlive(Visitor*) const { return 0; } | 148 virtual bool isHeapObjectAlive(Visitor*) const override { return 0; } |
| 149 | 149 |
| 150 template<typename T> class GarbageCollected { }; | 150 template<typename T> class GarbageCollected { }; |
| 151 | 151 |
| 152 template<typename T> | 152 template<typename T> |
| 153 class GarbageCollectedFinalized : public GarbageCollected<T> { }; | 153 class GarbageCollectedFinalized : public GarbageCollected<T> { }; |
| 154 | 154 |
| 155 template<typename T> class Member { | 155 template<typename T> class Member { |
| 156 public: | 156 public: |
| 157 operator T*() const { return 0; } | 157 operator T*() const { return 0; } |
| 158 T* operator->() { return 0; } | 158 T* operator->() { return 0; } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void trace(const T&); | 211 void trace(const T&); |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 class Visitor : public VisitorHelper<Visitor> { | 214 class Visitor : public VisitorHelper<Visitor> { |
| 215 public: | 215 public: |
| 216 template<typename T, void (T::*method)(Visitor*)> | 216 template<typename T, void (T::*method)(Visitor*)> |
| 217 void registerWeakMembers(const T* obj); | 217 void registerWeakMembers(const T* obj); |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 class GarbageCollectedMixin { | 220 class GarbageCollectedMixin { |
| 221 public: |
| 221 virtual void adjustAndMark(Visitor*) const = 0; | 222 virtual void adjustAndMark(Visitor*) const = 0; |
| 222 virtual bool isAlive(Visitor*) const = 0; | 223 virtual bool isHeapObjectAlive(Visitor*) const = 0; |
| 223 virtual void trace(Visitor*) { } | 224 virtual void trace(Visitor*) { } |
| 224 }; | 225 }; |
| 225 | 226 |
| 226 template<typename T> | 227 template<typename T> |
| 227 struct TraceIfNeeded { | 228 struct TraceIfNeeded { |
| 228 static void trace(Visitor*, T*); | 229 static void trace(Visitor*, T*); |
| 229 }; | 230 }; |
| 230 | 231 |
| 231 // blink::ScriptWrappable receives special treatment | 232 // blink::ScriptWrappable receives special treatment |
| 232 // so as to allow it to be used together with GarbageCollected<T>, | 233 // so as to allow it to be used together with GarbageCollected<T>, |
| 233 // even when its user-declared destructor is provided. | 234 // even when its user-declared destructor is provided. |
| 234 // As it is with Oilpan disabled. | 235 // As it is with Oilpan disabled. |
| 235 class ScriptWrappable { | 236 class ScriptWrappable { |
| 236 public: | 237 public: |
| 237 ~ScriptWrappable() { /* user-declared, thus, non-trivial */ } | 238 ~ScriptWrappable() { /* user-declared, thus, non-trivial */ } |
| 238 }; | 239 }; |
| 239 | 240 |
| 240 } | 241 } |
| 241 | 242 |
| 242 namespace WTF { | 243 namespace WTF { |
| 243 | 244 |
| 244 template<typename T> | 245 template<typename T> |
| 245 struct VectorTraits<blink::Member<T> > { | 246 struct VectorTraits<blink::Member<T> > { |
| 246 static const bool needsDestruction = false; | 247 static const bool needsDestruction = false; |
| 247 }; | 248 }; |
| 248 | 249 |
| 249 } | 250 } |
| 250 | 251 |
| 251 #endif | 252 #endif |
| OLD | NEW |