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.
4 
5 #ifndef TRACEIMPL_ERROR_H_
6 #define TRACEIMPL_ERROR_H_
7 
8 #include "heap/stubs.h"
9 
10 namespace blink {
11 
12 class X : public GarbageCollected<X> {
13  public:
trace(Visitor *)14   virtual void trace(Visitor*) {}
15 };
16 
17 class TraceImplInlinedWithUntracedMember
18     : public GarbageCollected<TraceImplInlinedWithUntracedMember> {
19  public:
trace(Visitor * visitor)20   void trace(Visitor* visitor) { traceImpl(visitor); }
21 
22   template <typename VisitorDispatcher>
traceImpl(VisitorDispatcher visitor)23   void traceImpl(VisitorDispatcher visitor) {
24     // Empty; should get complaints from the plugin for untraced x_.
25   }
26 
27  private:
28   Member<X> x_;
29 };
30 
31 class TraceImplExternWithUntracedMember
32     : public GarbageCollected<TraceImplExternWithUntracedMember> {
33  public:
34   void trace(Visitor* visitor);
35 
36   template <typename VisitorDispatcher>
37   inline void traceImpl(VisitorDispatcher);
38 
39  private:
40   Member<X> x_;
41 };
42 
43 class Base : public GarbageCollected<Base> {
44  public:
trace(Visitor *)45   virtual void trace(Visitor*) {}
46 };
47 
48 class TraceImplInlineWithUntracedBase : public Base {
49  public:
trace(Visitor * visitor)50   void trace(Visitor* visitor) override { traceImpl(visitor); }
51 
52   template <typename VisitorDispatcher>
traceImpl(VisitorDispatcher visitor)53   void traceImpl(VisitorDispatcher visitor) {
54     // Empty; should get complaints from the plugin for untraced Base.
55   }
56 };
57 
58 class TraceImplExternWithUntracedBase : public Base {
59  public:
60   void trace(Visitor*) override;
61 
62   template <typename VisitorDispatcher>
63   void traceImpl(VisitorDispatcher visitor);
64 };
65 
66 }
67 
68 #endif  // TRACEIMPL_ERROR_H_
69