Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / finalize_after_dispatch.h
blobacd16ec6c46ca6204bc4f27b5e9b5f011401d41a
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 FINALIZE_AFTER_DISPATCH_H_
6 #define FINALIZE_AFTER_DISPATCH_H_
8 #include "heap/stubs.h"
10 namespace blink {
12 class NeedsFinalize : public GarbageCollectedFinalized<NeedsFinalize> {
13 public:
14 void trace(Visitor*);
15 void traceAfterDispatch(Visitor*);
16 // Needs a finalizeGarbageCollectedObject method.
19 class NeedsDispatch : public GarbageCollectedFinalized<NeedsDispatch> {
20 public:
21 void trace(Visitor*);
22 // Needs a traceAfterDispatch method.
23 void finalizeGarbageCollectedObject() { };
26 class NeedsFinalizedBase : public GarbageCollected<NeedsFinalizedBase> {
27 public:
28 void trace(Visitor*) { };
29 void traceAfterDispatch(Visitor*) { };
30 void finalizeGarbageCollectedObject() { };
33 class A : GarbageCollectedFinalized<A> {
34 public:
35 void trace(Visitor*);
36 void traceAfterDispatch(Visitor*);
37 void finalizeGarbageCollectedObject();
38 protected:
39 enum Type { TB, TC, TD };
40 A(Type type) : m_type(type) { }
41 private:
42 Type m_type;
45 class B : public A {
46 public:
47 B() : A(TB) { }
48 ~B() { }
49 void traceAfterDispatch(Visitor*);
50 private:
51 Member<A> m_a;
54 class C : public A {
55 public:
56 C() : A(TC) { }
57 void traceAfterDispatch(Visitor*);
58 private:
59 Member<A> m_a;
62 // This class is considered abstract does not need to be dispatched to.
63 class Abstract : public A {
64 protected:
65 Abstract(Type type) : A(type) { }
68 class D : public Abstract {
69 public:
70 D() : Abstract(TD) { }
71 void traceAfterDispatch(Visitor*);
72 private:
73 Member<A> m_a;
78 #endif