| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef InlinedGlobalMarkingVisitor_h | 5 #ifndef InlinedGlobalMarkingVisitor_h |
| 6 #define InlinedGlobalMarkingVisitor_h | 6 #define InlinedGlobalMarkingVisitor_h |
| 7 | 7 |
| 8 #include "platform/heap/MarkingVisitorImpl.h" | 8 #include "platform/heap/MarkingVisitorImpl.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 inline void recordObjectGraphEdge(const void* objectPointer) | 68 inline void recordObjectGraphEdge(const void* objectPointer) |
| 69 { | 69 { |
| 70 m_visitor->recordObjectGraphEdge(objectPointer); | 70 m_visitor->recordObjectGraphEdge(objectPointer); |
| 71 } | 71 } |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 Visitor* m_visitor; | 75 Visitor* m_visitor; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // If T does not support trace(). |
| 79 template <typename T> |
| 80 struct TraceCompatibilityAdaptor<T, false, false> { |
| 81 inline static void trace(blink::Visitor*, T*) |
| 82 { |
| 83 } |
| 84 |
| 85 inline static void trace(InlinedGlobalMarkingVisitor, T*) |
| 86 { |
| 87 } |
| 88 }; |
| 89 |
| 78 // If T does not support trace(InlinedGlobalMarkingVisitor). | 90 // If T does not support trace(InlinedGlobalMarkingVisitor). |
| 79 template <typename T> | 91 template <typename T> |
| 80 struct TraceCompatibilityAdaptor<T, false> { | 92 struct TraceCompatibilityAdaptor<T, true, false> { |
| 81 inline static void trace(blink::Visitor* visitor, T* self) | 93 inline static void trace(blink::Visitor* visitor, T* self) |
| 82 { | 94 { |
| 83 self->trace(visitor); | 95 self->trace(visitor); |
| 84 } | 96 } |
| 85 | 97 |
| 86 inline static void trace(InlinedGlobalMarkingVisitor visitor, T* self) | 98 inline static void trace(InlinedGlobalMarkingVisitor visitor, T* self) |
| 87 { | 99 { |
| 88 // We revert to dynamic trace(Visitor*) for tracing T. | 100 // We revert to dynamic trace(Visitor*) for tracing T. |
| 89 self->trace(visitor.getUninlined()); | 101 self->trace(visitor.getUninlined()); |
| 90 } | 102 } |
| 91 }; | 103 }; |
| 92 | 104 |
| 93 // If T supports trace(InlinedGlobalMarkingVisitor). | 105 // If T supports trace(InlinedGlobalMarkingVisitor). |
| 94 template <typename T> | 106 template <typename T> |
| 95 struct TraceCompatibilityAdaptor<T, true> { | 107 struct TraceCompatibilityAdaptor<T, true, true> { |
| 96 inline static void trace(blink::Visitor* visitor, T* self) | 108 inline static void trace(blink::Visitor* visitor, T* self) |
| 97 { | 109 { |
| 98 if (visitor->isGlobalMarkingVisitor()) { | 110 if (visitor->isGlobalMarkingVisitor()) { |
| 99 // Switch to inlined global marking dispatch. | 111 // Switch to inlined global marking dispatch. |
| 100 self->trace(InlinedGlobalMarkingVisitor(visitor)); | 112 self->trace(InlinedGlobalMarkingVisitor(visitor)); |
| 101 } else { | 113 } else { |
| 102 self->trace(visitor); | 114 self->trace(visitor); |
| 103 } | 115 } |
| 104 } | 116 } |
| 105 | 117 |
| 106 inline static void trace(InlinedGlobalMarkingVisitor visitor, T* self) | 118 inline static void trace(InlinedGlobalMarkingVisitor visitor, T* self) |
| 107 { | 119 { |
| 108 self->trace(visitor); | 120 self->trace(visitor); |
| 109 } | 121 } |
| 110 }; | 122 }; |
| 111 | 123 |
| 112 } // namespace blink | 124 } // namespace blink |
| 113 | 125 |
| 114 #endif | 126 #endif |
| OLD | NEW |