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 DESTRUCTOR_EAGERLY_FINALIZED_H_ | 5 #ifndef DESTRUCTOR_EAGERLY_FINALIZED_H_ |
6 #define DESTRUCTOR_EAGERLY_FINALIZED_H_ | 6 #define DESTRUCTOR_EAGERLY_FINALIZED_H_ |
7 | 7 |
8 #include "heap/stubs.h" | 8 #include "heap/stubs.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class HeapObject : public GarbageCollected<HeapObject> { | 12 class HeapObject : public GarbageCollected<HeapObject> { |
13 public: | 13 public: |
14 void trace(Visitor*) { } | 14 void Trace(Visitor*) { } |
15 void foo() { } | 15 void foo() { } |
16 }; | 16 }; |
17 | 17 |
18 class HeapObjectEagerFinalized | 18 class HeapObjectEagerFinalized |
19 : public GarbageCollectedFinalized<HeapObjectEagerFinalized> { | 19 : public GarbageCollectedFinalized<HeapObjectEagerFinalized> { |
20 public: | 20 public: |
21 EAGERLY_FINALIZED(); | 21 EAGERLY_FINALIZED(); |
22 ~HeapObjectEagerFinalized(); | 22 ~HeapObjectEagerFinalized(); |
23 void trace(Visitor*); | 23 void Trace(Visitor*); |
24 | 24 |
25 void foo() { } | 25 void foo() { } |
26 | 26 |
27 private: | 27 private: |
28 Member<HeapObject> m_obj; | 28 Member<HeapObject> m_obj; |
29 }; | 29 }; |
30 | 30 |
31 // Accessing other eagerly finalized objects during finalization is not allowed. | 31 // Accessing other eagerly finalized objects during finalization is not allowed. |
32 class HeapObjectEagerFinalizedAlso | 32 class HeapObjectEagerFinalizedAlso |
33 : public GarbageCollectedFinalized<HeapObjectEagerFinalizedAlso> { | 33 : public GarbageCollectedFinalized<HeapObjectEagerFinalizedAlso> { |
34 public: | 34 public: |
35 EAGERLY_FINALIZED(); | 35 EAGERLY_FINALIZED(); |
36 ~HeapObjectEagerFinalizedAlso(); | 36 ~HeapObjectEagerFinalizedAlso(); |
37 void trace(Visitor*); | 37 void Trace(Visitor*); |
38 | 38 |
39 private: | 39 private: |
40 Member<HeapObject> m_heapObject; | 40 Member<HeapObject> m_heapObject; |
41 Member<HeapObjectEagerFinalized> m_heapObjectFinalized; | 41 Member<HeapObjectEagerFinalized> m_heapObjectFinalized; |
42 HeapVector<Member<HeapObjectEagerFinalized>> m_heapVector; | 42 HeapVector<Member<HeapObjectEagerFinalized>> m_heapVector; |
43 }; | 43 }; |
44 | 44 |
45 } // namespace blink | 45 } // namespace blink |
46 | 46 |
47 #endif // DESTRUCTOR_EAGERLY_FINALIZED_H_ | 47 #endif // DESTRUCTOR_EAGERLY_FINALIZED_H_ |
OLD | NEW |