| Index: third_party/WebKit/Source/platform/heap/HeapTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
|
| index 5f7d8fd1a837e4340b1827b95080b253a1bf2965..2c2dcf193f50d08bc0385f7c6abb8262e0f96f99 100644
|
| --- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
|
| @@ -44,8 +44,6 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "wtf/HashTraits.h"
|
| #include "wtf/LinkedHashSet.h"
|
| -#include "wtf/PtrUtil.h"
|
| -#include <memory>
|
|
|
| namespace blink {
|
|
|
| @@ -467,9 +465,9 @@ class ThreadedTesterBase {
|
| protected:
|
| static void test(ThreadedTesterBase* tester)
|
| {
|
| - Vector<std::unique_ptr<WebThread>, numberOfThreads> m_threads;
|
| + Vector<OwnPtr<WebThread>, numberOfThreads> m_threads;
|
| for (int i = 0; i < numberOfThreads; i++) {
|
| - m_threads.append(wrapUnique(Platform::current()->createThread("blink gc testing thread")));
|
| + m_threads.append(adoptPtr(Platform::current()->createThread("blink gc testing thread")));
|
| m_threads.last()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(threadFunc, AllowCrossThreadAccess(tester)));
|
| }
|
| while (tester->m_threadsToFinish) {
|
| @@ -531,11 +529,11 @@ protected:
|
| using GlobalIntWrapperPersistent = CrossThreadPersistent<IntWrapper>;
|
|
|
| Mutex m_mutex;
|
| - Vector<std::unique_ptr<GlobalIntWrapperPersistent>> m_crossPersistents;
|
| + Vector<OwnPtr<GlobalIntWrapperPersistent>> m_crossPersistents;
|
|
|
| - std::unique_ptr<GlobalIntWrapperPersistent> createGlobalPersistent(int value)
|
| + PassOwnPtr<GlobalIntWrapperPersistent> createGlobalPersistent(int value)
|
| {
|
| - return wrapUnique(new GlobalIntWrapperPersistent(IntWrapper::create(value)));
|
| + return adoptPtr(new GlobalIntWrapperPersistent(IntWrapper::create(value)));
|
| }
|
|
|
| void addGlobalPersistent()
|
| @@ -559,7 +557,7 @@ protected:
|
| {
|
| Persistent<IntWrapper> wrapper;
|
|
|
| - std::unique_ptr<GlobalIntWrapperPersistent> globalPersistent = createGlobalPersistent(0x0ed0cabb);
|
| + OwnPtr<GlobalIntWrapperPersistent> globalPersistent = createGlobalPersistent(0x0ed0cabb);
|
|
|
| for (int i = 0; i < numberOfAllocations; i++) {
|
| wrapper = IntWrapper::create(0x0bbac0de);
|
| @@ -1390,7 +1388,7 @@ private:
|
|
|
| class FinalizationObserverWithHashMap {
|
| public:
|
| - typedef HeapHashMap<WeakMember<Observable>, std::unique_ptr<FinalizationObserverWithHashMap>> ObserverMap;
|
| + typedef HeapHashMap<WeakMember<Observable>, OwnPtr<FinalizationObserverWithHashMap>> ObserverMap;
|
|
|
| explicit FinalizationObserverWithHashMap(Observable& target) : m_target(target) { }
|
| ~FinalizationObserverWithHashMap()
|
| @@ -1404,7 +1402,7 @@ public:
|
| ObserverMap& map = observers();
|
| ObserverMap::AddResult result = map.add(&target, nullptr);
|
| if (result.isNewEntry)
|
| - result.storedValue->value = wrapUnique(new FinalizationObserverWithHashMap(target));
|
| + result.storedValue->value = adoptPtr(new FinalizationObserverWithHashMap(target));
|
| else
|
| ASSERT(result.storedValue->value);
|
| return map;
|
| @@ -4796,9 +4794,9 @@ void destructorsCalledOnClear(bool addLots)
|
|
|
| TEST(HeapTest, DestructorsCalled)
|
| {
|
| - HeapHashMap<Member<IntWrapper>, std::unique_ptr<SimpleClassWithDestructor>> map;
|
| + HeapHashMap<Member<IntWrapper>, OwnPtr<SimpleClassWithDestructor>> map;
|
| SimpleClassWithDestructor* hasDestructor = new SimpleClassWithDestructor();
|
| - map.add(IntWrapper::create(1), wrapUnique(hasDestructor));
|
| + map.add(IntWrapper::create(1), adoptPtr(hasDestructor));
|
| SimpleClassWithDestructor::s_wasDestructed = false;
|
| map.clear();
|
| EXPECT_TRUE(SimpleClassWithDestructor::s_wasDestructed);
|
| @@ -4943,7 +4941,7 @@ class GCParkingThreadTester {
|
| public:
|
| static void test()
|
| {
|
| - std::unique_ptr<WebThread> sleepingThread = wrapUnique(Platform::current()->createThread("SleepingThread"));
|
| + OwnPtr<WebThread> sleepingThread = adoptPtr(Platform::current()->createThread("SleepingThread"));
|
| sleepingThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(sleeperMainFunc));
|
|
|
| // Wait for the sleeper to run.
|
| @@ -5608,7 +5606,7 @@ public:
|
| IntWrapper::s_destructorCalls = 0;
|
|
|
| MutexLocker locker(mainThreadMutex());
|
| - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread"));
|
| + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread"));
|
| workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain));
|
|
|
| // Wait for the worker thread to have done its initialization,
|
| @@ -5711,7 +5709,7 @@ public:
|
| IntWrapper::s_destructorCalls = 0;
|
|
|
| MutexLocker locker(mainThreadMutex());
|
| - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread"));
|
| + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread"));
|
| workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain));
|
|
|
| // Wait for the worker thread initialization. The worker
|
| @@ -5914,7 +5912,7 @@ public:
|
| DestructorLockingObject::s_destructorCalls = 0;
|
|
|
| MutexLocker locker(mainThreadMutex());
|
| - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread"));
|
| + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread"));
|
| workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain));
|
|
|
| // Park the main thread until the worker thread has initialized.
|
| @@ -6619,7 +6617,7 @@ private:
|
| TEST(HeapTest, WeakPersistent)
|
| {
|
| Persistent<IntWrapper> object = new IntWrapper(20);
|
| - std::unique_ptr<WeakPersistentHolder> holder = wrapUnique(new WeakPersistentHolder(object));
|
| + OwnPtr<WeakPersistentHolder> holder = adoptPtr(new WeakPersistentHolder(object));
|
| preciselyCollectGarbage();
|
| EXPECT_TRUE(holder->object());
|
| object = nullptr;
|
| @@ -6660,7 +6658,7 @@ TEST(HeapTest, CrossThreadWeakPersistent)
|
|
|
| // Step 1: Initiate a worker thread, and wait for |object| to get allocated on the worker thread.
|
| MutexLocker mainThreadMutexLocker(mainThreadMutex());
|
| - std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread"));
|
| + OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread"));
|
| DestructorLockingObject* object = nullptr;
|
| workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMainForCrossThreadWeakPersistentTest, AllowCrossThreadAccess(&object)));
|
| parkMainThread();
|
|
|