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

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: Reworked, static check now expressed by RecordInfo::NeedsFinalization() 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 // WebCore::ScriptWrappable receives special treatment
16 // so as to allow it to be used together with GarbageCollected<T>,
17 // even when its user-declared destructor is provided.
18 // As it is with Oilpan disabled.
19 class ScriptWrappable {
20 public:
21 ~ScriptWrappable() { /* user-declared, thus, non-trivial */ }
22 };
23
24 class MixinFinalizable : public GarbageCollectedMixin {
16 public: 25 public:
17 void trace(Visitor*); 26 void trace(Visitor*);
18 private: 27 private:
19 RefPtr<OffHeap> m_offHeap; // Requires finalization 28 RefPtr<OffHeap> m_offHeap; // Requires finalization
20 Member<OnHeap> m_onHeap; 29 Member<OnHeap> m_onHeap;
21 }; 30 };
22 31
23 class NeedsFinalizer : public GarbageCollected<NeedsFinalizer>, public Mixin { 32 class MixinNotFinalizable : public GarbageCollectedMixin {
33 public:
34 void trace(Visitor*);
35 private:
36 Member<OnHeap> m_onHeap;
37 };
38
39 class NeedsFinalizer
40 : public GarbageCollected<NeedsFinalizer>
41 , public MixinFinalizable {
24 USING_GARBAGE_COLLECTED_MIXIN(NeedsFinalizer); 42 USING_GARBAGE_COLLECTED_MIXIN(NeedsFinalizer);
25 public: 43 public:
26 void trace(Visitor*); 44 void trace(Visitor*);
27 private: 45 private:
28 Member<OnHeap> m_obj; 46 Member<OnHeap> m_obj;
29 }; 47 };
30 48
31 class HasFinalizer : public GarbageCollectedFinalized<HasFinalizer>, 49 class HasFinalizer : public GarbageCollectedFinalized<HasFinalizer>,
32 public Mixin { 50 public MixinFinalizable {
33 USING_GARBAGE_COLLECTED_MIXIN(HasFinalizer); 51 USING_GARBAGE_COLLECTED_MIXIN(HasFinalizer);
34 public: 52 public:
35 void trace(Visitor*); 53 void trace(Visitor*);
36 private: 54 private:
37 Member<OnHeap> m_obj; 55 Member<OnHeap> m_obj;
38 }; 56 };
39 57
58 class NeedsNoFinalization
59 : public GarbageCollected<HasFinalizer>
zerny-chromium 2014/07/08 07:45:03 GarbageCollected<NeedsNoFinalization>
sof 2014/07/08 08:47:05 Done.
60 , public MixinNotFinalizable
61 , public ScriptWrappable {
62 USING_GARBAGE_COLLECTED_MIXIN(NeedsNoFinalization);
63 public:
64 void trace(Visitor*);
65 private:
66 Member<OnHeap> m_obj;
67 };
68
40 } 69 }
41 70
42 #endif 71 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698