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/Assertions.h" | 9 #include "wtf/Assertions.h" |
10 #include "wtf/ListHashSet.h" | 10 #include "wtf/ListHashSet.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 #define DEFINE_GARBAGE_COLLECTED_MIXIN_CONSTRUCTOR_MARKER(TYPE)
\ | 162 #define DEFINE_GARBAGE_COLLECTED_MIXIN_CONSTRUCTOR_MARKER(TYPE)
\ |
163 public:
\ | 163 public:
\ |
164 ALWAYS_INLINE static void forbidGCDuringConstruction(void* object)
\ | 164 ALWAYS_INLINE static void forbidGCDuringConstruction(void* object)
\ |
165 {
\ | 165 {
\ |
166 ThreadState* state = ThreadStateFor<ThreadingTrait<TYPE>::Affinity>::sta
te(); \ | 166 ThreadState* state = ThreadStateFor<ThreadingTrait<TYPE>::Affinity>::sta
te(); \ |
167 state->enterGCForbiddenScopeIfNeeded(&(reinterpret_cast<TYPE*>(object)->
m_mixinConstructorMarker)); \ | 167 state->enterGCForbiddenScopeIfNeeded(&(reinterpret_cast<TYPE*>(object)->
m_mixinConstructorMarker)); \ |
168 }
\ | 168 }
\ |
169 GC_PLUGIN_IGNORE("crbug.com/456823")
\ | 169 GC_PLUGIN_IGNORE("crbug.com/456823")
\ |
170 void* operator new(size_t size)
\ | 170 void* operator new(size_t size)
\ |
171 {
\ | 171 {
\ |
172 void* object = TYPE::allocateObject(size);
\ | 172 void* object = TYPE::allocateObject(size, IsEagerlyFinalizedType<TYPE>::
value); \ |
173 forbidGCDuringConstruction(object);
\ | 173 forbidGCDuringConstruction(object);
\ |
174 return object;
\ | 174 return object;
\ |
175 }
\ | 175 }
\ |
176 GarbageCollectedMixinConstructorMarker m_mixinConstructorMarker;
\ | 176 GarbageCollectedMixinConstructorMarker m_mixinConstructorMarker;
\ |
177 private: | 177 private: |
178 | 178 |
179 // Mixins that wrap/nest others requires extra handling: | 179 // Mixins that wrap/nest others requires extra handling: |
180 // | 180 // |
181 // class A : public GarbageCollected<A>, public GarbageCollectedMixin { | 181 // class A : public GarbageCollected<A>, public GarbageCollectedMixin { |
182 // USING_GARBAGE_COLLECTED_MIXIN(A); | 182 // USING_GARBAGE_COLLECTED_MIXIN(A); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 #define GC_PLUGIN_IGNORE(bug) \ | 405 #define GC_PLUGIN_IGNORE(bug) \ |
406 __attribute__((annotate("blink_gc_plugin_ignore"))) | 406 __attribute__((annotate("blink_gc_plugin_ignore"))) |
407 #else | 407 #else |
408 #define STACK_ALLOCATED() DISALLOW_ALLOCATION() | 408 #define STACK_ALLOCATED() DISALLOW_ALLOCATION() |
409 #define GC_PLUGIN_IGNORE(bug) | 409 #define GC_PLUGIN_IGNORE(bug) |
410 #endif | 410 #endif |
411 | 411 |
412 } // namespace blink | 412 } // namespace blink |
413 | 413 |
414 #endif | 414 #endif |
OLD | NEW |