aboutsummaryrefslogtreecommitdiff
path: root/tools/clang/blink_gc_plugin/tests/legacy_naming/destructor_eagerly_finalized.h
blob: 77a29dea097bdeeac02b11ec22f1d81147ee130b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef DESTRUCTOR_EAGERLY_FINALIZED_H_
#define DESTRUCTOR_EAGERLY_FINALIZED_H_

#include "heap/stubs.h"

namespace blink {

class HeapObject : public GarbageCollected<HeapObject> {
public:
    void trace(Visitor*) { }
    void foo() { }
};

class HeapObjectEagerFinalized
    : public GarbageCollectedFinalized<HeapObjectEagerFinalized> {
public:
    EAGERLY_FINALIZED();
    ~HeapObjectEagerFinalized();
    void trace(Visitor*);

    void foo() { }

private:
    Member<HeapObject> m_obj;
};

// Accessing other eagerly finalized objects during finalization is not allowed.
class HeapObjectEagerFinalizedAlso
    : public GarbageCollectedFinalized<HeapObjectEagerFinalizedAlso> {
public:
    EAGERLY_FINALIZED();
    ~HeapObjectEagerFinalizedAlso();
    void trace(Visitor*);

private:
    Member<HeapObject> m_heapObject;
    Member<HeapObjectEagerFinalized> m_heapObjectFinalized;
    HeapVector<Member<HeapObjectEagerFinalized>> m_heapVector;
};

} // namespace blink

#endif // DESTRUCTOR_EAGERLY_FINALIZED_H_