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 26 matching lines...) Expand all Loading... |
37 #include "platform/heap/SelfKeepAlive.h" | 37 #include "platform/heap/SelfKeepAlive.h" |
38 #include "platform/heap/ThreadState.h" | 38 #include "platform/heap/ThreadState.h" |
39 #include "platform/heap/Visitor.h" | 39 #include "platform/heap/Visitor.h" |
40 #include "platform/testing/UnitTestHelpers.h" | 40 #include "platform/testing/UnitTestHelpers.h" |
41 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
42 #include "public/platform/WebTaskRunner.h" | 42 #include "public/platform/WebTaskRunner.h" |
43 #include "public/platform/WebTraceLocation.h" | 43 #include "public/platform/WebTraceLocation.h" |
44 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
45 #include "wtf/HashTraits.h" | 45 #include "wtf/HashTraits.h" |
46 #include "wtf/LinkedHashSet.h" | 46 #include "wtf/LinkedHashSet.h" |
47 #include "wtf/PtrUtil.h" | |
48 #include <memory> | |
49 | 47 |
50 namespace blink { | 48 namespace blink { |
51 | 49 |
52 static void preciselyCollectGarbage() | 50 static void preciselyCollectGarbage() |
53 { | 51 { |
54 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw
eep, BlinkGC::ForcedGC); | 52 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw
eep, BlinkGC::ForcedGC); |
55 } | 53 } |
56 | 54 |
57 static void conservativelyCollectGarbage() | 55 static void conservativelyCollectGarbage() |
58 { | 56 { |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 int m_x; | 458 int m_x; |
461 }; | 459 }; |
462 | 460 |
463 int IntWrapper::s_destructorCalls = 0; | 461 int IntWrapper::s_destructorCalls = 0; |
464 int OffHeapInt::s_destructorCalls = 0; | 462 int OffHeapInt::s_destructorCalls = 0; |
465 | 463 |
466 class ThreadedTesterBase { | 464 class ThreadedTesterBase { |
467 protected: | 465 protected: |
468 static void test(ThreadedTesterBase* tester) | 466 static void test(ThreadedTesterBase* tester) |
469 { | 467 { |
470 Vector<std::unique_ptr<WebThread>, numberOfThreads> m_threads; | 468 Vector<OwnPtr<WebThread>, numberOfThreads> m_threads; |
471 for (int i = 0; i < numberOfThreads; i++) { | 469 for (int i = 0; i < numberOfThreads; i++) { |
472 m_threads.append(wrapUnique(Platform::current()->createThread("blink
gc testing thread"))); | 470 m_threads.append(adoptPtr(Platform::current()->createThread("blink g
c testing thread"))); |
473 m_threads.last()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, thre
adSafeBind(threadFunc, AllowCrossThreadAccess(tester))); | 471 m_threads.last()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, thre
adSafeBind(threadFunc, AllowCrossThreadAccess(tester))); |
474 } | 472 } |
475 while (tester->m_threadsToFinish) { | 473 while (tester->m_threadsToFinish) { |
476 SafePointScope scope(BlinkGC::NoHeapPointersOnStack); | 474 SafePointScope scope(BlinkGC::NoHeapPointersOnStack); |
477 testing::yieldCurrentThread(); | 475 testing::yieldCurrentThread(); |
478 } | 476 } |
479 delete tester; | 477 delete tester; |
480 } | 478 } |
481 | 479 |
482 virtual void runThread() = 0; | 480 virtual void runThread() = 0; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 for (auto& globalIntWrapper : m_crossPersistents) { | 522 for (auto& globalIntWrapper : m_crossPersistents) { |
525 ASSERT(globalIntWrapper.get()); | 523 ASSERT(globalIntWrapper.get()); |
526 EXPECT_FALSE(globalIntWrapper.get()->get()); | 524 EXPECT_FALSE(globalIntWrapper.get()->get()); |
527 } | 525 } |
528 } | 526 } |
529 | 527 |
530 protected: | 528 protected: |
531 using GlobalIntWrapperPersistent = CrossThreadPersistent<IntWrapper>; | 529 using GlobalIntWrapperPersistent = CrossThreadPersistent<IntWrapper>; |
532 | 530 |
533 Mutex m_mutex; | 531 Mutex m_mutex; |
534 Vector<std::unique_ptr<GlobalIntWrapperPersistent>> m_crossPersistents; | 532 Vector<OwnPtr<GlobalIntWrapperPersistent>> m_crossPersistents; |
535 | 533 |
536 std::unique_ptr<GlobalIntWrapperPersistent> createGlobalPersistent(int value
) | 534 PassOwnPtr<GlobalIntWrapperPersistent> createGlobalPersistent(int value) |
537 { | 535 { |
538 return wrapUnique(new GlobalIntWrapperPersistent(IntWrapper::create(valu
e))); | 536 return adoptPtr(new GlobalIntWrapperPersistent(IntWrapper::create(value)
)); |
539 } | 537 } |
540 | 538 |
541 void addGlobalPersistent() | 539 void addGlobalPersistent() |
542 { | 540 { |
543 MutexLocker lock(m_mutex); | 541 MutexLocker lock(m_mutex); |
544 m_crossPersistents.append(createGlobalPersistent(0x2a2a2a2a)); | 542 m_crossPersistents.append(createGlobalPersistent(0x2a2a2a2a)); |
545 } | 543 } |
546 | 544 |
547 void runThread() override | 545 void runThread() override |
548 { | 546 { |
549 ThreadState::attachCurrentThread(false); | 547 ThreadState::attachCurrentThread(false); |
550 | 548 |
551 // Add a cross-thread persistent from this thread; the test object | 549 // Add a cross-thread persistent from this thread; the test object |
552 // verifies that it will have been cleared out after the threads | 550 // verifies that it will have been cleared out after the threads |
553 // have all detached, running their termination GCs while doing so. | 551 // have all detached, running their termination GCs while doing so. |
554 addGlobalPersistent(); | 552 addGlobalPersistent(); |
555 | 553 |
556 int gcCount = 0; | 554 int gcCount = 0; |
557 while (!done()) { | 555 while (!done()) { |
558 ThreadState::current()->safePoint(BlinkGC::NoHeapPointersOnStack); | 556 ThreadState::current()->safePoint(BlinkGC::NoHeapPointersOnStack); |
559 { | 557 { |
560 Persistent<IntWrapper> wrapper; | 558 Persistent<IntWrapper> wrapper; |
561 | 559 |
562 std::unique_ptr<GlobalIntWrapperPersistent> globalPersistent = c
reateGlobalPersistent(0x0ed0cabb); | 560 OwnPtr<GlobalIntWrapperPersistent> globalPersistent = createGlob
alPersistent(0x0ed0cabb); |
563 | 561 |
564 for (int i = 0; i < numberOfAllocations; i++) { | 562 for (int i = 0; i < numberOfAllocations; i++) { |
565 wrapper = IntWrapper::create(0x0bbac0de); | 563 wrapper = IntWrapper::create(0x0bbac0de); |
566 if (!(i % 10)) { | 564 if (!(i % 10)) { |
567 globalPersistent = createGlobalPersistent(0x0ed0cabb); | 565 globalPersistent = createGlobalPersistent(0x0ed0cabb); |
568 } | 566 } |
569 SafePointScope scope(BlinkGC::NoHeapPointersOnStack); | 567 SafePointScope scope(BlinkGC::NoHeapPointersOnStack); |
570 testing::yieldCurrentThread(); | 568 testing::yieldCurrentThread(); |
571 } | 569 } |
572 | 570 |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 , m_didCallWillFinalize(false) | 1381 , m_didCallWillFinalize(false) |
1384 { | 1382 { |
1385 } | 1383 } |
1386 | 1384 |
1387 WeakMember<T> m_data; | 1385 WeakMember<T> m_data; |
1388 bool m_didCallWillFinalize; | 1386 bool m_didCallWillFinalize; |
1389 }; | 1387 }; |
1390 | 1388 |
1391 class FinalizationObserverWithHashMap { | 1389 class FinalizationObserverWithHashMap { |
1392 public: | 1390 public: |
1393 typedef HeapHashMap<WeakMember<Observable>, std::unique_ptr<FinalizationObse
rverWithHashMap>> ObserverMap; | 1391 typedef HeapHashMap<WeakMember<Observable>, OwnPtr<FinalizationObserverWithH
ashMap>> ObserverMap; |
1394 | 1392 |
1395 explicit FinalizationObserverWithHashMap(Observable& target) : m_target(targ
et) { } | 1393 explicit FinalizationObserverWithHashMap(Observable& target) : m_target(targ
et) { } |
1396 ~FinalizationObserverWithHashMap() | 1394 ~FinalizationObserverWithHashMap() |
1397 { | 1395 { |
1398 m_target.willFinalize(); | 1396 m_target.willFinalize(); |
1399 s_didCallWillFinalize = true; | 1397 s_didCallWillFinalize = true; |
1400 } | 1398 } |
1401 | 1399 |
1402 static ObserverMap& observe(Observable& target) | 1400 static ObserverMap& observe(Observable& target) |
1403 { | 1401 { |
1404 ObserverMap& map = observers(); | 1402 ObserverMap& map = observers(); |
1405 ObserverMap::AddResult result = map.add(&target, nullptr); | 1403 ObserverMap::AddResult result = map.add(&target, nullptr); |
1406 if (result.isNewEntry) | 1404 if (result.isNewEntry) |
1407 result.storedValue->value = wrapUnique(new FinalizationObserverWithH
ashMap(target)); | 1405 result.storedValue->value = adoptPtr(new FinalizationObserverWithHas
hMap(target)); |
1408 else | 1406 else |
1409 ASSERT(result.storedValue->value); | 1407 ASSERT(result.storedValue->value); |
1410 return map; | 1408 return map; |
1411 } | 1409 } |
1412 | 1410 |
1413 static void clearObservers() | 1411 static void clearObservers() |
1414 { | 1412 { |
1415 delete s_observerMap; | 1413 delete s_observerMap; |
1416 s_observerMap = nullptr; | 1414 s_observerMap = nullptr; |
1417 } | 1415 } |
(...skipping 3371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4789 } | 4787 } |
4790 } | 4788 } |
4791 | 4789 |
4792 EXPECT_FALSE(RefCountedWithDestructor::s_wasDestructed); | 4790 EXPECT_FALSE(RefCountedWithDestructor::s_wasDestructed); |
4793 set.clear(); | 4791 set.clear(); |
4794 EXPECT_TRUE(RefCountedWithDestructor::s_wasDestructed); | 4792 EXPECT_TRUE(RefCountedWithDestructor::s_wasDestructed); |
4795 } | 4793 } |
4796 | 4794 |
4797 TEST(HeapTest, DestructorsCalled) | 4795 TEST(HeapTest, DestructorsCalled) |
4798 { | 4796 { |
4799 HeapHashMap<Member<IntWrapper>, std::unique_ptr<SimpleClassWithDestructor>>
map; | 4797 HeapHashMap<Member<IntWrapper>, OwnPtr<SimpleClassWithDestructor>> map; |
4800 SimpleClassWithDestructor* hasDestructor = new SimpleClassWithDestructor(); | 4798 SimpleClassWithDestructor* hasDestructor = new SimpleClassWithDestructor(); |
4801 map.add(IntWrapper::create(1), wrapUnique(hasDestructor)); | 4799 map.add(IntWrapper::create(1), adoptPtr(hasDestructor)); |
4802 SimpleClassWithDestructor::s_wasDestructed = false; | 4800 SimpleClassWithDestructor::s_wasDestructed = false; |
4803 map.clear(); | 4801 map.clear(); |
4804 EXPECT_TRUE(SimpleClassWithDestructor::s_wasDestructed); | 4802 EXPECT_TRUE(SimpleClassWithDestructor::s_wasDestructed); |
4805 } | 4803 } |
4806 | 4804 |
4807 class MixinA : public GarbageCollectedMixin { | 4805 class MixinA : public GarbageCollectedMixin { |
4808 public: | 4806 public: |
4809 MixinA() : m_obj(IntWrapper::create(100)) { } | 4807 MixinA() : m_obj(IntWrapper::create(100)) { } |
4810 DEFINE_INLINE_VIRTUAL_TRACE() | 4808 DEFINE_INLINE_VIRTUAL_TRACE() |
4811 { | 4809 { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4936 EXPECT_EQ(2, MixinA::s_traceCount); | 4934 EXPECT_EQ(2, MixinA::s_traceCount); |
4937 } | 4935 } |
4938 preciselyCollectGarbage(); | 4936 preciselyCollectGarbage(); |
4939 EXPECT_EQ(2, MixinA::s_traceCount); | 4937 EXPECT_EQ(2, MixinA::s_traceCount); |
4940 } | 4938 } |
4941 | 4939 |
4942 class GCParkingThreadTester { | 4940 class GCParkingThreadTester { |
4943 public: | 4941 public: |
4944 static void test() | 4942 static void test() |
4945 { | 4943 { |
4946 std::unique_ptr<WebThread> sleepingThread = wrapUnique(Platform::current
()->createThread("SleepingThread")); | 4944 OwnPtr<WebThread> sleepingThread = adoptPtr(Platform::current()->createT
hread("SleepingThread")); |
4947 sleepingThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafe
Bind(sleeperMainFunc)); | 4945 sleepingThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafe
Bind(sleeperMainFunc)); |
4948 | 4946 |
4949 // Wait for the sleeper to run. | 4947 // Wait for the sleeper to run. |
4950 while (!s_sleeperRunning) { | 4948 while (!s_sleeperRunning) { |
4951 testing::yieldCurrentThread(); | 4949 testing::yieldCurrentThread(); |
4952 } | 4950 } |
4953 | 4951 |
4954 { | 4952 { |
4955 // Expect the first attempt to park the sleeping thread to fail | 4953 // Expect the first attempt to park the sleeping thread to fail |
4956 TestGCScope scope(BlinkGC::NoHeapPointersOnStack); | 4954 TestGCScope scope(BlinkGC::NoHeapPointersOnStack); |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5601 workerThreadCondition().signal(); | 5599 workerThreadCondition().signal(); |
5602 } | 5600 } |
5603 | 5601 |
5604 class DeadBitTester { | 5602 class DeadBitTester { |
5605 public: | 5603 public: |
5606 static void test() | 5604 static void test() |
5607 { | 5605 { |
5608 IntWrapper::s_destructorCalls = 0; | 5606 IntWrapper::s_destructorCalls = 0; |
5609 | 5607 |
5610 MutexLocker locker(mainThreadMutex()); | 5608 MutexLocker locker(mainThreadMutex()); |
5611 std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()
->createThread("Test Worker Thread")); | 5609 OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThr
ead("Test Worker Thread")); |
5612 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBi
nd(workerThreadMain)); | 5610 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBi
nd(workerThreadMain)); |
5613 | 5611 |
5614 // Wait for the worker thread to have done its initialization, | 5612 // Wait for the worker thread to have done its initialization, |
5615 // IE. the worker allocates an object and then throw aways any | 5613 // IE. the worker allocates an object and then throw aways any |
5616 // pointers to it. | 5614 // pointers to it. |
5617 parkMainThread(); | 5615 parkMainThread(); |
5618 | 5616 |
5619 // Now do a GC. This will not find the worker threads object since it | 5617 // Now do a GC. This will not find the worker threads object since it |
5620 // is not referred from any of the threads. Even a conservative | 5618 // is not referred from any of the threads. Even a conservative |
5621 // GC will not find it. | 5619 // GC will not find it. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5704 DeadBitTester::test(); | 5702 DeadBitTester::test(); |
5705 } | 5703 } |
5706 | 5704 |
5707 class ThreadedStrongificationTester { | 5705 class ThreadedStrongificationTester { |
5708 public: | 5706 public: |
5709 static void test() | 5707 static void test() |
5710 { | 5708 { |
5711 IntWrapper::s_destructorCalls = 0; | 5709 IntWrapper::s_destructorCalls = 0; |
5712 | 5710 |
5713 MutexLocker locker(mainThreadMutex()); | 5711 MutexLocker locker(mainThreadMutex()); |
5714 std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()
->createThread("Test Worker Thread")); | 5712 OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThr
ead("Test Worker Thread")); |
5715 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBi
nd(workerThreadMain)); | 5713 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBi
nd(workerThreadMain)); |
5716 | 5714 |
5717 // Wait for the worker thread initialization. The worker | 5715 // Wait for the worker thread initialization. The worker |
5718 // allocates a weak collection where both collection and | 5716 // allocates a weak collection where both collection and |
5719 // contents are kept alive via persistent pointers. | 5717 // contents are kept alive via persistent pointers. |
5720 parkMainThread(); | 5718 parkMainThread(); |
5721 | 5719 |
5722 // Perform two garbage collections where the worker thread does | 5720 // Perform two garbage collections where the worker thread does |
5723 // not wake up in between. This will cause us to remove marks | 5721 // not wake up in between. This will cause us to remove marks |
5724 // and mark unmarked objects dead. The collection on the worker | 5722 // and mark unmarked objects dead. The collection on the worker |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5907 | 5905 |
5908 int DestructorLockingObject::s_destructorCalls = 0; | 5906 int DestructorLockingObject::s_destructorCalls = 0; |
5909 | 5907 |
5910 class RecursiveLockingTester { | 5908 class RecursiveLockingTester { |
5911 public: | 5909 public: |
5912 static void test() | 5910 static void test() |
5913 { | 5911 { |
5914 DestructorLockingObject::s_destructorCalls = 0; | 5912 DestructorLockingObject::s_destructorCalls = 0; |
5915 | 5913 |
5916 MutexLocker locker(mainThreadMutex()); | 5914 MutexLocker locker(mainThreadMutex()); |
5917 std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()
->createThread("Test Worker Thread")); | 5915 OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThr
ead("Test Worker Thread")); |
5918 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBi
nd(workerThreadMain)); | 5916 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBi
nd(workerThreadMain)); |
5919 | 5917 |
5920 // Park the main thread until the worker thread has initialized. | 5918 // Park the main thread until the worker thread has initialized. |
5921 parkMainThread(); | 5919 parkMainThread(); |
5922 | 5920 |
5923 { | 5921 { |
5924 SafePointAwareMutexLocker recursiveLocker(recursiveMutex()); | 5922 SafePointAwareMutexLocker recursiveLocker(recursiveMutex()); |
5925 | 5923 |
5926 // Let the worker try to acquire the above mutex. It won't get it | 5924 // Let the worker try to acquire the above mutex. It won't get it |
5927 // until the main thread has done its GC. | 5925 // until the main thread has done its GC. |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6612 public: | 6610 public: |
6613 explicit WeakPersistentHolder(IntWrapper* object) : m_object(object) { } | 6611 explicit WeakPersistentHolder(IntWrapper* object) : m_object(object) { } |
6614 IntWrapper* object() const { return m_object; } | 6612 IntWrapper* object() const { return m_object; } |
6615 private: | 6613 private: |
6616 WeakPersistent<IntWrapper> m_object; | 6614 WeakPersistent<IntWrapper> m_object; |
6617 }; | 6615 }; |
6618 | 6616 |
6619 TEST(HeapTest, WeakPersistent) | 6617 TEST(HeapTest, WeakPersistent) |
6620 { | 6618 { |
6621 Persistent<IntWrapper> object = new IntWrapper(20); | 6619 Persistent<IntWrapper> object = new IntWrapper(20); |
6622 std::unique_ptr<WeakPersistentHolder> holder = wrapUnique(new WeakPersistent
Holder(object)); | 6620 OwnPtr<WeakPersistentHolder> holder = adoptPtr(new WeakPersistentHolder(obje
ct)); |
6623 preciselyCollectGarbage(); | 6621 preciselyCollectGarbage(); |
6624 EXPECT_TRUE(holder->object()); | 6622 EXPECT_TRUE(holder->object()); |
6625 object = nullptr; | 6623 object = nullptr; |
6626 preciselyCollectGarbage(); | 6624 preciselyCollectGarbage(); |
6627 EXPECT_FALSE(holder->object()); | 6625 EXPECT_FALSE(holder->object()); |
6628 } | 6626 } |
6629 | 6627 |
6630 namespace { | 6628 namespace { |
6631 | 6629 |
6632 void workerThreadMainForCrossThreadWeakPersistentTest(DestructorLockingObject**
object) | 6630 void workerThreadMainForCrossThreadWeakPersistentTest(DestructorLockingObject**
object) |
(...skipping 20 matching lines...) Expand all Loading... |
6653 TEST(HeapTest, CrossThreadWeakPersistent) | 6651 TEST(HeapTest, CrossThreadWeakPersistent) |
6654 { | 6652 { |
6655 // Create an object in the worker thread, have a CrossThreadWeakPersistent p
ointing to it on the main thread, | 6653 // Create an object in the worker thread, have a CrossThreadWeakPersistent p
ointing to it on the main thread, |
6656 // clear the reference in the worker thread, run a GC in the worker thread,
and see if the | 6654 // clear the reference in the worker thread, run a GC in the worker thread,
and see if the |
6657 // CrossThreadWeakPersistent is cleared. | 6655 // CrossThreadWeakPersistent is cleared. |
6658 | 6656 |
6659 DestructorLockingObject::s_destructorCalls = 0; | 6657 DestructorLockingObject::s_destructorCalls = 0; |
6660 | 6658 |
6661 // Step 1: Initiate a worker thread, and wait for |object| to get allocated
on the worker thread. | 6659 // Step 1: Initiate a worker thread, and wait for |object| to get allocated
on the worker thread. |
6662 MutexLocker mainThreadMutexLocker(mainThreadMutex()); | 6660 MutexLocker mainThreadMutexLocker(mainThreadMutex()); |
6663 std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->cr
eateThread("Test Worker Thread")); | 6661 OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread(
"Test Worker Thread")); |
6664 DestructorLockingObject* object = nullptr; | 6662 DestructorLockingObject* object = nullptr; |
6665 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(w
orkerThreadMainForCrossThreadWeakPersistentTest, AllowCrossThreadAccess(&object)
)); | 6663 workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(w
orkerThreadMainForCrossThreadWeakPersistentTest, AllowCrossThreadAccess(&object)
)); |
6666 parkMainThread(); | 6664 parkMainThread(); |
6667 | 6665 |
6668 // Step 3: Set up a CrossThreadWeakPersistent. | 6666 // Step 3: Set up a CrossThreadWeakPersistent. |
6669 ASSERT_TRUE(object); | 6667 ASSERT_TRUE(object); |
6670 CrossThreadWeakPersistent<DestructorLockingObject> crossThreadWeakPersistent
(object); | 6668 CrossThreadWeakPersistent<DestructorLockingObject> crossThreadWeakPersistent
(object); |
6671 object = nullptr; | 6669 object = nullptr; |
6672 { | 6670 { |
6673 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); | 6671 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6924 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe
r>>>::value, "HeapLinkedHashSet"); | 6922 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe
r>>>::value, "HeapLinkedHashSet"); |
6925 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper>
>>::value, "HeapListHashSet"); | 6923 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper>
>>::value, "HeapListHashSet"); |
6926 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp
er>>>::value, "HeapHashCountedSet"); | 6924 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp
er>>>::value, "HeapHashCountedSet"); |
6927 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper
>>>::value, "HeapHashMap"); | 6925 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper
>>>::value, "HeapHashMap"); |
6928 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v
alue, "HeapVector"); | 6926 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v
alue, "HeapVector"); |
6929 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va
lue, "HeapDeque"); | 6927 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va
lue, "HeapDeque"); |
6930 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap
per>>>::value, "HeapTerminatedArray"); | 6928 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap
per>>>::value, "HeapTerminatedArray"); |
6931 } | 6929 } |
6932 | 6930 |
6933 } // namespace blink | 6931 } // namespace blink |
OLD | NEW |