Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / tests / traceimpl_dependent_scope.h
blob0d079f6f95925330f3303820337df05bc4e0d9c5
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 TRACEIMPL_DEPENDENT_SCOPE_H_
6 #define TRACEIMPL_DEPENDENT_SCOPE_H_
8 #include "heap/stubs.h"
10 namespace blink {
12 class X : public GarbageCollected<X> {
13 public:
14 virtual void trace(Visitor*) {}
17 template <typename T>
18 class Base : public GarbageCollected<Base<T> > {
19 public:
20 virtual void trace(Visitor* visitor) { traceImpl(visitor); }
21 virtual void trace(InlinedGlobalMarkingVisitor visitor) {
22 traceImpl(visitor);
25 private:
26 template <typename VisitorDispatcher>
27 void traceImpl(VisitorDispatcher visitor) {}
30 template <typename T>
31 class Derived : public Base<T> {
32 public:
33 void trace(Visitor* visitor) override { traceImpl(visitor); }
34 void trace(InlinedGlobalMarkingVisitor visitor) override {
35 traceImpl(visitor);
38 private:
39 template <typename VisitorDispatcher>
40 void traceImpl(VisitorDispatcher visitor) {
41 Base<T>::trace(visitor);
45 template <typename T>
46 class DerivedMissingTrace : public Base<T> {
47 public:
48 void trace(Visitor* visitor) override { traceImpl(visitor); }
49 void trace(InlinedGlobalMarkingVisitor visitor) override {
50 traceImpl(visitor);
53 private:
54 template <typename VisitorDispatcher>
55 void traceImpl(VisitorDispatcher visitor) {
56 // Missing Base<T>::trace(visitor).
62 #endif // TRACEIMPL_DEPENDENT_SCOPE_H_