| Index: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
|
| index adb2ac490c713f2fd16305d9388d56f20b9d5c4d..1b3c0d8340d2e7efbcb570e6cce64f6b5087ec2d 100644
|
| --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
|
| +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
|
| @@ -23,8 +23,6 @@
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebAddressSpace.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| -#include "wtf/PtrUtil.h"
|
| -#include <memory>
|
|
|
| namespace blink {
|
| namespace {
|
| @@ -32,13 +30,13 @@ namespace {
|
| // A null InProcessWorkerObjectProxy, supplied when creating CompositorWorkerThreads.
|
| class TestCompositorWorkerObjectProxy : public InProcessWorkerObjectProxy {
|
| public:
|
| - static std::unique_ptr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context)
|
| + static PassOwnPtr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context)
|
| {
|
| - return wrapUnique(new TestCompositorWorkerObjectProxy(context));
|
| + return adoptPtr(new TestCompositorWorkerObjectProxy(context));
|
| }
|
|
|
| // (Empty) WorkerReportingProxy implementation:
|
| - virtual void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) {}
|
| + virtual void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) {}
|
| void reportConsoleMessage(ConsoleMessage*) override {}
|
| void postMessageToPageInspector(const String&) override {}
|
| void postWorkerConsoleAgentEnabled() override {}
|
| @@ -77,7 +75,7 @@ public:
|
| class CompositorWorkerTestPlatform : public TestingPlatformSupport {
|
| public:
|
| CompositorWorkerTestPlatform()
|
| - : m_thread(wrapUnique(m_oldPlatform->createThread("Compositor")))
|
| + : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor")))
|
| {
|
| }
|
|
|
| @@ -89,7 +87,7 @@ public:
|
| WebCompositorSupport* compositorSupport() override { return &m_compositorSupport; }
|
|
|
| private:
|
| - std::unique_ptr<WebThread> m_thread;
|
| + OwnPtr<WebThread> m_thread;
|
| TestingCompositorSupport m_compositorSupport;
|
| };
|
|
|
| @@ -111,9 +109,9 @@ public:
|
| CompositorWorkerThread::clearSharedBackingThread();
|
| }
|
|
|
| - std::unique_ptr<CompositorWorkerThread> createCompositorWorker()
|
| + PassOwnPtr<CompositorWorkerThread> createCompositorWorker()
|
| {
|
| - std::unique_ptr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0);
|
| + OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0);
|
| WorkerClients* clients = WorkerClients::create();
|
| provideCompositorProxyClientTo(clients, new TestCompositorProxyClient);
|
| workerThread->start(WorkerThreadStartupData::create(
|
| @@ -134,7 +132,7 @@ public:
|
| // Attempts to run some simple script for |worker|.
|
| void checkWorkerCanExecuteScript(WorkerThread* worker)
|
| {
|
| - std::unique_ptr<WaitableEvent> waitEvent = wrapUnique(new WaitableEvent());
|
| + OwnPtr<WaitableEvent> waitEvent = adoptPtr(new WaitableEvent());
|
| worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, AllowCrossThreadAccess(this),
|
| AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get())));
|
| waitEvent->wait();
|
| @@ -149,15 +147,15 @@ private:
|
| waitEvent->signal();
|
| }
|
|
|
| - std::unique_ptr<DummyPageHolder> m_page;
|
| + OwnPtr<DummyPageHolder> m_page;
|
| RefPtr<SecurityOrigin> m_securityOrigin;
|
| - std::unique_ptr<InProcessWorkerObjectProxy> m_objectProxy;
|
| + OwnPtr<InProcessWorkerObjectProxy> m_objectProxy;
|
| CompositorWorkerTestPlatform m_testPlatform;
|
| };
|
|
|
| TEST_F(CompositorWorkerThreadTest, Basic)
|
| {
|
| - std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
|
| + OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
|
| checkWorkerCanExecuteScript(compositorWorker.get());
|
| compositorWorker->terminateAndWait();
|
| }
|
| @@ -166,14 +164,14 @@ TEST_F(CompositorWorkerThreadTest, Basic)
|
| TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst)
|
| {
|
| // Create the first worker and wait until it is initialized.
|
| - std::unique_ptr<CompositorWorkerThread> firstWorker = createCompositorWorker();
|
| + OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker();
|
| WebThreadSupportingGC* firstThread = &firstWorker->workerBackingThread().backingThread();
|
| checkWorkerCanExecuteScript(firstWorker.get());
|
| v8::Isolate* firstIsolate = firstWorker->isolate();
|
| ASSERT_TRUE(firstIsolate);
|
|
|
| // Create the second worker and immediately destroy the first worker.
|
| - std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker();
|
| + OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker();
|
| // We don't use terminateAndWait here to avoid forcible termination.
|
| firstWorker->terminate();
|
| firstWorker->waitForShutdownForTesting();
|
| @@ -197,7 +195,7 @@ TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst)
|
| TEST_F(CompositorWorkerThreadTest, TerminateFirstAndCreateSecond)
|
| {
|
| // Create the first worker, wait until it is initialized, and terminate it.
|
| - std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
|
| + OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
|
| WebThreadSupportingGC* firstThread = &compositorWorker->workerBackingThread().backingThread();
|
| checkWorkerCanExecuteScript(compositorWorker.get());
|
|
|
| @@ -217,7 +215,7 @@ TEST_F(CompositorWorkerThreadTest, TerminateFirstAndCreateSecond)
|
| // Tests that v8::Isolate and WebThread are correctly set-up if a worker is created while another is terminating.
|
| TEST_F(CompositorWorkerThreadTest, CreatingSecondDuringTerminationOfFirst)
|
| {
|
| - std::unique_ptr<CompositorWorkerThread> firstWorker = createCompositorWorker();
|
| + OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker();
|
| checkWorkerCanExecuteScript(firstWorker.get());
|
| v8::Isolate* firstIsolate = firstWorker->isolate();
|
| ASSERT_TRUE(firstIsolate);
|
| @@ -229,7 +227,7 @@ TEST_F(CompositorWorkerThreadTest, CreatingSecondDuringTerminationOfFirst)
|
| // Note: We rely on the assumption that the termination steps don't run
|
| // on the worker thread so quickly. This could be a source of flakiness.
|
|
|
| - std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker();
|
| + OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker();
|
|
|
| v8::Isolate* secondIsolate = secondWorker->isolate();
|
| ASSERT_TRUE(secondIsolate);
|
|
|