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_H_ | 5 #ifndef CLASS_REQUIRES_FINALIZATION_H_ |
6 #define CLASS_REQUIRES_FINALIZATION_H_ | 6 #define CLASS_REQUIRES_FINALIZATION_H_ |
7 | 7 |
8 #include "heap/stubs.h" | 8 #include "heap/stubs.h" |
9 | 9 |
10 namespace WebCore { | 10 namespace blink { |
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 // Has a non-trivial dtor (user-declared). | 17 // Has a non-trivial dtor (user-declared). |
18 class B { | 18 class B { |
19 public: | 19 public: |
20 ~B() { } | 20 ~B() { } |
21 void trace(Visitor*) { }; | 21 void trace(Visitor*) { }; |
22 }; | 22 }; |
23 | 23 |
24 // Has a trivial dtor. | 24 // Has a trivial dtor. |
25 class C { | 25 class C { |
26 public: | 26 public: |
27 void trace(Visitor*) { }; | 27 void trace(Visitor*) { }; |
28 }; | 28 }; |
29 | 29 |
30 } // WebCore namespace | 30 } // blink namespace |
31 | 31 |
32 namespace WTF { | 32 namespace WTF { |
33 | 33 |
34 template<> | 34 template<> |
35 struct VectorTraits<WebCore::C> { | 35 struct VectorTraits<blink::C> { |
36 static const bool needsDestruction = false; | 36 static const bool needsDestruction = false; |
37 }; | 37 }; |
38 | 38 |
39 } // WTF namespace | 39 } // WTF namespace |
40 | 40 |
41 namespace WebCore { | 41 namespace blink { |
42 | 42 |
43 // Off-heap vectors always need to be finalized. | 43 // Off-heap vectors always need to be finalized. |
44 class NeedsFinalizer : public A, public ScriptWrappable { | 44 class NeedsFinalizer : public A, public ScriptWrappable { |
45 public: | 45 public: |
46 void trace(Visitor*); | 46 void trace(Visitor*); |
47 private: | 47 private: |
48 Vector<Member<A> > m_as; | 48 Vector<Member<A> > m_as; |
49 }; | 49 }; |
50 | 50 |
51 // On-heap vectors with inlined objects that need destruction | 51 // On-heap vectors with inlined objects that need destruction |
(...skipping 19 matching lines...) Expand all Loading... |
71 public: | 71 public: |
72 void trace(Visitor*); | 72 void trace(Visitor*); |
73 private: | 73 private: |
74 HeapVector<Member<A>, 10> m_as; | 74 HeapVector<Member<A>, 10> m_as; |
75 HeapVector<C, 10> m_cs; | 75 HeapVector<C, 10> m_cs; |
76 }; | 76 }; |
77 | 77 |
78 } | 78 } |
79 | 79 |
80 #endif | 80 #endif |
OLD | NEW |