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 CLASS_REQUIRES_FINALIZATION_H_ | |
6 #define CLASS_REQUIRES_FINALIZATION_H_ | |
7 | |
8 #include "heap/stubs.h" | |
9 | |
10 namespace WebCore { | |
11 | |
12 class A : public GarbageCollected<A> { | |
13 public: | |
14 virtual void trace(Visitor*) {} | |
15 }; | |
16 | |
17 class B { | |
18 public: | |
19 ~B() { /* user-declared, thus, non-trivial */ } | |
20 }; | |
21 | |
22 // Off-heap vectors always need to be finalized. | |
23 class NeedsFinalizer : public A { | |
24 public: | |
25 void trace(Visitor*); | |
26 private: | |
27 Vector<Member<A> > m_as; | |
28 }; | |
29 | |
30 // On-heap vectors with inlined objects that need destruction | |
31 // need to be finalized. | |
32 class AlsoNeedsFinalizer : public A { | |
33 public: | |
34 void trace(Visitor*); | |
35 private: | |
36 HeapVector<B, 10> m_bs; | |
37 }; | |
38 | |
39 // On-heap vectors with no inlined objects never need to be finalized. | |
40 class DoesNotNeedFinalizer : public A { | |
41 public: | |
42 void trace(Visitor*); | |
43 private: | |
44 HeapVector<B> m_bs; | |
45 }; | |
46 | |
47 // On-heap vectors with inlined objects that don't need destruction | |
48 // don't need to be finalized. | |
49 class AlsoDoesNotNeedFinalizer : public A { | |
50 public: | |
51 void trace(Visitor*); | |
52 private: | |
53 HeapVector<Member<A>, 10> m_as; | |
Vyacheslav Egorov (Chromium)
2014/03/12 18:24:24
What about
class C {
public:
void trace(Visito
zerny-chromium
2014/03/13 09:32:22
Done.
| |
54 }; | |
55 | |
56 } | |
57 | |
58 #endif | |
OLD | NEW |