| OLD | NEW |
| (Empty) |
| 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 | |
| 5 #ifndef InlinedGlobalMarkingVisitor_h | |
| 6 #define InlinedGlobalMarkingVisitor_h | |
| 7 | |
| 8 #include "platform/heap/MarkingVisitorImpl.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 class InlinedGlobalMarkingVisitor final | |
| 13 : public VisitorHelper<InlinedGlobalMarkingVisitor>, | |
| 14 public MarkingVisitorImpl<InlinedGlobalMarkingVisitor> { | |
| 15 public: | |
| 16 friend class VisitorHelper<InlinedGlobalMarkingVisitor>; | |
| 17 using Helper = VisitorHelper<InlinedGlobalMarkingVisitor>; | |
| 18 friend class MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; | |
| 19 using Impl = MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; | |
| 20 | |
| 21 InlinedGlobalMarkingVisitor(ThreadState* state, | |
| 22 VisitorMarkingMode markingMode) | |
| 23 : VisitorHelper(state, markingMode) {} | |
| 24 | |
| 25 // Hack to unify interface to visitor->trace(). | |
| 26 // Without this hack, we need to use visitor.trace() for | |
| 27 // trace(InlinedGlobalMarkingVisitor) and visitor->trace() for | |
| 28 // trace(Visitor*). | |
| 29 InlinedGlobalMarkingVisitor* operator->() { return this; } | |
| 30 | |
| 31 using Impl::mark; | |
| 32 using Impl::ensureMarked; | |
| 33 using Impl::registerDelayedMarkNoTracing; | |
| 34 using Impl::registerWeakTable; | |
| 35 using Impl::registerWeakMembers; | |
| 36 #if DCHECK_IS_ON() | |
| 37 using Impl::weakTableRegistered; | |
| 38 #endif | |
| 39 | |
| 40 template <typename T> | |
| 41 void mark(T* t) { | |
| 42 Helper::mark(t); | |
| 43 } | |
| 44 | |
| 45 template <typename T, void (T::*method)(Visitor*)> | |
| 46 void registerWeakMembers(const T* obj) { | |
| 47 Helper::template registerWeakMembers<T, method>(obj); | |
| 48 } | |
| 49 | |
| 50 private: | |
| 51 static InlinedGlobalMarkingVisitor fromHelper(Helper* helper) { | |
| 52 return *static_cast<InlinedGlobalMarkingVisitor*>(helper); | |
| 53 } | |
| 54 }; | |
| 55 | |
| 56 inline void GarbageCollectedMixin::trace(InlinedGlobalMarkingVisitor) {} | |
| 57 | |
| 58 } // namespace blink | |
| 59 | |
| 60 #endif | |
| OLD | NEW |