OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef FINALIZE_AFTER_DISPATCH_H_ |
| 6 #define FINALIZE_AFTER_DISPATCH_H_ |
| 7 |
| 8 #include "heap/stubs.h" |
| 9 |
| 10 namespace WebCore { |
| 11 |
| 12 class NeedsFinalize : public GarbageCollectedFinalized<NeedsFinalize> { |
| 13 public: |
| 14 void trace(Visitor*); |
| 15 void traceAfterDispatch(Visitor*); |
| 16 // Needs a finalize dispatch method. |
| 17 }; |
| 18 |
| 19 class A : GarbageCollectedFinalized<A> { |
| 20 public: |
| 21 void trace(Visitor*); |
| 22 void traceAfterDispatch(Visitor*); |
| 23 void finalize(); |
| 24 protected: |
| 25 enum Type { TB, TC, TD }; |
| 26 A(Type type) : m_type(type) { } |
| 27 private: |
| 28 Type m_type; |
| 29 }; |
| 30 |
| 31 class B : public A { |
| 32 public: |
| 33 B() : A(TB) { } |
| 34 ~B() { } |
| 35 void traceAfterDispatch(Visitor*); |
| 36 private: |
| 37 Member<A> m_a; |
| 38 }; |
| 39 |
| 40 class C : public A { |
| 41 public: |
| 42 C() : A(TC) { } |
| 43 void traceAfterDispatch(Visitor*); |
| 44 private: |
| 45 Member<A> m_a; |
| 46 }; |
| 47 |
| 48 // This class is considered abstract does not need to be dispatched to. |
| 49 class Abstract : public A { |
| 50 protected: |
| 51 Abstract(Type type) : A(type) { } |
| 52 }; |
| 53 |
| 54 class D : public Abstract { |
| 55 public: |
| 56 D() : Abstract(TD) { } |
| 57 void traceAfterDispatch(Visitor*); |
| 58 private: |
| 59 Member<A> m_a; |
| 60 }; |
| 61 |
| 62 } |
| 63 |
| 64 #endif |
OLD | NEW |