Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / class_requires_finalization_mixin.h
blob929785d7ad04fe23a62afcf67f5d3bd145e950a5
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
3 // found in the LICENSE file.
5 #ifndef CLASS_REQUIRES_FINALIZATION_MIXIN_H_
6 #define CLASS_REQUIRES_FINALIZATION_MIXIN_H_
8 #include "heap/stubs.h"
10 namespace blink {
12 class OffHeap : public RefCounted<OffHeap> { };
13 class OnHeap : public GarbageCollected<OnHeap> { };
15 class MixinFinalizable : public GarbageCollectedMixin {
16 public:
17 virtual void trace(Visitor*) override;
18 private:
19 RefPtr<OffHeap> m_offHeap; // Requires finalization
20 Member<OnHeap> m_onHeap;
23 class MixinNotFinalizable : public GarbageCollectedMixin {
24 public:
25 virtual void trace(Visitor*) override;
26 private:
27 Member<OnHeap> m_onHeap;
30 class NeedsFinalizer
31 : public GarbageCollected<NeedsFinalizer>
32 , public MixinFinalizable {
33 USING_GARBAGE_COLLECTED_MIXIN(NeedsFinalizer);
34 public:
35 virtual void trace(Visitor*) override;
36 private:
37 Member<OnHeap> m_obj;
40 class HasFinalizer : public GarbageCollectedFinalized<HasFinalizer>,
41 public MixinFinalizable {
42 USING_GARBAGE_COLLECTED_MIXIN(HasFinalizer);
43 public:
44 virtual void trace(Visitor*) override;
45 private:
46 Member<OnHeap> m_obj;
49 class NeedsNoFinalization
50 : public GarbageCollected<NeedsNoFinalization>
51 , public MixinNotFinalizable
52 , public ScriptWrappable {
53 USING_GARBAGE_COLLECTED_MIXIN(NeedsNoFinalization);
54 public:
55 virtual void trace(Visitor*) override;
56 private:
57 Member<OnHeap> m_obj;
62 #endif