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 21 matching lines...) Expand all Loading... |
32 #define Visitor_h | 32 #define Visitor_h |
33 | 33 |
34 #include "heap/HeapExport.h" | 34 #include "heap/HeapExport.h" |
35 #include "heap/ThreadState.h" | 35 #include "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/HashMap.h" | 39 #include "wtf/HashMap.h" |
40 #include "wtf/HashSet.h" | 40 #include "wtf/HashSet.h" |
41 #include "wtf/HashTraits.h" | 41 #include "wtf/HashTraits.h" |
| 42 #include "wtf/LinkedHashSet.h" |
42 #include "wtf/ListHashSet.h" | 43 #include "wtf/ListHashSet.h" |
43 #include "wtf/OwnPtr.h" | 44 #include "wtf/OwnPtr.h" |
44 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
45 #include "wtf/TypeTraits.h" | 46 #include "wtf/TypeTraits.h" |
46 | 47 |
47 #ifndef NDEBUG | 48 #ifndef NDEBUG |
48 #define DEBUG_ONLY(x) x | 49 #define DEBUG_ONLY(x) x |
49 #else | 50 #else |
50 #define DEBUG_ONLY(x) | 51 #define DEBUG_ONLY(x) |
51 #endif | 52 #endif |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 { | 256 { |
256 OffHeapCollectionTraceTrait<HashSet<T, U, V, WTF::DefaultAllocator> >::t
race(this, hashSet); | 257 OffHeapCollectionTraceTrait<HashSet<T, U, V, WTF::DefaultAllocator> >::t
race(this, hashSet); |
257 } | 258 } |
258 | 259 |
259 template<typename T, size_t inlineCapacity, typename U> | 260 template<typename T, size_t inlineCapacity, typename U> |
260 void trace(const ListHashSet<T, inlineCapacity, U>& hashSet) | 261 void trace(const ListHashSet<T, inlineCapacity, U>& hashSet) |
261 { | 262 { |
262 OffHeapCollectionTraceTrait<ListHashSet<T, inlineCapacity, U> >::trace(t
his, hashSet); | 263 OffHeapCollectionTraceTrait<ListHashSet<T, inlineCapacity, U> >::trace(t
his, hashSet); |
263 } | 264 } |
264 | 265 |
| 266 template<typename T, typename U> |
| 267 void trace(const LinkedHashSet<T, U>& hashSet) |
| 268 { |
| 269 OffHeapCollectionTraceTrait<LinkedHashSet<T, U> >::trace(this, hashSet); |
| 270 } |
| 271 |
265 template<typename T, size_t N> | 272 template<typename T, size_t N> |
266 void trace(const Deque<T, N>& deque) | 273 void trace(const Deque<T, N>& deque) |
267 { | 274 { |
268 OffHeapCollectionTraceTrait<Deque<T, N> >::trace(this, deque); | 275 OffHeapCollectionTraceTrait<Deque<T, N> >::trace(this, deque); |
269 } | 276 } |
270 | 277 |
271 template<typename T, typename U, typename V, typename W, typename X> | 278 template<typename T, typename U, typename V, typename W, typename X> |
272 void trace(const HashMap<T, U, V, W, X, WTF::DefaultAllocator>& map) | 279 void trace(const HashMap<T, U, V, W, X, WTF::DefaultAllocator>& map) |
273 { | 280 { |
274 OffHeapCollectionTraceTrait<HashMap<T, U, V, W, X, WTF::DefaultAllocator
> >::trace(this, map); | 281 OffHeapCollectionTraceTrait<HashMap<T, U, V, W, X, WTF::DefaultAllocator
> >::trace(this, map); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 static void trace(Visitor* visitor, const ListHashSet& set) | 427 static void trace(Visitor* visitor, const ListHashSet& set) |
421 { | 428 { |
422 if (set.isEmpty()) | 429 if (set.isEmpty()) |
423 return; | 430 return; |
424 ListHashSet& iterSet = const_cast<ListHashSet&>(set); | 431 ListHashSet& iterSet = const_cast<ListHashSet&>(set); |
425 for (typename ListHashSet::iterator it = iterSet.begin(), end = iterSet.
end(); it != end; ++it) | 432 for (typename ListHashSet::iterator it = iterSet.begin(), end = iterSet.
end(); it != end; ++it) |
426 visitor->trace(*it); | 433 visitor->trace(*it); |
427 } | 434 } |
428 }; | 435 }; |
429 | 436 |
| 437 template<typename T, typename HashFunctions> |
| 438 struct OffHeapCollectionTraceTrait<WTF::LinkedHashSet<T, HashFunctions> > { |
| 439 typedef WTF::LinkedHashSet<T, HashFunctions> LinkedHashSet; |
| 440 |
| 441 static void trace(Visitor* visitor, const LinkedHashSet& set) |
| 442 { |
| 443 if (set.isEmpty()) |
| 444 return; |
| 445 LinkedHashSet& iterSet = const_cast<LinkedHashSet&>(set); |
| 446 for (typename LinkedHashSet::iterator it = iterSet.begin(), end = iterSe
t.end(); it != end; ++it) |
| 447 visitor->trace(*it); |
| 448 } |
| 449 }; |
| 450 |
430 template<typename Key, typename Value, typename HashFunctions, typename KeyTrait
s, typename ValueTraits> | 451 template<typename Key, typename Value, typename HashFunctions, typename KeyTrait
s, typename ValueTraits> |
431 struct OffHeapCollectionTraceTrait<WTF::HashMap<Key, Value, HashFunctions, KeyTr
aits, ValueTraits, WTF::DefaultAllocator> > { | 452 struct OffHeapCollectionTraceTrait<WTF::HashMap<Key, Value, HashFunctions, KeyTr
aits, ValueTraits, WTF::DefaultAllocator> > { |
432 typedef WTF::HashMap<Key, Value, HashFunctions, KeyTraits, ValueTraits, WTF:
:DefaultAllocator> HashMap; | 453 typedef WTF::HashMap<Key, Value, HashFunctions, KeyTraits, ValueTraits, WTF:
:DefaultAllocator> HashMap; |
433 | 454 |
434 static void trace(Visitor* visitor, const HashMap& map) | 455 static void trace(Visitor* visitor, const HashMap& map) |
435 { | 456 { |
436 if (map.isEmpty()) | 457 if (map.isEmpty()) |
437 return; | 458 return; |
438 if (WTF::ShouldBeTraced<KeyTraits>::value || WTF::ShouldBeTraced<ValueTr
aits>::value) { | 459 if (WTF::ShouldBeTraced<KeyTraits>::value || WTF::ShouldBeTraced<ValueTr
aits>::value) { |
439 HashMap& iterMap = const_cast<HashMap&>(map); | 460 HashMap& iterMap = const_cast<HashMap&>(map); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 struct GCInfoTrait { | 640 struct GCInfoTrait { |
620 static const GCInfo* get() | 641 static const GCInfo* get() |
621 { | 642 { |
622 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 643 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
623 } | 644 } |
624 }; | 645 }; |
625 | 646 |
626 } | 647 } |
627 | 648 |
628 #endif | 649 #endif |
OLD | NEW |