| 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 HEAP_STUBS_H_ | 5 #ifndef HEAP_STUBS_H_ |
| 6 #define HEAP_STUBS_H_ | 6 #define HEAP_STUBS_H_ |
| 7 | 7 |
| 8 #include "stddef.h" | 8 #include "stddef.h" |
| 9 | 9 |
| 10 #define WTF_MAKE_FAST_ALLOCATED \ | 10 #define WTF_MAKE_FAST_ALLOCATED \ |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 template<typename T> | 269 template<typename T> |
| 270 class HeapHashCountedSet : public HashCountedSet<T, void, void, HeapAllocator> { | 270 class HeapHashCountedSet : public HashCountedSet<T, void, void, HeapAllocator> { |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 template<typename K, typename V> | 273 template<typename K, typename V> |
| 274 class HeapHashMap : public HashMap<K, V, void, void, void, HeapAllocator> { }; | 274 class HeapHashMap : public HashMap<K, V, void, void, void, HeapAllocator> { }; |
| 275 | 275 |
| 276 template<typename T> | 276 template<typename T> |
| 277 class PersistentHeapVector : public Vector<T, 0, HeapAllocator> { }; | 277 class PersistentHeapVector : public Vector<T, 0, HeapAllocator> { }; |
| 278 | 278 |
| 279 template <typename Derived> | 279 class Visitor { |
| 280 class VisitorHelper { | 280 public: |
| 281 public: | 281 template <typename T, void (T::*method)(Visitor*)> |
| 282 template<typename T> | 282 void registerWeakMembers(const T* obj); |
| 283 void trace(const T&); | |
| 284 }; | |
| 285 | 283 |
| 286 class Visitor : public VisitorHelper<Visitor> { | 284 template <typename T> |
| 287 public: | 285 void trace(const T&); |
| 288 template<typename T, void (T::*method)(Visitor*)> | |
| 289 void registerWeakMembers(const T* obj); | |
| 290 }; | |
| 291 | |
| 292 class InlinedGlobalMarkingVisitor | |
| 293 : public VisitorHelper<InlinedGlobalMarkingVisitor> { | |
| 294 public: | |
| 295 InlinedGlobalMarkingVisitor* operator->() { return this; } | |
| 296 | |
| 297 template<typename T, void (T::*method)(Visitor*)> | |
| 298 void registerWeakMembers(const T* obj); | |
| 299 }; | 286 }; |
| 300 | 287 |
| 301 class GarbageCollectedMixin { | 288 class GarbageCollectedMixin { |
| 302 public: | 289 public: |
| 303 virtual void adjustAndMark(Visitor*) const = 0; | 290 virtual void adjustAndMark(Visitor*) const = 0; |
| 304 virtual bool isHeapObjectAlive(Visitor*) const = 0; | 291 virtual bool isHeapObjectAlive(Visitor*) const = 0; |
| 305 virtual void trace(Visitor*) { } | 292 virtual void trace(Visitor*) { } |
| 306 }; | 293 }; |
| 307 | 294 |
| 308 template<typename T> | 295 template<typename T> |
| 309 struct TraceIfNeeded { | 296 struct TraceIfNeeded { |
| 310 static void trace(Visitor*, T*); | 297 static void trace(Visitor*, T*); |
| 311 }; | 298 }; |
| 312 | 299 |
| 313 } | 300 } |
| 314 | 301 |
| 315 namespace WTF { | 302 namespace WTF { |
| 316 | 303 |
| 317 template<typename T> | 304 template<typename T> |
| 318 struct VectorTraits<blink::Member<T> > { | 305 struct VectorTraits<blink::Member<T> > { |
| 319 static const bool needsDestruction = false; | 306 static const bool needsDestruction = false; |
| 320 }; | 307 }; |
| 321 | 308 |
| 322 } | 309 } |
| 323 | 310 |
| 324 #endif | 311 #endif |
| OLD | NEW |