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

Unified Diff: Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 101163004: Fix the context loss issue when switching tabs after enabled Canvas2D hardware acceleration (Closed) Base URL: http://src.chromium.org/blink/trunk/
Patch Set: Created 6 years, 10 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/Canvas2DLayerBridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/Canvas2DLayerBridge.cpp
diff --git a/Source/platform/graphics/Canvas2DLayerBridge.cpp b/Source/platform/graphics/Canvas2DLayerBridge.cpp
index 8a3f810532ede8abeac0d74831a239ff53d77922..b39d5b17fe3ca6f3f4b6f378e3239c0f7e006719 100644
--- a/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -439,6 +439,7 @@ void Canvas2DLayerBridge::mailboxReleased(const blink::WebExternalTextureMailbox
mailboxInfo->m_mailbox.syncPoint = mailbox.syncPoint;
ASSERT(mailboxInfo->m_status == MailboxInUse);
mailboxInfo->m_status = MailboxReleased;
+ resetLastImageIdIfNecessary();
// Trigger Canvas2DLayerBridge self-destruction if this is the
// last live mailbox and the layer bridge is not externally
// referenced.
@@ -457,6 +458,16 @@ void Canvas2DLayerBridge::mailboxReleased(const blink::WebExternalTextureMailbox
}
}
+void Canvas2DLayerBridge::resetLastImageIdIfNecessary()
+{
+ Vector<MailboxInfo>::iterator mailboxInfo;
+ for (mailboxInfo = m_mailboxes.begin(); mailboxInfo < m_mailboxes.end(); ++mailboxInfo) {
Justin Novosad 2014/02/13 15:32:18 You can do the check in O(1) time instead of O(N)
+ if (mailboxInfo->m_status == MailboxInUse)
+ return;
+ }
+ m_lastImageId = 0;
+}
+
blink::WebLayer* Canvas2DLayerBridge::layer() const
{
ASSERT(m_layer);
« no previous file with comments | « Source/platform/graphics/Canvas2DLayerBridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698