| 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 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 EXPECT_EQ(afterGC4.totalObjectSpace(), initialHeapSize.totalObjectSpace()); | 2486 EXPECT_EQ(afterGC4.totalObjectSpace(), initialHeapSize.totalObjectSpace()); |
| 2487 } | 2487 } |
| 2488 | 2488 |
| 2489 class CollectionsEmbeddedClass { | 2489 class CollectionsEmbeddedClass { |
| 2490 typedef HashSet<Member<IntWrapper>, HeapAllocator> IntSet; | 2490 typedef HashSet<Member<IntWrapper>, HeapAllocator> IntSet; |
| 2491 typedef HashMap<Member<IntWrapper>, Member<IntWrapper>, HeapAllocator> IntMa
p; | 2491 typedef HashMap<Member<IntWrapper>, Member<IntWrapper>, HeapAllocator> IntMa
p; |
| 2492 typedef Vector<Member<IntWrapper>, 0, HeapAllocator> IntVector; | 2492 typedef Vector<Member<IntWrapper>, 0, HeapAllocator> IntVector; |
| 2493 | 2493 |
| 2494 template<typename T> friend struct FinalizerTrait; | 2494 template<typename T> friend struct FinalizerTrait; |
| 2495 | 2495 |
| 2496 class ObjectReferringToCollections : HeapAllocated<ObjectReferringToCollecti
ons> { | 2496 class ObjectReferringToCollections : public HeapAllocated<ObjectReferringToC
ollections> { |
| 2497 DECLARE_GC_INFO | 2497 DECLARE_GC_INFO |
| 2498 public: | 2498 public: |
| 2499 void trace(Visitor* visitor) | 2499 void trace(Visitor* visitor) |
| 2500 { | 2500 { |
| 2501 visitor->trace(m_set); | 2501 visitor->trace(m_set); |
| 2502 visitor->trace(m_map); | 2502 visitor->trace(m_map); |
| 2503 visitor->trace(m_vector); | 2503 visitor->trace(m_vector); |
| 2504 } | 2504 } |
| 2505 static ObjectReferringToCollections* create() { return new ObjectReferri
ngToCollections; } | 2505 static ObjectReferringToCollections* create() { return new ObjectReferri
ngToCollections; } |
| 2506 IntSet* set() { return m_set; } | 2506 IntSet* set() { return m_set; } |
| 2507 IntMap* map() { return m_map; } | 2507 IntMap* map() { return m_map; } |
| 2508 IntVector* vector() { return m_vector; } | 2508 IntVector* vector() { return m_vector; } |
| 2509 private: | 2509 private: |
| 2510 Member<IntSet> m_set; | 2510 Member<IntSet> m_set; |
| 2511 Member<IntMap> m_map; | 2511 Member<IntMap> m_map; |
| 2512 Member<IntVector> m_vector; | 2512 Member<IntVector> m_vector; |
| 2513 ObjectReferringToCollections() | 2513 ObjectReferringToCollections() |
| 2514 { | 2514 { |
| 2515 m_set = IntSet::create(); | 2515 m_set = IntSet::create(); |
| 2516 m_map = IntMap::create(); | 2516 m_map = IntMap::create(); |
| 2517 m_vector = IntVector::create(); | 2517 m_vector = IntVector::create(); |
| 2518 } | 2518 } |
| 2519 }; | 2519 }; |
| 2520 | 2520 |
| 2521 class ObjectContainingCollections : HeapAllocated<ObjectContainingCollection
s> { | 2521 class ObjectContainingCollections : public HeapAllocated<ObjectContainingCol
lections> { |
| 2522 DECLARE_GC_INFO | 2522 DECLARE_GC_INFO |
| 2523 public: | 2523 public: |
| 2524 IntSet m_set; | 2524 IntSet m_set; |
| 2525 IntMap m_map; | 2525 IntMap m_map; |
| 2526 IntVector m_vector; | 2526 IntVector m_vector; |
| 2527 void trace(Visitor* visitor) | 2527 void trace(Visitor* visitor) |
| 2528 { | 2528 { |
| 2529 visitor->trace(m_set); | 2529 visitor->trace(m_set); |
| 2530 visitor->trace(m_map); | 2530 visitor->trace(m_map); |
| 2531 visitor->trace(m_vector); | 2531 visitor->trace(m_vector); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2807 { | 2807 { |
| 2808 HeapTester::checkAndVisitPointer(); | 2808 HeapTester::checkAndVisitPointer(); |
| 2809 } | 2809 } |
| 2810 | 2810 |
| 2811 TEST(heap, HeapCollectionWithFinalizers) | 2811 TEST(heap, HeapCollectionWithFinalizers) |
| 2812 { | 2812 { |
| 2813 HeapTester::heapCollectionWithFinalizers(); | 2813 HeapTester::heapCollectionWithFinalizers(); |
| 2814 } | 2814 } |
| 2815 | 2815 |
| 2816 } // namespace WebCore | 2816 } // namespace WebCore |
| OLD | NEW |