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 pushToMarkingDeque( |
haraken
2016/06/20 11:10:38
Won't this regress performance?
Marcel Hlopko
2016/06/20 11:29:13
Good point! Added check for wrapperHeaderMark. I c
| |
101 TraceTrait<T>::markWrapper, | |
102 TraceTrait<T>::heapObjectHeader, | |
103 traceable); | |
101 } | 104 } |
102 | 105 |
103 template<typename T> | 106 template<typename T> |
104 void traceWrappers(const Member<T>& t) const | 107 void traceWrappers(const Member<T>& t) const |
105 { | 108 { |
106 traceWrappers(t.get()); | 109 traceWrappers(t.get()); |
107 } | 110 } |
108 | 111 |
109 virtual void traceWrappers(const ScopedPersistent<v8::Value>*) const = 0; | 112 virtual void traceWrappers(const ScopedPersistent<v8::Value>*) const = 0; |
110 | 113 |
111 virtual void dispatchTraceWrappers(const ScriptWrappable*) const = 0; | 114 virtual void dispatchTraceWrappers(const ScriptWrappable*) const = 0; |
112 #define DECLARE_DISPATCH_TRACE_WRAPPERS(className) \ | 115 #define DECLARE_DISPATCH_TRACE_WRAPPERS(className) \ |
113 virtual void dispatchTraceWrappers(const className*) const = 0; | 116 virtual void dispatchTraceWrappers(const className*) const = 0; |
114 | 117 |
115 WRAPPER_VISITOR_SPECIAL_CLASSES(DECLARE_DISPATCH_TRACE_WRAPPERS); | 118 WRAPPER_VISITOR_SPECIAL_CLASSES(DECLARE_DISPATCH_TRACE_WRAPPERS); |
116 | 119 |
117 #undef DECLARE_DISPATCH_TRACE_WRAPPERS | 120 #undef DECLARE_DISPATCH_TRACE_WRAPPERS |
118 virtual void dispatchTraceWrappers(const void*) const = 0; | 121 virtual void dispatchTraceWrappers(const void*) const = 0; |
119 | 122 |
120 virtual bool markWrapperHeader(const ScriptWrappable*) const = 0; | 123 virtual bool markWrapperHeader(HeapObjectHeader*) const = 0; |
121 virtual bool markWrapperHeader(const void*) const = 0; | 124 virtual void markWrappersInAllWorlds(const ScriptWrappable*) const = 0; |
125 virtual void markWrappersInAllWorlds(const void*) const = 0; | |
126 virtual void pushToMarkingDeque( | |
127 void (*traceWrappersCallback)(const WrapperVisitor*, const void*), | |
128 HeapObjectHeader* (*heapObjectHeaderCallback)(const void*), | |
129 const void*) const = 0; | |
122 }; | 130 }; |
123 | 131 |
124 } // namespace blink | 132 } // namespace blink |
125 | 133 |
126 #endif // WrapperVisitor_h | 134 #endif // WrapperVisitor_h |
OLD | NEW |