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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 513 |
514 private: | 514 private: |
515 virtual void runThread() override | 515 virtual void runThread() override |
516 { | 516 { |
517 ThreadState::attach(); | 517 ThreadState::attach(); |
518 | 518 |
519 int gcCount = 0; | 519 int gcCount = 0; |
520 while (!done()) { | 520 while (!done()) { |
521 ThreadState::current()->safePoint(ThreadState::NoHeapPointersOnStack
); | 521 ThreadState::current()->safePoint(ThreadState::NoHeapPointersOnStack
); |
522 { | 522 { |
523 Persistent<HeapHashMap<ThreadMarker, WeakMember<IntWrapper>> > w
eakMap = new HeapHashMap<ThreadMarker, WeakMember<IntWrapper>>; | 523 Persistent<HeapHashMap<ThreadMarker, WeakMember<IntWrapper>>> we
akMap = new HeapHashMap<ThreadMarker, WeakMember<IntWrapper>>; |
524 PersistentHeapHashMap<ThreadMarker, WeakMember<IntWrapper>> weak
Map2; | 524 PersistentHeapHashMap<ThreadMarker, WeakMember<IntWrapper>> weak
Map2; |
525 | 525 |
526 for (int i = 0; i < numberOfAllocations; i++) { | 526 for (int i = 0; i < numberOfAllocations; i++) { |
527 weakMap->add(static_cast<unsigned>(i), IntWrapper::create(0)
); | 527 weakMap->add(static_cast<unsigned>(i), IntWrapper::create(0)
); |
528 weakMap2.add(static_cast<unsigned>(i), IntWrapper::create(0)
); | 528 weakMap2.add(static_cast<unsigned>(i), IntWrapper::create(0)
); |
529 SafePointScope scope(ThreadState::NoHeapPointersOnStack); | 529 SafePointScope scope(ThreadState::NoHeapPointersOnStack); |
530 Platform::current()->yieldCurrentThread(); | 530 Platform::current()->yieldCurrentThread(); |
531 } | 531 } |
532 | 532 |
533 if (gcCount < gcPerThread) { | 533 if (gcCount < gcPerThread) { |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 IntWrapper::s_destructorCalls = 0; | 1972 IntWrapper::s_destructorCalls = 0; |
1973 | 1973 |
1974 clearOutOldGarbage(); | 1974 clearOutOldGarbage(); |
1975 size_t initialObjectPayloadSize = Heap::objectPayloadSizeForTesting(); | 1975 size_t initialObjectPayloadSize = Heap::objectPayloadSizeForTesting(); |
1976 { | 1976 { |
1977 typedef HeapHashMap< | 1977 typedef HeapHashMap< |
1978 Member<IntWrapper>, | 1978 Member<IntWrapper>, |
1979 Member<IntWrapper>, | 1979 Member<IntWrapper>, |
1980 DefaultHash<Member<IntWrapper>>::Hash, | 1980 DefaultHash<Member<IntWrapper>>::Hash, |
1981 HashTraits<Member<IntWrapper>>, | 1981 HashTraits<Member<IntWrapper>>, |
1982 HashTraits<Member<IntWrapper>> > HeapObjectIdentityMap; | 1982 HashTraits<Member<IntWrapper>>> HeapObjectIdentityMap; |
1983 | 1983 |
1984 Persistent<HeapObjectIdentityMap> map = new HeapObjectIdentityMap(); | 1984 Persistent<HeapObjectIdentityMap> map = new HeapObjectIdentityMap(); |
1985 | 1985 |
1986 map->clear(); | 1986 map->clear(); |
1987 size_t afterSetWasCreated = Heap::objectPayloadSizeForTesting(); | 1987 size_t afterSetWasCreated = Heap::objectPayloadSizeForTesting(); |
1988 EXPECT_TRUE(afterSetWasCreated > initialObjectPayloadSize); | 1988 EXPECT_TRUE(afterSetWasCreated > initialObjectPayloadSize); |
1989 | 1989 |
1990 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC
WithSweep, Heap::ForcedGCForTesting); | 1990 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC
WithSweep, Heap::ForcedGCForTesting); |
1991 size_t afterGC = Heap::objectPayloadSizeForTesting(); | 1991 size_t afterGC = Heap::objectPayloadSizeForTesting(); |
1992 EXPECT_EQ(afterGC, afterSetWasCreated); | 1992 EXPECT_EQ(afterGC, afterSetWasCreated); |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 EXPECT_EQ(103, (*i2)->value()); | 2842 EXPECT_EQ(103, (*i2)->value()); |
2843 ++i2; | 2843 ++i2; |
2844 EXPECT_NE(set1->end(), i2); | 2844 EXPECT_NE(set1->end(), i2); |
2845 EXPECT_EQ(10, (*i2)->value()); | 2845 EXPECT_EQ(10, (*i2)->value()); |
2846 ++i2; | 2846 ++i2; |
2847 EXPECT_EQ(set1->end(), i2); | 2847 EXPECT_EQ(set1->end(), i2); |
2848 } | 2848 } |
2849 | 2849 |
2850 TEST(HeapTest, HeapWeakLinkedHashSet) | 2850 TEST(HeapTest, HeapWeakLinkedHashSet) |
2851 { | 2851 { |
2852 orderedSetHelper<HeapLinkedHashSet<Member<IntWrapper>> >(true); | 2852 orderedSetHelper<HeapLinkedHashSet<Member<IntWrapper>>>(true); |
2853 orderedSetHelper<HeapLinkedHashSet<WeakMember<IntWrapper>> >(false); | 2853 orderedSetHelper<HeapLinkedHashSet<WeakMember<IntWrapper>>>(false); |
2854 orderedSetHelper<HeapListHashSet<Member<IntWrapper>> >(true); | 2854 orderedSetHelper<HeapListHashSet<Member<IntWrapper>>>(true); |
2855 } | 2855 } |
2856 | 2856 |
2857 class ThingWithDestructor { | 2857 class ThingWithDestructor { |
2858 public: | 2858 public: |
2859 ThingWithDestructor() | 2859 ThingWithDestructor() |
2860 : m_x(emptyValue) | 2860 : m_x(emptyValue) |
2861 { | 2861 { |
2862 s_liveThingsWithDestructor++; | 2862 s_liveThingsWithDestructor++; |
2863 } | 2863 } |
2864 | 2864 |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3888 set.add(new int(42)); | 3888 set.add(new int(42)); |
3889 EXPECT_EQ(2u, set.size()); | 3889 EXPECT_EQ(2u, set.size()); |
3890 for (typename Set::iterator it = set.begin(); it != set.end(); ++it) { | 3890 for (typename Set::iterator it = set.begin(); it != set.end(); ++it) { |
3891 EXPECT_EQ(42, **it); | 3891 EXPECT_EQ(42, **it); |
3892 delete *it; | 3892 delete *it; |
3893 } | 3893 } |
3894 } | 3894 } |
3895 | 3895 |
3896 TEST(HeapTest, RawPtrInHash) | 3896 TEST(HeapTest, RawPtrInHash) |
3897 { | 3897 { |
3898 rawPtrInHashHelper<HashSet<RawPtr<int>> >(); | 3898 rawPtrInHashHelper<HashSet<RawPtr<int>>>(); |
3899 rawPtrInHashHelper<ListHashSet<RawPtr<int>> >(); | 3899 rawPtrInHashHelper<ListHashSet<RawPtr<int>>>(); |
3900 rawPtrInHashHelper<LinkedHashSet<RawPtr<int>> >(); | 3900 rawPtrInHashHelper<LinkedHashSet<RawPtr<int>>>(); |
3901 } | 3901 } |
3902 | 3902 |
3903 TEST(HeapTest, HeapTerminatedArray) | 3903 TEST(HeapTest, HeapTerminatedArray) |
3904 { | 3904 { |
3905 clearOutOldGarbage(); | 3905 clearOutOldGarbage(); |
3906 IntWrapper::s_destructorCalls = 0; | 3906 IntWrapper::s_destructorCalls = 0; |
3907 | 3907 |
3908 HeapTerminatedArray<TerminatedArrayItem>* arr = 0; | 3908 HeapTerminatedArray<TerminatedArrayItem>* arr = 0; |
3909 | 3909 |
3910 const size_t prefixSize = 4; | 3910 const size_t prefixSize = 4; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4080 | 4080 |
4081 TEST(HeapTest, DestructorsCalled) | 4081 TEST(HeapTest, DestructorsCalled) |
4082 { | 4082 { |
4083 HeapHashMap<SimpleClassWithDestructor*, OwnPtr<SimpleClassWithDestructor>> m
ap; | 4083 HeapHashMap<SimpleClassWithDestructor*, OwnPtr<SimpleClassWithDestructor>> m
ap; |
4084 SimpleClassWithDestructor* hasDestructor = new SimpleClassWithDestructor(); | 4084 SimpleClassWithDestructor* hasDestructor = new SimpleClassWithDestructor(); |
4085 map.add(hasDestructor, adoptPtr(hasDestructor)); | 4085 map.add(hasDestructor, adoptPtr(hasDestructor)); |
4086 SimpleClassWithDestructor::s_wasDestructed = false; | 4086 SimpleClassWithDestructor::s_wasDestructed = false; |
4087 map.clear(); | 4087 map.clear(); |
4088 EXPECT_TRUE(SimpleClassWithDestructor::s_wasDestructed); | 4088 EXPECT_TRUE(SimpleClassWithDestructor::s_wasDestructed); |
4089 | 4089 |
4090 destructorsCalledOnClear<HeapHashSet<RefPtr<RefCountedWithDestructor>> >(fal
se); | 4090 destructorsCalledOnClear<HeapHashSet<RefPtr<RefCountedWithDestructor>>>(fals
e); |
4091 destructorsCalledOnClear<HeapListHashSet<RefPtr<RefCountedWithDestructor>> >
(false); | 4091 destructorsCalledOnClear<HeapListHashSet<RefPtr<RefCountedWithDestructor>>>(
false); |
4092 destructorsCalledOnClear<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>>
>(false); | 4092 destructorsCalledOnClear<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>>
>(false); |
4093 destructorsCalledOnClear<HeapHashSet<RefPtr<RefCountedWithDestructor>> >(tru
e); | 4093 destructorsCalledOnClear<HeapHashSet<RefPtr<RefCountedWithDestructor>>>(true
); |
4094 destructorsCalledOnClear<HeapListHashSet<RefPtr<RefCountedWithDestructor>> >
(true); | 4094 destructorsCalledOnClear<HeapListHashSet<RefPtr<RefCountedWithDestructor>>>(
true); |
4095 destructorsCalledOnClear<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>>
>(true); | 4095 destructorsCalledOnClear<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>>
>(true); |
4096 | 4096 |
4097 destructorsCalledOnGC<HeapHashSet<RefPtr<RefCountedWithDestructor>> >(false)
; | 4097 destructorsCalledOnGC<HeapHashSet<RefPtr<RefCountedWithDestructor>>>(false); |
4098 destructorsCalledOnGC<HeapListHashSet<RefPtr<RefCountedWithDestructor>> >(fa
lse); | 4098 destructorsCalledOnGC<HeapListHashSet<RefPtr<RefCountedWithDestructor>>>(fal
se); |
4099 destructorsCalledOnGC<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>> >(
false); | 4099 destructorsCalledOnGC<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>>>(f
alse); |
4100 destructorsCalledOnGC<HeapHashSet<RefPtr<RefCountedWithDestructor>> >(true); | 4100 destructorsCalledOnGC<HeapHashSet<RefPtr<RefCountedWithDestructor>>>(true); |
4101 destructorsCalledOnGC<HeapListHashSet<RefPtr<RefCountedWithDestructor>> >(tr
ue); | 4101 destructorsCalledOnGC<HeapListHashSet<RefPtr<RefCountedWithDestructor>>>(tru
e); |
4102 destructorsCalledOnGC<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>> >(
true); | 4102 destructorsCalledOnGC<HeapLinkedHashSet<RefPtr<RefCountedWithDestructor>>>(t
rue); |
4103 } | 4103 } |
4104 | 4104 |
4105 class MixinA : public GarbageCollectedMixin { | 4105 class MixinA : public GarbageCollectedMixin { |
4106 public: | 4106 public: |
4107 MixinA() : m_obj(IntWrapper::create(100)) { } | 4107 MixinA() : m_obj(IntWrapper::create(100)) { } |
4108 DEFINE_INLINE_VIRTUAL_TRACE() | 4108 DEFINE_INLINE_VIRTUAL_TRACE() |
4109 { | 4109 { |
4110 visitor->trace(m_obj); | 4110 visitor->trace(m_obj); |
4111 } | 4111 } |
4112 Member<IntWrapper> m_obj; | 4112 Member<IntWrapper> m_obj; |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4437 { | 4437 { |
4438 // Key cannot be zero in hashmap. | 4438 // Key cannot be zero in hashmap. |
4439 for (int i = 1; i < 11; i++) | 4439 for (int i = 1; i < 11; i++) |
4440 map->add(i, IntWrapper::create(i)); | 4440 map->add(i, IntWrapper::create(i)); |
4441 } | 4441 } |
4442 | 4442 |
4443 // crbug.com/402426 | 4443 // crbug.com/402426 |
4444 // If it doesn't assert a concurrent modification to the map, then it's passing. | 4444 // If it doesn't assert a concurrent modification to the map, then it's passing. |
4445 TEST(HeapTest, RegressNullIsStrongified) | 4445 TEST(HeapTest, RegressNullIsStrongified) |
4446 { | 4446 { |
4447 Persistent<HeapHashMap<int, WeakMember<IntWrapper>> > map = new HeapHashMap<
int, WeakMember<IntWrapper>>(); | 4447 Persistent<HeapHashMap<int, WeakMember<IntWrapper>>> map = new HeapHashMap<i
nt, WeakMember<IntWrapper>>(); |
4448 addElementsToWeakMap(map); | 4448 addElementsToWeakMap(map); |
4449 HeapHashMap<int, WeakMember<IntWrapper>>::AddResult result = map->add(800, n
ullptr); | 4449 HeapHashMap<int, WeakMember<IntWrapper>>::AddResult result = map->add(800, n
ullptr); |
4450 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSw
eep, Heap::ForcedGCForTesting); | 4450 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSw
eep, Heap::ForcedGCForTesting); |
4451 result.storedValue->value = IntWrapper::create(42); | 4451 result.storedValue->value = IntWrapper::create(42); |
4452 } | 4452 } |
4453 | 4453 |
4454 TEST(HeapTest, Bind) | 4454 TEST(HeapTest, Bind) |
4455 { | 4455 { |
4456 OwnPtr<Closure> closure = bind(static_cast<void (Bar::*)(Visitor*)>(&Bar::tr
ace), Bar::create(), static_cast<Visitor*>(0)); | 4456 OwnPtr<Closure> closure = bind(static_cast<void (Bar::*)(Visitor*)>(&Bar::tr
ace), Bar::create(), static_cast<Visitor*>(0)); |
4457 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGCForTesting); | 4457 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGCForTesting); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4573 } else { | 4573 } else { |
4574 EXPECT_EQ(0u, inner.size()); | 4574 EXPECT_EQ(0u, inner.size()); |
4575 } | 4575 } |
4576 } else { | 4576 } else { |
4577 EXPECT_EQ(0u, outer->size()); | 4577 EXPECT_EQ(0u, outer->size()); |
4578 } | 4578 } |
4579 outer->clear(); | 4579 outer->clear(); |
4580 Persistent<IntWrapper> deep = IntWrapper::create(42); | 4580 Persistent<IntWrapper> deep = IntWrapper::create(42); |
4581 Persistent<IntWrapper> home = IntWrapper::create(103); | 4581 Persistent<IntWrapper> home = IntWrapper::create(103); |
4582 Persistent<IntWrapper> composite = IntWrapper::create(91); | 4582 Persistent<IntWrapper> composite = IntWrapper::create(91); |
4583 Persistent<HeapVector<Member<IntWrapper>> > keepAlive = new HeapVect
or<Member<IntWrapper>>(); | 4583 Persistent<HeapVector<Member<IntWrapper>>> keepAlive = new HeapVecto
r<Member<IntWrapper>>(); |
4584 for (int i = 0; i < 10000; i++) { | 4584 for (int i = 0; i < 10000; i++) { |
4585 IntWrapper* value = IntWrapper::create(i); | 4585 IntWrapper* value = IntWrapper::create(i); |
4586 keepAlive->append(value); | 4586 keepAlive->append(value); |
4587 OuterMap::AddResult newEntry = outer->add(value, InnerMap()); | 4587 OuterMap::AddResult newEntry = outer->add(value, InnerMap()); |
4588 newEntry.storedValue->value.add(deep, home); | 4588 newEntry.storedValue->value.add(deep, home); |
4589 newEntry.storedValue->value.add(composite, home); | 4589 newEntry.storedValue->value.add(composite, home); |
4590 } | 4590 } |
4591 composite.clear(); | 4591 composite.clear(); |
4592 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState
::GCWithSweep, Heap::ForcedGCForTesting); | 4592 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState
::GCWithSweep, Heap::ForcedGCForTesting); |
4593 EXPECT_EQ(10000u, outer->size()); | 4593 EXPECT_EQ(10000u, outer->size()); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4971 { | 4971 { |
4972 // Create a weak collection that is kept alive by a persistent | 4972 // Create a weak collection that is kept alive by a persistent |
4973 // and keep the contents alive with a persistents as | 4973 // and keep the contents alive with a persistents as |
4974 // well. | 4974 // well. |
4975 Persistent<IntWrapper> wrapper1 = IntWrapper::create(32); | 4975 Persistent<IntWrapper> wrapper1 = IntWrapper::create(32); |
4976 Persistent<IntWrapper> wrapper2 = IntWrapper::create(32); | 4976 Persistent<IntWrapper> wrapper2 = IntWrapper::create(32); |
4977 Persistent<IntWrapper> wrapper3 = IntWrapper::create(32); | 4977 Persistent<IntWrapper> wrapper3 = IntWrapper::create(32); |
4978 Persistent<IntWrapper> wrapper4 = IntWrapper::create(32); | 4978 Persistent<IntWrapper> wrapper4 = IntWrapper::create(32); |
4979 Persistent<IntWrapper> wrapper5 = IntWrapper::create(32); | 4979 Persistent<IntWrapper> wrapper5 = IntWrapper::create(32); |
4980 Persistent<IntWrapper> wrapper6 = IntWrapper::create(32); | 4980 Persistent<IntWrapper> wrapper6 = IntWrapper::create(32); |
4981 Persistent<HeapHashSet<WeakMember<IntWrapper>> > weakCollection = new He
apHashSet<WeakMember<IntWrapper>>; | 4981 Persistent<HeapHashSet<WeakMember<IntWrapper>>> weakCollection = new Hea
pHashSet<WeakMember<IntWrapper>>; |
4982 weakCollection->add(wrapper1); | 4982 weakCollection->add(wrapper1); |
4983 weakCollection->add(wrapper2); | 4983 weakCollection->add(wrapper2); |
4984 weakCollection->add(wrapper3); | 4984 weakCollection->add(wrapper3); |
4985 weakCollection->add(wrapper4); | 4985 weakCollection->add(wrapper4); |
4986 weakCollection->add(wrapper5); | 4986 weakCollection->add(wrapper5); |
4987 weakCollection->add(wrapper6); | 4987 weakCollection->add(wrapper6); |
4988 | 4988 |
4989 // Signal the main thread that the worker is done with its allocation. | 4989 // Signal the main thread that the worker is done with its allocation. |
4990 wakeMainThread(); | 4990 wakeMainThread(); |
4991 | 4991 |
(...skipping 11 matching lines...) Expand all Loading... |
5003 return weakCollection; | 5003 return weakCollection; |
5004 } | 5004 } |
5005 | 5005 |
5006 static void workerThreadMain() | 5006 static void workerThreadMain() |
5007 { | 5007 { |
5008 MutexLocker locker(workerThreadMutex()); | 5008 MutexLocker locker(workerThreadMutex()); |
5009 | 5009 |
5010 ThreadState::attach(); | 5010 ThreadState::attach(); |
5011 | 5011 |
5012 { | 5012 { |
5013 Persistent<HeapHashSet<WeakMember<IntWrapper>> > collection = alloca
teCollection(); | 5013 Persistent<HeapHashSet<WeakMember<IntWrapper>>> collection = allocat
eCollection(); |
5014 { | 5014 { |
5015 // Prevent weak processing with an iterator and GC. | 5015 // Prevent weak processing with an iterator and GC. |
5016 HeapHashSet<WeakMember<IntWrapper>>::iterator it = collection->b
egin(); | 5016 HeapHashSet<WeakMember<IntWrapper>>::iterator it = collection->b
egin(); |
5017 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadSta
te::GCWithSweep, Heap::ForcedGCForTesting); | 5017 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadSta
te::GCWithSweep, Heap::ForcedGCForTesting); |
5018 | 5018 |
5019 // The backing should be strongified because of the iterator. | 5019 // The backing should be strongified because of the iterator. |
5020 EXPECT_EQ(6u, collection->size()); | 5020 EXPECT_EQ(6u, collection->size()); |
5021 EXPECT_EQ(32, (*it)->value()); | 5021 EXPECT_EQ(32, (*it)->value()); |
5022 } | 5022 } |
5023 | 5023 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5243 } | 5243 } |
5244 | 5244 |
5245 { | 5245 { |
5246 TraceIfNeededTester<Member<SimpleObject>>* m_obj = TraceIfNeededTester<M
ember<SimpleObject>>::create(Member<SimpleObject>(SimpleObject::create())); | 5246 TraceIfNeededTester<Member<SimpleObject>>* m_obj = TraceIfNeededTester<M
ember<SimpleObject>>::create(Member<SimpleObject>(SimpleObject::create())); |
5247 visitor.reset(); | 5247 visitor.reset(); |
5248 m_obj->trace(&visitor); | 5248 m_obj->trace(&visitor); |
5249 EXPECT_EQ(1u, visitor.count()); | 5249 EXPECT_EQ(1u, visitor.count()); |
5250 } | 5250 } |
5251 | 5251 |
5252 { | 5252 { |
5253 TraceIfNeededTester<HeapVector<Member<SimpleObject>> >* m_vec = TraceIfN
eededTester<HeapVector<Member<SimpleObject>> >::create(); | 5253 TraceIfNeededTester<HeapVector<Member<SimpleObject>>>* m_vec = TraceIfNe
ededTester<HeapVector<Member<SimpleObject>>>::create(); |
5254 m_vec->obj().append(SimpleObject::create()); | 5254 m_vec->obj().append(SimpleObject::create()); |
5255 visitor.reset(); | 5255 visitor.reset(); |
5256 m_vec->trace(&visitor); | 5256 m_vec->trace(&visitor); |
5257 EXPECT_EQ(2u, visitor.count()); | 5257 EXPECT_EQ(2u, visitor.count()); |
5258 } | 5258 } |
5259 } | 5259 } |
5260 | 5260 |
5261 class AllocatesOnAssignment { | 5261 class AllocatesOnAssignment { |
5262 public: | 5262 public: |
5263 AllocatesOnAssignment(std::nullptr_t) | 5263 AllocatesOnAssignment(std::nullptr_t) |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5683 { | 5683 { |
5684 Persistent<ClassWithMember> object = ClassWithMember::create(); | 5684 Persistent<ClassWithMember> object = ClassWithMember::create(); |
5685 EXPECT_EQ(0, object->traceCount()); | 5685 EXPECT_EQ(0, object->traceCount()); |
5686 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); | 5686 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); |
5687 EXPECT_TRUE(mixin); | 5687 EXPECT_TRUE(mixin); |
5688 EXPECT_GT(object->traceCount(), 0); | 5688 EXPECT_GT(object->traceCount(), 0); |
5689 EXPECT_GT(mixin->traceCount(), 0); | 5689 EXPECT_GT(mixin->traceCount(), 0); |
5690 } | 5690 } |
5691 | 5691 |
5692 } // namespace blink | 5692 } // namespace blink |
OLD | NEW |