Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Unified Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from Kent; merge. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 947cf8030a192a1ee22d7d28e25facc6f070d904..007042eaa9d2457cb6128151220b59aecd0293b9 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
@@ -23,6 +23,8 @@
#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 {
@@ -30,13 +32,13 @@ namespace {
// A null InProcessWorkerObjectProxy, supplied when creating CompositorWorkerThreads.
class TestCompositorWorkerObjectProxy : public InProcessWorkerObjectProxy {
public:
- static PassOwnPtr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context)
+ static std::unique_ptr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context)
{
- return adoptPtr(new TestCompositorWorkerObjectProxy(context));
+ return wrapUnique(new TestCompositorWorkerObjectProxy(context));
}
// (Empty) WorkerReportingProxy implementation:
- virtual void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) {}
+ virtual void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) {}
void reportConsoleMessage(ConsoleMessage*) override {}
void postMessageToPageInspector(const String&) override {}
void postWorkerConsoleAgentEnabled() override {}
@@ -75,7 +77,7 @@ public:
class CompositorWorkerTestPlatform : public TestingPlatformSupport {
public:
CompositorWorkerTestPlatform()
- : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor")))
+ : m_thread(wrapUnique(m_oldPlatform->createThread("Compositor")))
{
}
@@ -87,7 +89,7 @@ public:
WebCompositorSupport* compositorSupport() override { return &m_compositorSupport; }
private:
- OwnPtr<WebThread> m_thread;
+ std::unique_ptr<WebThread> m_thread;
TestingCompositorSupport m_compositorSupport;
};
@@ -110,9 +112,9 @@ public:
CompositorWorkerThread::clearSharedBackingThread();
}
- PassOwnPtr<CompositorWorkerThread> createCompositorWorker()
+ std::unique_ptr<CompositorWorkerThread> createCompositorWorker()
{
- OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0);
+ std::unique_ptr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0);
WorkerClients* clients = WorkerClients::create();
provideCompositorProxyClientTo(clients, new TestCompositorProxyClient);
workerThread->start(WorkerThreadStartupData::create(
@@ -133,7 +135,7 @@ public:
// Attempts to run some simple script for |worker|.
void checkWorkerCanExecuteScript(WorkerThread* worker)
{
- OwnPtr<WaitableEvent> waitEvent = adoptPtr(new WaitableEvent());
+ std::unique_ptr<WaitableEvent> waitEvent = wrapUnique(new WaitableEvent());
worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, AllowCrossThreadAccess(this),
AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get())));
waitEvent->wait();
@@ -149,15 +151,15 @@ private:
waitEvent->signal();
}
- OwnPtr<DummyPageHolder> m_page;
+ std::unique_ptr<DummyPageHolder> m_page;
RefPtr<SecurityOrigin> m_securityOrigin;
- OwnPtr<InProcessWorkerObjectProxy> m_objectProxy;
+ std::unique_ptr<InProcessWorkerObjectProxy> m_objectProxy;
CompositorWorkerTestPlatform m_testPlatform;
};
TEST_F(CompositorWorkerThreadTest, Basic)
{
- OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
+ std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
checkWorkerCanExecuteScript(compositorWorker.get());
compositorWorker->terminateAndWait();
}
@@ -166,14 +168,14 @@ TEST_F(CompositorWorkerThreadTest, Basic)
TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst)
{
// Create the first worker and wait until it is initialized.
- OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker();
+ std::unique_ptr<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.
- OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker();
+ std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker();
firstWorker->terminateAndWait();
// Wait until the second worker is initialized. Verify that the second worker is using the same
@@ -195,7 +197,7 @@ TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst)
TEST_F(CompositorWorkerThreadTest, TerminateFirstAndCreateSecond)
{
// Create the first worker, wait until it is initialized, and terminate it.
- OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
+ std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
WorkerBackingThread* workerBackingThread = &compositorWorker->workerBackingThread();
WebThreadSupportingGC* firstThread = &compositorWorker->workerBackingThread().backingThread();
checkWorkerCanExecuteScript(compositorWorker.get());
@@ -218,7 +220,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)
{
- OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker();
+ std::unique_ptr<CompositorWorkerThread> firstWorker = createCompositorWorker();
checkWorkerCanExecuteScript(firstWorker.get());
v8::Isolate* firstIsolate = firstWorker->isolate();
ASSERT_TRUE(firstIsolate);
@@ -231,7 +233,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.
- OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker();
+ std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker();
v8::Isolate* secondIsolate = secondWorker->isolate();
ASSERT_TRUE(secondIsolate);

Powered by Google App Engine
This is Rietveld 408576698