OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef Visitor_h | 31 #ifndef Visitor_h |
32 #define Visitor_h | 32 #define Visitor_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/heap/ThreadState.h" | 35 #include "platform/heap/ThreadState.h" |
36 #include "wtf/Assertions.h" | 36 #include "wtf/Assertions.h" |
37 #include "wtf/Deque.h" | 37 #include "wtf/Deque.h" |
38 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 39 #include "wtf/HashCountedSet.h" |
39 #include "wtf/HashMap.h" | 40 #include "wtf/HashMap.h" |
40 #include "wtf/HashSet.h" | 41 #include "wtf/HashSet.h" |
41 #include "wtf/HashTraits.h" | 42 #include "wtf/HashTraits.h" |
42 #include "wtf/InstanceCounter.h" | 43 #include "wtf/InstanceCounter.h" |
43 #include "wtf/LinkedHashSet.h" | 44 #include "wtf/LinkedHashSet.h" |
44 #include "wtf/ListHashSet.h" | 45 #include "wtf/ListHashSet.h" |
45 #include "wtf/OwnPtr.h" | 46 #include "wtf/OwnPtr.h" |
46 #include "wtf/RefPtr.h" | 47 #include "wtf/RefPtr.h" |
47 #include "wtf/TypeTraits.h" | 48 #include "wtf/TypeTraits.h" |
48 #include "wtf/WeakPtr.h" | 49 #include "wtf/WeakPtr.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 { | 292 { |
292 OffHeapCollectionTraceTrait<LinkedHashSet<T, U> >::trace(this, hashSet); | 293 OffHeapCollectionTraceTrait<LinkedHashSet<T, U> >::trace(this, hashSet); |
293 } | 294 } |
294 | 295 |
295 template<typename T, size_t N> | 296 template<typename T, size_t N> |
296 void trace(const Deque<T, N>& deque) | 297 void trace(const Deque<T, N>& deque) |
297 { | 298 { |
298 OffHeapCollectionTraceTrait<Deque<T, N> >::trace(this, deque); | 299 OffHeapCollectionTraceTrait<Deque<T, N> >::trace(this, deque); |
299 } | 300 } |
300 | 301 |
| 302 template<typename T, typename U, typename V> |
| 303 void trace(const HashCountedSet<T, U, V>& set) |
| 304 { |
| 305 OffHeapCollectionTraceTrait<HashCountedSet<T, U, V> >::trace(this, set); |
| 306 } |
| 307 |
301 template<typename T, typename U, typename V, typename W, typename X> | 308 template<typename T, typename U, typename V, typename W, typename X> |
302 void trace(const HashMap<T, U, V, W, X, WTF::DefaultAllocator>& map) | 309 void trace(const HashMap<T, U, V, W, X, WTF::DefaultAllocator>& map) |
303 { | 310 { |
304 OffHeapCollectionTraceTrait<HashMap<T, U, V, W, X, WTF::DefaultAllocator
> >::trace(this, map); | 311 OffHeapCollectionTraceTrait<HashMap<T, U, V, W, X, WTF::DefaultAllocator
> >::trace(this, map); |
305 } | 312 } |
306 | 313 |
307 // OwnPtrs that are traced are treated as part objects and the | 314 // OwnPtrs that are traced are treated as part objects and the |
308 // trace method of the owned object is called. | 315 // trace method of the owned object is called. |
309 template<typename T> | 316 template<typename T> |
310 void trace(const OwnPtr<T>& t) | 317 void trace(const OwnPtr<T>& t) |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 546 |
540 static void trace(Visitor* visitor, const Deque& deque) | 547 static void trace(Visitor* visitor, const Deque& deque) |
541 { | 548 { |
542 if (deque.isEmpty()) | 549 if (deque.isEmpty()) |
543 return; | 550 return; |
544 for (typename Deque::const_iterator it = deque.begin(), end = deque.end(
); it != end; ++it) | 551 for (typename Deque::const_iterator it = deque.begin(), end = deque.end(
); it != end; ++it) |
545 TraceTrait<T>::trace(visitor, const_cast<T*>(&(*it))); | 552 TraceTrait<T>::trace(visitor, const_cast<T*>(&(*it))); |
546 } | 553 } |
547 }; | 554 }; |
548 | 555 |
| 556 template<typename T, typename U, typename V> |
| 557 struct OffHeapCollectionTraceTrait<WTF::HashCountedSet<T, U, V> > { |
| 558 typedef WTF::HashCountedSet<T, U, V> Set; |
| 559 |
| 560 static void trace(Visitor* visitor, const Set& set) |
| 561 { |
| 562 if (set.isEmpty()) |
| 563 return; |
| 564 for (typename Set::const_iterator it = set.begin(), end = set.end(); it
!= end; ++it) |
| 565 TraceTrait<T>::trace(visitor, const_cast<T*>(&(it->key))); |
| 566 } |
| 567 }; |
| 568 |
549 template<typename T, typename Traits = WTF::VectorTraits<T> > | 569 template<typename T, typename Traits = WTF::VectorTraits<T> > |
550 class HeapVectorBacking; | 570 class HeapVectorBacking; |
551 | 571 |
552 template<typename Table> | 572 template<typename Table> |
553 class HeapHashTableBacking { | 573 class HeapHashTableBacking { |
554 public: | 574 public: |
555 static void finalize(void* pointer); | 575 static void finalize(void* pointer); |
556 }; | 576 }; |
557 | 577 |
558 template<typename T> | 578 template<typename T> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 struct GCInfoTrait { | 724 struct GCInfoTrait { |
705 static const GCInfo* get() | 725 static const GCInfo* get() |
706 { | 726 { |
707 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 727 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
708 } | 728 } |
709 }; | 729 }; |
710 | 730 |
711 } | 731 } |
712 | 732 |
713 #endif | 733 #endif |
OLD | NEW |