| Index: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
|
| index 350b948b4b0fdfd50fe4c11ba23b412de882d4e1..9ced02613f5fa865811b4806f17b05ea0c37b653 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
|
| @@ -47,8 +47,8 @@
|
| #include "third_party/skia/include/gpu/GrContext.h"
|
| #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
|
| #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
|
| +#include "wtf/PtrUtil.h"
|
| #include "wtf/RefPtr.h"
|
| -
|
| #include <memory>
|
|
|
| using testing::AnyNumber;
|
| @@ -149,7 +149,7 @@ public:
|
|
|
| class Canvas2DLayerBridgeTest : public Test {
|
| public:
|
| - PassRefPtr<Canvas2DLayerBridge> makeBridge(PassOwnPtr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas2DLayerBridge::AccelerationMode accelerationMode)
|
| + PassRefPtr<Canvas2DLayerBridge> makeBridge(std::unique_ptr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas2DLayerBridge::AccelerationMode accelerationMode)
|
| {
|
| return adoptRef(new Canvas2DLayerBridge(std::move(provider), size, 0, NonOpaque, accelerationMode));
|
| }
|
| @@ -158,7 +158,7 @@ protected:
|
| void fullLifecycleTest()
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
|
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::DisableAcceleration)));
|
|
|
| @@ -170,7 +170,7 @@ protected:
|
| void fallbackToSoftwareIfContextLost()
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
|
|
| gl.setIsContextLost(true);
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration)));
|
| @@ -183,7 +183,7 @@ protected:
|
| {
|
| // No fallback case.
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration)));
|
| EXPECT_TRUE(bridge->checkSurfaceValid());
|
| EXPECT_TRUE(bridge->isAccelerated());
|
| @@ -195,7 +195,7 @@ protected:
|
| {
|
| // Fallback case.
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
| GrContext* gr = contextProvider->grContext();
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration)));
|
| EXPECT_TRUE(bridge->checkSurfaceValid());
|
| @@ -212,7 +212,7 @@ protected:
|
| void noDrawOnContextLostTest()
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
|
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting)));
|
| EXPECT_TRUE(bridge->checkSurfaceValid());
|
| @@ -235,7 +235,7 @@ protected:
|
| void prepareMailboxWithBitmapTest()
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting)));
|
| bridge->m_lastImageId = 1;
|
|
|
| @@ -252,7 +252,7 @@ protected:
|
| // This test passes by not crashing and not triggering assertions.
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting)));
|
| WebExternalTextureMailbox mailbox;
|
| bridge->prepareMailbox(&mailbox, 0);
|
| @@ -262,7 +262,7 @@ protected:
|
| // Retry with mailbox released while bridge destruction is in progress.
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
| WebExternalTextureMailbox mailbox;
|
| Canvas2DLayerBridge* rawBridge;
|
| {
|
| @@ -280,7 +280,7 @@ protected:
|
| {
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 300), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration)));
|
| SkPaint paint;
|
| bridge->canvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), paint);
|
| @@ -291,7 +291,7 @@ protected:
|
|
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl));
|
| Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 300), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration)));
|
| SkPaint paint;
|
| bridge->canvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), paint);
|
| @@ -346,7 +346,7 @@ public:
|
|
|
| void runCreateBridgeTask(Canvas2DLayerBridgePtr* bridgePtr, gpu::gles2::GLES2Interface* gl, Canvas2DLayerBridgeTest* testHost, WaitableEvent* doneEvent)
|
| {
|
| - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(gl));
|
| + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(gl));
|
| *bridgePtr = testHost->makeBridge(std::move(contextProvider), IntSize(300, 300), Canvas2DLayerBridge::EnableAcceleration);
|
| // draw+flush to trigger the creation of a GPU surface
|
| (*bridgePtr)->didDraw(FloatRect(0, 0, 1, 1));
|
| @@ -357,7 +357,7 @@ void runCreateBridgeTask(Canvas2DLayerBridgePtr* bridgePtr, gpu::gles2::GLES2Int
|
|
|
| void postAndWaitCreateBridgeTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridgePtr* bridgePtr, gpu::gles2::GLES2Interface* gl, Canvas2DLayerBridgeTest* testHost)
|
| {
|
| - OwnPtr<WaitableEvent> bridgeCreatedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> bridgeCreatedEvent = wrapUnique(new WaitableEvent());
|
| testThread->getWebTaskRunner()->postTask(
|
| location,
|
| threadSafeBind(&runCreateBridgeTask,
|
| @@ -386,7 +386,7 @@ void postDestroyBridgeTask(const WebTraceLocation& location, WebThread* testThre
|
|
|
| void postAndWaitDestroyBridgeTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridgePtr* bridgePtr)
|
| {
|
| - OwnPtr<WaitableEvent> bridgeDestroyedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> bridgeDestroyedEvent = wrapUnique(new WaitableEvent());
|
| testThread->getWebTaskRunner()->postTask(
|
| location,
|
| threadSafeBind(&runDestroyBridgeTask,
|
| @@ -414,7 +414,7 @@ void postSetIsHiddenTask(const WebTraceLocation& location, WebThread* testThread
|
|
|
| void postAndWaitSetIsHiddenTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridge* bridge, bool value)
|
| {
|
| - OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent());
|
| postSetIsHiddenTask(location, testThread, bridge, value, doneEvent.get());
|
| doneEvent->wait();
|
| }
|
| @@ -422,7 +422,7 @@ void postAndWaitSetIsHiddenTask(const WebTraceLocation& location, WebThread* tes
|
| class MockImageBuffer : public ImageBuffer {
|
| public:
|
| MockImageBuffer()
|
| - : ImageBuffer(adoptPtr(new UnacceleratedImageBufferSurface(IntSize(1, 1)))) { }
|
| + : ImageBuffer(wrapUnique(new UnacceleratedImageBufferSurface(IntSize(1, 1)))) { }
|
|
|
| MOCK_CONST_METHOD1(resetCanvas, void(SkCanvas*));
|
|
|
| @@ -436,7 +436,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationLifeCycle)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -444,12 +444,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationLifeCycle)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -480,7 +480,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationReEntry)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -488,12 +488,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationReEntry)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -529,7 +529,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationLifeCycleWithDeferredRenderi
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -541,12 +541,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationLifeCycleWithDeferredRenderi
|
| bridge->setImageBuffer(&mockImageBuffer);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -583,7 +583,7 @@ void runRenderingTask(Canvas2DLayerBridge* bridge, WaitableEvent* doneEvent)
|
|
|
| void postAndWaitRenderingTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridge* bridge)
|
| {
|
| - OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent());
|
| testThread->getWebTaskRunner()->postTask(
|
| location,
|
| threadSafeBind(&runRenderingTask,
|
| @@ -599,7 +599,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_BackgroundRenderingWhileHibernating)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -607,12 +607,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_BackgroundRenderingWhileHibernating)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -650,7 +650,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_BackgroundRenderingWhileHibernatingWith
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -662,12 +662,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_BackgroundRenderingWhileHibernatingWith
|
| bridge->disableDeferral(DisableDeferralReasonUnknown);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -711,7 +711,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_DisableDeferredRenderingWhileHibernatin
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -722,12 +722,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_DisableDeferredRenderingWhileHibernatin
|
| bridge->setImageBuffer(&mockImageBuffer);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -771,7 +771,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_TeardownWhileHibernating)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -779,12 +779,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_TeardownWhileHibernating)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -807,7 +807,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_SnapshotWhileHibernating)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -815,12 +815,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_SnapshotWhileHibernating)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -842,7 +842,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_SnapshotWhileHibernating)
|
| EXPECT_TRUE(bridge->checkSurfaceValid());
|
|
|
| // End hibernation normally
|
| - OwnPtr<WaitableEvent> hibernationEndedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationEndedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationEndedNormally))
|
| .WillOnce(testing::InvokeWithoutArgs(hibernationEndedEvent.get(), &WaitableEvent::signal));
|
| postSetIsHiddenTask(BLINK_FROM_HERE, testThread.get(), bridge.get(), false);
|
| @@ -876,7 +876,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_TeardownWhileHibernationIsPending)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -884,12 +884,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_TeardownWhileHibernationIsPending)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationScheduledEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationScheduledEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| postSetIsHiddenTask(BLINK_FROM_HERE, testThread.get(), bridge.get(), true, hibernationScheduledEvent.get());
|
| postDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge);
|
| @@ -904,7 +904,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_TeardownWhileHibernationIsPending)
|
| // completion before the thread is destroyed.
|
| // This test passes by not crashing, which proves that the WeakPtr logic
|
| // is sound.
|
| - OwnPtr<WaitableEvent> fenceEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> fenceEvent = wrapUnique(new WaitableEvent());
|
| testThread->scheduler()->postIdleTask(BLINK_FROM_HERE, new IdleFenceTask(fenceEvent.get()));
|
| fenceEvent->wait();
|
| }
|
| @@ -916,7 +916,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToPendingTeardown)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -924,12 +924,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToPendingTeardown)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueToPendingDestruction))
|
| .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal));
|
| @@ -950,7 +950,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToVisibilityChange
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -958,12 +958,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToVisibilityChange
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueToVisibilityChange))
|
| .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal));
|
| @@ -987,7 +987,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToLostContext)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -995,13 +995,13 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToLostContext)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| gl.setIsContextLost(true);
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueGpuContextLoss))
|
| .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal));
|
| @@ -1022,7 +1022,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_PrepareMailboxWhileHibernating)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -1030,12 +1030,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_PrepareMailboxWhileHibernating)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
| @@ -1061,7 +1061,7 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_PrepareMailboxWhileBackgroundRendering)
|
| #endif
|
| {
|
| FakeGLES2Interface gl;
|
| - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread"));
|
| + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread"));
|
|
|
| // The Canvas2DLayerBridge has to be created on the thread that will use it
|
| // to avoid WeakPtr thread check issues.
|
| @@ -1069,12 +1069,12 @@ TEST_F(Canvas2DLayerBridgeTest, DISABLED_PrepareMailboxWhileBackgroundRendering)
|
| postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this);
|
|
|
| // Register an alternate Logger for tracking hibernation events
|
| - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger);
|
| + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger);
|
| MockLogger* mockLoggerPtr = mockLogger.get();
|
| bridge->setLoggerForTesting(std::move(mockLogger));
|
|
|
| // Test entering hibernation
|
| - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent());
|
| + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent());
|
| EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled));
|
| EXPECT_CALL(*mockLoggerPtr, didStartHibernating())
|
| .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
|
|
|