| 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 5404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5415 } | 5415 } |
| 5416 | 5416 |
| 5417 class DestructorLockingObject | 5417 class DestructorLockingObject |
| 5418 : public GarbageCollectedFinalized<DestructorLockingObject> { | 5418 : public GarbageCollectedFinalized<DestructorLockingObject> { |
| 5419 public: | 5419 public: |
| 5420 static DestructorLockingObject* create() { | 5420 static DestructorLockingObject* create() { |
| 5421 return new DestructorLockingObject(); | 5421 return new DestructorLockingObject(); |
| 5422 } | 5422 } |
| 5423 | 5423 |
| 5424 virtual ~DestructorLockingObject() { | 5424 virtual ~DestructorLockingObject() { |
| 5425 SafePointAwareMutexLocker lock(recursiveMutex()); | 5425 MutexLocker lock(recursiveMutex()); |
| 5426 ++s_destructorCalls; | 5426 ++s_destructorCalls; |
| 5427 } | 5427 } |
| 5428 | 5428 |
| 5429 static int s_destructorCalls; | 5429 static int s_destructorCalls; |
| 5430 DEFINE_INLINE_TRACE() {} | 5430 DEFINE_INLINE_TRACE() {} |
| 5431 | 5431 |
| 5432 private: | 5432 private: |
| 5433 DestructorLockingObject() {} | 5433 DestructorLockingObject() {} |
| 5434 }; | 5434 }; |
| 5435 | 5435 |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6095 crossThreadBind(workerThreadMainForCrossThreadWeakPersistentTest, | 6095 crossThreadBind(workerThreadMainForCrossThreadWeakPersistentTest, |
| 6096 crossThreadUnretained(&object))); | 6096 crossThreadUnretained(&object))); |
| 6097 parkMainThread(); | 6097 parkMainThread(); |
| 6098 | 6098 |
| 6099 // Step 3: Set up a CrossThreadWeakPersistent. | 6099 // Step 3: Set up a CrossThreadWeakPersistent. |
| 6100 ASSERT_TRUE(object); | 6100 ASSERT_TRUE(object); |
| 6101 CrossThreadWeakPersistent<DestructorLockingObject> crossThreadWeakPersistent( | 6101 CrossThreadWeakPersistent<DestructorLockingObject> crossThreadWeakPersistent( |
| 6102 object); | 6102 object); |
| 6103 object = nullptr; | 6103 object = nullptr; |
| 6104 { | 6104 { |
| 6105 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); | 6105 MutexLocker recursiveMutexLocker(recursiveMutex()); |
| 6106 EXPECT_EQ(0, DestructorLockingObject::s_destructorCalls); | 6106 EXPECT_EQ(0, DestructorLockingObject::s_destructorCalls); |
| 6107 } | 6107 } |
| 6108 | 6108 |
| 6109 { | 6109 { |
| 6110 // Pretend we have no pointers on stack during the step 4. | 6110 // Pretend we have no pointers on stack during the step 4. |
| 6111 SafePointScope scope(BlinkGC::NoHeapPointersOnStack); | 6111 SafePointScope scope(BlinkGC::NoHeapPointersOnStack); |
| 6112 wakeWorkerThread(); | 6112 wakeWorkerThread(); |
| 6113 parkMainThread(); | 6113 parkMainThread(); |
| 6114 } | 6114 } |
| 6115 | 6115 |
| 6116 // Step 5: Make sure the weak persistent is cleared. | 6116 // Step 5: Make sure the weak persistent is cleared. |
| 6117 EXPECT_FALSE(crossThreadWeakPersistent.get()); | 6117 EXPECT_FALSE(crossThreadWeakPersistent.get()); |
| 6118 { | 6118 { |
| 6119 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); | 6119 MutexLocker recursiveMutexLocker(recursiveMutex()); |
| 6120 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); | 6120 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); |
| 6121 } | 6121 } |
| 6122 | 6122 |
| 6123 wakeWorkerThread(); | 6123 wakeWorkerThread(); |
| 6124 parkMainThread(); | 6124 parkMainThread(); |
| 6125 } | 6125 } |
| 6126 | 6126 |
| 6127 class TestPersistentHeapVectorWithUnusedSlots | 6127 class TestPersistentHeapVectorWithUnusedSlots |
| 6128 : public PersistentHeapVector<VectorObject, 16> { | 6128 : public PersistentHeapVector<VectorObject, 16> { |
| 6129 public: | 6129 public: |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6362 "HeapVector"); | 6362 "HeapVector"); |
| 6363 static_assert( | 6363 static_assert( |
| 6364 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value, | 6364 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value, |
| 6365 "HeapDeque"); | 6365 "HeapDeque"); |
| 6366 static_assert(WTF::IsGarbageCollectedType< | 6366 static_assert(WTF::IsGarbageCollectedType< |
| 6367 HeapTerminatedArray<Member<IntWrapper>>>::value, | 6367 HeapTerminatedArray<Member<IntWrapper>>>::value, |
| 6368 "HeapTerminatedArray"); | 6368 "HeapTerminatedArray"); |
| 6369 } | 6369 } |
| 6370 | 6370 |
| 6371 } // namespace blink | 6371 } // namespace blink |
| OLD | NEW |