traceimpl.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2014 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. #ifndef TRACEIMPL_H_
  5. #define TRACEIMPL_H_
  6. #include "heap/stubs.h"
  7. namespace blink {
  8. class X : public GarbageCollected<X> {
  9. public:
  10. virtual void Trace(Visitor*) const {}
  11. };
  12. class TraceImplInlined : public GarbageCollected<TraceImplInlined> {
  13. public:
  14. void Trace(Visitor* visitor) const { visitor->Trace(x_); }
  15. private:
  16. Member<X> x_;
  17. };
  18. class TraceImplExtern : public GarbageCollected<TraceImplExtern> {
  19. public:
  20. void Trace(Visitor* visitor) const;
  21. private:
  22. Member<X> x_;
  23. };
  24. class Base : public GarbageCollected<Base> {
  25. public:
  26. virtual void Trace(Visitor* visitor) const {}
  27. };
  28. class TraceImplBaseInlined : public Base {
  29. public:
  30. void Trace(Visitor* visitor) const override { Base::Trace(visitor); }
  31. };
  32. class TraceImplBaseExtern : public Base {
  33. public:
  34. void Trace(Visitor* visitor) const override;
  35. private:
  36. Member<X> x_;
  37. };
  38. }
  39. #endif