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

Unified Diff: Source/platform/graphics/gpu/DrawingBufferTest.cpp

Issue 251023004: WebGL: Free temporary GPU resources held by inactive or hidden WebGL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to ToT Created 6 years, 8 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: Source/platform/graphics/gpu/DrawingBufferTest.cpp
diff --git a/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
index e99e7630bc8521d0a07f91d0575229b3e37feff6..4ce0814f640fd052e09109e161467871c2490eb7 100644
--- a/Source/platform/graphics/gpu/DrawingBufferTest.cpp
+++ b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -357,4 +357,25 @@ TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncPointCorrectly)
EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint());
}
+TEST_F(DrawingBufferTest, verifySetIsHiddenProperlyAffectsMailboxes)
+{
+ blink::WebExternalTextureMailbox mailbox;
+
+ // Produce mailboxes.
+ m_drawingBuffer->markContentsChanged();
+ EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
+
+ unsigned waitSyncPoint = webContext()->insertSyncPoint();
+ mailbox.syncPoint = waitSyncPoint;
+ m_drawingBuffer->setIsHidden(true);
+ m_drawingBuffer->mailboxReleased(mailbox);
+ // m_drawingBuffer deletes mailbox immediately when hidden.
+ EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint());
+
+ // Fails to get mailbox when hidden.
+ EXPECT_FALSE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
+
+ m_drawingBuffer->beginDestruction();
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698