1 // Copyright 2015 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.
5 #ifndef REGISTER_WEAK_MEMBERS_TEMPLATE_H_
6 #define REGISTER_WEAK_MEMBERS_TEMPLATE_H_
8 #include "heap/stubs.h"
12 class X
: public GarbageCollected
<X
> {
14 void trace(Visitor
* visitor
) { traceImpl(visitor
); }
15 void trace(InlinedGlobalMarkingVisitor visitor
) { traceImpl(visitor
); }
18 template <typename VisitorDispatcher
>
19 void traceImpl(VisitorDispatcher visitor
) {}
22 class HasUntracedWeakMembers
: public GarbageCollected
<HasUntracedWeakMembers
> {
24 void trace(Visitor
* visitor
) { traceImpl(visitor
); }
25 void trace(InlinedGlobalMarkingVisitor visitor
) { traceImpl(visitor
); }
27 // Don't have to be defined for the purpose of this test.
28 void clearWeakMembers(Visitor
* visitor
);
31 template <typename VisitorDispatcher
>
32 void traceImpl(VisitorDispatcher visitor
) {
33 visitor
->template registerWeakMembers
<
34 HasUntracedWeakMembers
,
35 &HasUntracedWeakMembers::clearWeakMembers
>(this);
43 #endif // REGISTER_WEAK_MEMBERS_TEMPLATE_H_