Chromium Code Reviews| 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); |