OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 WrapperVisitor_h | 5 #ifndef WrapperVisitor_h |
6 #define WrapperVisitor_h | 6 #define WrapperVisitor_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 USING_FAST_MALLOC(WrapperVisitor); | 90 USING_FAST_MALLOC(WrapperVisitor); |
91 public: | 91 public: |
92 template<typename T> | 92 template<typename T> |
93 void traceWrappers(const T* traceable) const | 93 void traceWrappers(const T* traceable) const |
94 { | 94 { |
95 static_assert(sizeof(T), "T must be fully defined"); | 95 static_assert(sizeof(T), "T must be fully defined"); |
96 | 96 |
97 if (!traceable) | 97 if (!traceable) |
98 return; | 98 return; |
99 | 99 |
100 TraceTrait<T>::markWrapper(this, traceable); | 100 if (TraceTrait<T>::heapObjectHeader(traceable)->isWrapperHeaderMarked()) |
| 101 return; |
| 102 |
| 103 pushToMarkingDeque( |
| 104 TraceTrait<T>::markWrapper, |
| 105 TraceTrait<T>::heapObjectHeader, |
| 106 traceable); |
101 } | 107 } |
102 | 108 |
103 template<typename T> | 109 template<typename T> |
104 void traceWrappers(const Member<T>& t) const | 110 void traceWrappers(const Member<T>& t) const |
105 { | 111 { |
106 traceWrappers(t.get()); | 112 traceWrappers(t.get()); |
107 } | 113 } |
108 | 114 |
109 virtual void traceWrappers(const ScopedPersistent<v8::Value>*) const = 0; | 115 virtual void traceWrappers(const ScopedPersistent<v8::Value>*) const = 0; |
110 | 116 |
111 virtual void dispatchTraceWrappers(const ScriptWrappable*) const = 0; | 117 virtual void dispatchTraceWrappers(const ScriptWrappable*) const = 0; |
112 #define DECLARE_DISPATCH_TRACE_WRAPPERS(className) \ | 118 #define DECLARE_DISPATCH_TRACE_WRAPPERS(className) \ |
113 virtual void dispatchTraceWrappers(const className*) const = 0; | 119 virtual void dispatchTraceWrappers(const className*) const = 0; |
114 | 120 |
115 WRAPPER_VISITOR_SPECIAL_CLASSES(DECLARE_DISPATCH_TRACE_WRAPPERS); | 121 WRAPPER_VISITOR_SPECIAL_CLASSES(DECLARE_DISPATCH_TRACE_WRAPPERS); |
116 | 122 |
117 #undef DECLARE_DISPATCH_TRACE_WRAPPERS | 123 #undef DECLARE_DISPATCH_TRACE_WRAPPERS |
118 virtual void dispatchTraceWrappers(const void*) const = 0; | 124 virtual void dispatchTraceWrappers(const void*) const = 0; |
119 | 125 |
120 virtual bool markWrapperHeader(const ScriptWrappable*) const = 0; | 126 virtual bool markWrapperHeader(HeapObjectHeader*) const = 0; |
121 virtual bool markWrapperHeader(const void*) const = 0; | 127 virtual void markWrappersInAllWorlds(const ScriptWrappable*) const = 0; |
| 128 virtual void markWrappersInAllWorlds(const void*) const = 0; |
| 129 virtual void pushToMarkingDeque( |
| 130 void (*traceWrappersCallback)(const WrapperVisitor*, const void*), |
| 131 HeapObjectHeader* (*heapObjectHeaderCallback)(const void*), |
| 132 const void*) const = 0; |
122 }; | 133 }; |
123 | 134 |
124 } // namespace blink | 135 } // namespace blink |
125 | 136 |
126 #endif // WrapperVisitor_h | 137 #endif // WrapperVisitor_h |
OLD | NEW |