| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 HeapAllocator_h | 5 #ifndef HeapAllocator_h |
| 6 #define HeapAllocator_h | 6 #define HeapAllocator_h |
| 7 | 7 |
| 8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
| 9 #include "platform/heap/Persistent.h" | 9 #include "platform/heap/Persistent.h" |
| 10 #include "platform/heap/TraceTraits.h" | 10 #include "platform/heap/TraceTraits.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 visitor->markNoTracing(t); | 150 visitor->markNoTracing(t); |
| 151 } | 151 } |
| 152 | 152 |
| 153 template <typename VisitorDispatcher, typename T, typename Traits> | 153 template <typename VisitorDispatcher, typename T, typename Traits> |
| 154 static void trace(VisitorDispatcher visitor, T& t) { | 154 static void trace(VisitorDispatcher visitor, T& t) { |
| 155 TraceCollectionIfEnabled<WTF::IsTraceableInCollectionTrait<Traits>::value, | 155 TraceCollectionIfEnabled<WTF::IsTraceableInCollectionTrait<Traits>::value, |
| 156 Traits::weakHandlingFlag, WTF::WeakPointersActWeak, | 156 Traits::weakHandlingFlag, WTF::WeakPointersActWeak, |
| 157 T, Traits>::trace(visitor, t); | 157 T, Traits>::trace(visitor, t); |
| 158 } | 158 } |
| 159 | 159 |
| 160 template <typename VisitorDispatcher> | 160 template <typename T, typename VisitorDispatcher> |
| 161 static void registerDelayedMarkNoTracing(VisitorDispatcher visitor, | 161 static void registerDelayedMarkNoTracing(VisitorDispatcher visitor, |
| 162 const void* object) { | 162 T** object) { |
| 163 visitor->registerDelayedMarkNoTracing(object); | 163 visitor->registerDelayedMarkNoTracing(reinterpret_cast<void**>(object)); |
| 164 } | 164 } |
| 165 | 165 |
| 166 template <typename VisitorDispatcher> | 166 template <typename VisitorDispatcher> |
| 167 static void registerWeakMembers(VisitorDispatcher visitor, | 167 static void registerWeakMembers(VisitorDispatcher visitor, |
| 168 const void* closure, | 168 const void* closure, |
| 169 const void* object, | 169 const void* object, |
| 170 WeakCallback callback) { | 170 WeakCallback callback) { |
| 171 visitor->registerWeakMembers(closure, object, callback); | 171 visitor->registerWeakMembers(closure, object, callback); |
| 172 } | 172 } |
| 173 | 173 |
| 174 template <typename VisitorDispatcher> | 174 template <typename VisitorDispatcher> |
| 175 static void registerWeakTable(VisitorDispatcher visitor, | 175 static void registerWeakTable(VisitorDispatcher visitor, |
| 176 const void* closure, | 176 const void* closure, |
| 177 EphemeronCallback iterationCallback, | 177 EphemeronCallback iterationCallback, |
| 178 EphemeronCallback iterationDoneCallback) { | 178 EphemeronCallback iterationDoneCallback) { |
| 179 visitor->registerWeakTable(closure, iterationCallback, | 179 visitor->registerWeakTable(closure, iterationCallback, |
| 180 iterationDoneCallback); | 180 iterationDoneCallback); |
| 181 } | 181 } |
| 182 | 182 |
| 183 #if ENABLE(ASSERT) | 183 #if ENABLE(ASSERT) |
| 184 template <typename VisitorDispatcher> | 184 template <typename VisitorDispatcher> |
| 185 static bool weakTableRegistered(VisitorDispatcher visitor, | 185 static bool weakTableRegistered(VisitorDispatcher visitor, |
| 186 const void* closure) { | 186 const void* closure) { |
| 187 return visitor->weakTableRegistered(closure); | 187 return visitor->weakTableRegistered(closure); |
| 188 } | 188 } |
| 189 #endif | 189 #endif |
| 190 | 190 |
| 191 template <typename T, typename VisitorDispatcher> |
| 192 static void registerBackingStoreReference(VisitorDispatcher visitor, |
| 193 T** slot) { |
| 194 visitor->registerBackingStoreReference(slot); |
| 195 } |
| 196 |
| 197 template <typename T, typename VisitorDispatcher> |
| 198 static void registerBackingStoreCallback(VisitorDispatcher visitor, |
| 199 T* backingStore, |
| 200 MovingObjectCallback callback, |
| 201 void* callbackData) { |
| 202 visitor->registerBackingStoreCallback(backingStore, callback, callbackData); |
| 203 } |
| 204 |
| 191 static void enterGCForbiddenScope() { | 205 static void enterGCForbiddenScope() { |
| 192 ThreadState::current()->enterGCForbiddenScope(); | 206 ThreadState::current()->enterGCForbiddenScope(); |
| 193 } | 207 } |
| 194 | 208 |
| 195 static void leaveGCForbiddenScope() { | 209 static void leaveGCForbiddenScope() { |
| 196 ThreadState::current()->leaveGCForbiddenScope(); | 210 ThreadState::current()->leaveGCForbiddenScope(); |
| 197 } | 211 } |
| 198 | 212 |
| 199 private: | 213 private: |
| 200 static void backingFree(void*); | 214 static void backingFree(void*); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 const blink::HeapHashCountedSet<Value, HashFunctions, Traits>& set, | 785 const blink::HeapHashCountedSet<Value, HashFunctions, Traits>& set, |
| 772 VectorType& vector) { | 786 VectorType& vector) { |
| 773 copyToVector(static_cast<const HashCountedSet<Value, HashFunctions, Traits, | 787 copyToVector(static_cast<const HashCountedSet<Value, HashFunctions, Traits, |
| 774 blink::HeapAllocator>&>(set), | 788 blink::HeapAllocator>&>(set), |
| 775 vector); | 789 vector); |
| 776 } | 790 } |
| 777 | 791 |
| 778 } // namespace WTF | 792 } // namespace WTF |
| 779 | 793 |
| 780 #endif | 794 #endif |
| OLD | NEW |