Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_BASE_H_ | 5 #ifndef CLASS_REQUIRES_FINALIZATION_BASE_H_ |
| 6 #define CLASS_REQUIRES_FINALIZATION_BASE_H_ | 6 #define CLASS_REQUIRES_FINALIZATION_BASE_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 A : public GarbageCollected<A> { | 12 class A : public GarbageCollected<A> { |
| 13 public: | 13 public: |
| 14 virtual void trace(Visitor*) {} | 14 virtual void trace(Visitor*) {} |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 class B { | 17 class B { |
| 18 public: | 18 public: |
| 19 ~B() { /* user-declared, thus, non-trivial */ } | 19 ~B() { /* user-declared, thus, non-trivial */ } |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 // WebCore::ScriptWrappable receives special treatment | |
| 23 // so as to allow it to be used together with GarbageCollected<T>, | |
| 24 // even when its user-declared destructor is provided. | |
| 25 // As it is with Oilpan disabled. | |
| 26 class ScriptWrappable { | |
|
zerny-chromium
2014/07/08 07:45:03
Define ScriptWrappable in heap/stubs.h
That shoul
sof
2014/07/08 08:47:05
Done.
| |
| 27 public: | |
| 28 ~ScriptWrappable() { /* user-declared, thus, non-trivial */ } | |
| 29 }; | |
| 30 | |
| 22 // Second base class needs finalization. | 31 // Second base class needs finalization. |
| 23 class NeedsFinalizer : public A, public B { | 32 class NeedsFinalizer : public A, public B { |
| 24 public: | 33 public: |
| 25 void trace(Visitor*); | 34 void trace(Visitor*); |
| 26 }; | 35 }; |
| 27 | 36 |
| 28 // Base does not need finalization. | 37 // Base does not need finalization. |
| 29 class DoesNotNeedFinalizer : public A { | 38 class DoesNotNeedFinalizer : public A { |
| 30 public: | 39 public: |
| 31 void trace(Visitor*); | 40 void trace(Visitor*); |
| 32 }; | 41 }; |
| 33 | 42 |
| 43 class GCedClassWithAScriptWrappableBase | |
| 44 : public A, public ScriptWrappable { | |
| 45 public: | |
| 46 void trace(Visitor*); | |
| 47 }; | |
| 48 | |
| 49 class GCedClassWithAScriptWrappableAndAFinalizableBase | |
| 50 : public GCedClassWithAScriptWrappableBase | |
| 51 , public B | |
| 52 , public ScriptWrappable { | |
| 53 public: | |
| 54 void trace(Visitor*); | |
| 55 }; | |
| 56 | |
| 34 } | 57 } |
| 35 | 58 |
| 36 #endif | 59 #endif |
| OLD | NEW |