| Index: Source/platform/graphics/gpu/DrawingBufferTest.cpp
|
| diff --git a/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
|
| index 25fb4ee4d24a175d72bc93066e14023737f2d996..e99e7630bc8521d0a07f91d0575229b3e37feff6 100644
|
| --- a/Source/platform/graphics/gpu/DrawingBufferTest.cpp
|
| +++ b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
|
| @@ -61,7 +61,8 @@ public:
|
| WebGraphicsContext3DForTests()
|
| : MockWebGraphicsContext3D()
|
| , m_boundTexture(0)
|
| - , m_currentMailboxByte(0) { }
|
| + , m_currentMailboxByte(0)
|
| + , m_mostRecentlyWaitedSyncPoint(0) { }
|
|
|
| virtual void bindTexture(WGC3Denum target, WebGLId texture)
|
| {
|
| @@ -95,11 +96,28 @@ public:
|
| return m_mostRecentlyProducedSize;
|
| }
|
|
|
| + virtual unsigned insertSyncPoint()
|
| + {
|
| + static unsigned syncPointGenerator = 0;
|
| + return ++syncPointGenerator;
|
| + }
|
| +
|
| + virtual void waitSyncPoint(unsigned syncPoint)
|
| + {
|
| + m_mostRecentlyWaitedSyncPoint = syncPoint;
|
| + }
|
| +
|
| + unsigned mostRecentlyWaitedSyncPoint()
|
| + {
|
| + return m_mostRecentlyWaitedSyncPoint;
|
| + }
|
| +
|
| private:
|
| WebGLId m_boundTexture;
|
| HashMap<WebGLId, IntSize> m_textureSizes;
|
| WGC3Dbyte m_currentMailboxByte;
|
| IntSize m_mostRecentlyProducedSize;
|
| + unsigned m_mostRecentlyWaitedSyncPoint;
|
| };
|
|
|
| static const int initialWidth = 100;
|
| @@ -250,7 +268,6 @@ TEST_F(DrawingBufferTest, verifyDestructionCompleteAfterAllMailboxesReleased)
|
| EXPECT_EQ(live, false);
|
| }
|
|
|
| -
|
| class TextureMailboxWrapper {
|
| public:
|
| explicit TextureMailboxWrapper(const blink::WebExternalTextureMailbox& mailbox)
|
| @@ -272,8 +289,6 @@ TEST_F(DrawingBufferTest, verifyRecyclingMailboxesByFIFO)
|
| blink::WebExternalTextureMailbox mailbox2;
|
| blink::WebExternalTextureMailbox mailbox3;
|
|
|
| - IntSize initialSize(initialWidth, initialHeight);
|
| -
|
| // Produce mailboxes.
|
| m_drawingBuffer->markContentsChanged();
|
| EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0));
|
| @@ -312,4 +327,34 @@ TEST_F(DrawingBufferTest, verifyRecyclingMailboxesByFIFO)
|
| m_drawingBuffer->beginDestruction();
|
| }
|
|
|
| +TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncPointCorrectly)
|
| +{
|
| + blink::WebExternalTextureMailbox mailbox;
|
| +
|
| + // Produce mailboxes.
|
| + m_drawingBuffer->markContentsChanged();
|
| + EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint());
|
| + EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
|
| + // prepareMailbox() does not wait for any sync point.
|
| + EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint());
|
| +
|
| + unsigned waitSyncPoint = webContext()->insertSyncPoint();
|
| + mailbox.syncPoint = waitSyncPoint;
|
| + m_drawingBuffer->mailboxReleased(mailbox);
|
| + // m_drawingBuffer will wait for the sync point when recycling.
|
| + EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint());
|
| +
|
| + m_drawingBuffer->markContentsChanged();
|
| + EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
|
| + // m_drawingBuffer waits for the sync point when recycling in prepareMailbox().
|
| + EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint());
|
| +
|
| + m_drawingBuffer->beginDestruction();
|
| + waitSyncPoint = webContext()->insertSyncPoint();
|
| + mailbox.syncPoint = waitSyncPoint;
|
| + m_drawingBuffer->mailboxReleased(mailbox);
|
| + // m_drawingBuffer waits for the sync point because the destruction is in progress.
|
| + EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint());
|
| +}
|
| +
|
| } // namespace
|
|
|