Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / register_weak_members_template.h
blob7d3905a51df2b02663e69f6f64777d3c0d5d2988
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"
10 namespace blink {
12 class X : public GarbageCollected<X> {
13 public:
14 void trace(Visitor* visitor) { traceImpl(visitor); }
15 void trace(InlinedGlobalMarkingVisitor visitor) { traceImpl(visitor); }
17 private:
18 template <typename VisitorDispatcher>
19 void traceImpl(VisitorDispatcher visitor) {}
22 class HasUntracedWeakMembers : public GarbageCollected<HasUntracedWeakMembers> {
23 public:
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);
30 private:
31 template <typename VisitorDispatcher>
32 void traceImpl(VisitorDispatcher visitor) {
33 visitor->template registerWeakMembers<
34 HasUntracedWeakMembers,
35 &HasUntracedWeakMembers::clearWeakMembers>(this);
38 WeakMember<X> x_;
43 #endif // REGISTER_WEAK_MEMBERS_TEMPLATE_H_