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

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

Issue 415123002: Let canvas decide how to handle the lost resource: WebGL part (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename test case Created 6 years, 5 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
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/gpu/DrawingBufferTest.cpp
diff --git a/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
index 437629396ecd825fda31b093c327420a9d2ea2c6..bb57c9482b1d4ece545f9b5d4d66eecff8fdbb03 100644
--- a/Source/platform/graphics/gpu/DrawingBufferTest.cpp
+++ b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -315,6 +315,41 @@ TEST_F(DrawingBufferTest, verifyDestructionCompleteAfterAllMailboxesReleased)
EXPECT_EQ(live, false);
}
+TEST_F(DrawingBufferTest, verifyDrawingBufferStaysAliveIfResourcesAreLost)
+{
+ bool live = true;
+ m_drawingBuffer->m_live = &live;
+ blink::WebExternalTextureMailbox mailbox1;
+ blink::WebExternalTextureMailbox mailbox2;
+ blink::WebExternalTextureMailbox mailbox3;
+
+ m_drawingBuffer->markContentsChanged();
+ EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0));
+ m_drawingBuffer->markContentsChanged();
+ EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0));
+ m_drawingBuffer->markContentsChanged();
+ EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0));
+
+ m_drawingBuffer->markContentsChanged();
+ m_drawingBuffer->mailboxReleased(mailbox1, true);
+ EXPECT_EQ(live, true);
+
+ m_drawingBuffer->beginDestruction();
+ EXPECT_EQ(live, true);
+
+ m_drawingBuffer->markContentsChanged();
+ m_drawingBuffer->mailboxReleased(mailbox2, false);
+ EXPECT_EQ(live, true);
+
+ DrawingBufferForTests* weakPtr = m_drawingBuffer.get();
+ m_drawingBuffer.clear();
+ EXPECT_EQ(live, true);
+
+ weakPtr->markContentsChanged();
+ weakPtr->mailboxReleased(mailbox3, true);
+ EXPECT_EQ(live, false);
+}
+
class TextureMailboxWrapper {
public:
explicit TextureMailboxWrapper(const blink::WebExternalTextureMailbox& mailbox)
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698