Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: tools/clang/blink_gc_plugin/tests/class_requires_finalization_mixin.h

Issue 374593002: Support ignorance of base class finalizers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use early returns instead of fallthrough Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CLASS_REQUIRES_FINALIZATION_MIXIN_H_ 5 #ifndef CLASS_REQUIRES_FINALIZATION_MIXIN_H_
6 #define CLASS_REQUIRES_FINALIZATION_MIXIN_H_ 6 #define CLASS_REQUIRES_FINALIZATION_MIXIN_H_
7 7
8 #include "heap/stubs.h" 8 #include "heap/stubs.h"
9 9
10 namespace WebCore { 10 namespace WebCore {
11 11
12 class OffHeap : public RefCounted<OffHeap> { }; 12 class OffHeap : public RefCounted<OffHeap> { };
13 class OnHeap : public GarbageCollected<OnHeap> { }; 13 class OnHeap : public GarbageCollected<OnHeap> { };
14 14
15 class Mixin : public GarbageCollectedMixin { 15 class MixinFinalizable : public GarbageCollectedMixin {
16 public: 16 public:
17 void trace(Visitor*); 17 void trace(Visitor*);
18 private: 18 private:
19 RefPtr<OffHeap> m_offHeap; // Requires finalization 19 RefPtr<OffHeap> m_offHeap; // Requires finalization
20 Member<OnHeap> m_onHeap; 20 Member<OnHeap> m_onHeap;
21 }; 21 };
22 22
23 class NeedsFinalizer : public GarbageCollected<NeedsFinalizer>, public Mixin { 23 class MixinNotFinalizable : public GarbageCollectedMixin {
24 public:
25 void trace(Visitor*);
26 private:
27 Member<OnHeap> m_onHeap;
28 };
29
30 class NeedsFinalizer
31 : public GarbageCollected<NeedsFinalizer>
32 , public MixinFinalizable {
24 USING_GARBAGE_COLLECTED_MIXIN(NeedsFinalizer); 33 USING_GARBAGE_COLLECTED_MIXIN(NeedsFinalizer);
25 public: 34 public:
26 void trace(Visitor*); 35 void trace(Visitor*);
27 private: 36 private:
28 Member<OnHeap> m_obj; 37 Member<OnHeap> m_obj;
29 }; 38 };
30 39
31 class HasFinalizer : public GarbageCollectedFinalized<HasFinalizer>, 40 class HasFinalizer : public GarbageCollectedFinalized<HasFinalizer>,
32 public Mixin { 41 public MixinFinalizable {
33 USING_GARBAGE_COLLECTED_MIXIN(HasFinalizer); 42 USING_GARBAGE_COLLECTED_MIXIN(HasFinalizer);
34 public: 43 public:
35 void trace(Visitor*); 44 void trace(Visitor*);
36 private: 45 private:
37 Member<OnHeap> m_obj; 46 Member<OnHeap> m_obj;
38 }; 47 };
39 48
49 class NeedsNoFinalization
50 : public GarbageCollected<NeedsNoFinalization>
51 , public MixinNotFinalizable
52 , public ScriptWrappable {
53 USING_GARBAGE_COLLECTED_MIXIN(NeedsNoFinalization);
54 public:
55 void trace(Visitor*);
56 private:
57 Member<OnHeap> m_obj;
58 };
59
40 } 60 }
41 61
42 #endif 62 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698