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 GarbageCollected_h | 5 #ifndef GarbageCollected_h |
6 #define GarbageCollected_h | 6 #define GarbageCollected_h |
7 | 7 |
8 #include "platform/heap/ThreadState.h" | 8 #include "platform/heap/ThreadState.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // | 190 // |
191 // The "operator new" for B will enter the forbidden GC scope, but | 191 // The "operator new" for B will enter the forbidden GC scope, but |
192 // upon construction, two GarbageCollectedMixinConstructorMarker constructors | 192 // upon construction, two GarbageCollectedMixinConstructorMarker constructors |
193 // will run -- one for A (first) and another for B (secondly). Only | 193 // will run -- one for A (first) and another for B (secondly). Only |
194 // the second one should leave the forbidden GC scope. This is realized by | 194 // the second one should leave the forbidden GC scope. This is realized by |
195 // recording the address of B's GarbageCollectedMixinConstructorMarker | 195 // recording the address of B's GarbageCollectedMixinConstructorMarker |
196 // when the "operator new" for B runs, and leaving the forbidden GC scope | 196 // when the "operator new" for B runs, and leaving the forbidden GC scope |
197 // when the constructor of the recorded GarbageCollectedMixinConstructorMarker | 197 // when the constructor of the recorded GarbageCollectedMixinConstructorMarker |
198 // runs. | 198 // runs. |
199 #define USING_GARBAGE_COLLECTED_MIXIN(TYPE) \ | 199 #define USING_GARBAGE_COLLECTED_MIXIN(TYPE) \ |
| 200 IS_GARBAGE_COLLECTED_TYPE(); \ |
200 DEFINE_GARBAGE_COLLECTED_MIXIN_METHODS(blink::Visitor*, TYPE) \ | 201 DEFINE_GARBAGE_COLLECTED_MIXIN_METHODS(blink::Visitor*, TYPE) \ |
201 DEFINE_GARBAGE_COLLECTED_MIXIN_METHODS(blink::InlinedGlobalMarkingVisitor, T
YPE) \ | 202 DEFINE_GARBAGE_COLLECTED_MIXIN_METHODS(blink::InlinedGlobalMarkingVisitor, T
YPE) \ |
202 DEFINE_GARBAGE_COLLECTED_MIXIN_CONSTRUCTOR_MARKER(TYPE) \ | 203 DEFINE_GARBAGE_COLLECTED_MIXIN_CONSTRUCTOR_MARKER(TYPE) \ |
203 public: \ | 204 public: \ |
204 bool isHeapObjectAlive() const override \ | 205 bool isHeapObjectAlive() const override \ |
205 { \ | 206 { \ |
206 return Heap::isHeapObjectAlive(this); \ | 207 return Heap::isHeapObjectAlive(this); \ |
207 } \ | 208 } \ |
208 private: | 209 private: |
209 | 210 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 396 |
396 namespace WTF { | 397 namespace WTF { |
397 | 398 |
398 // Adoption is not needed nor wanted for RefCountedGarbageCollected<>-derived ty
pes. | 399 // Adoption is not needed nor wanted for RefCountedGarbageCollected<>-derived ty
pes. |
399 template<typename T> | 400 template<typename T> |
400 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 401 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
401 | 402 |
402 } // namespace WTF | 403 } // namespace WTF |
403 | 404 |
404 #endif | 405 #endif |
OLD | NEW |