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

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

Issue 2262533002: Stop using GrTexture::get/setCustomData in Canvas2DLayerBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
index 80628d731868684a9875709a78068f937fb99610..6143e4235da3066e644a8d00567d6ad6f56bd33d 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -342,16 +342,8 @@ bool Canvas2DLayerBridge::prepareMailboxFromImage(PassRefPtr<SkImage> image, Web
gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- // Re-use the texture's existing mailbox, if there is one.
- if (mailboxInfo.m_image->getTexture()->getCustomData()) {
- DCHECK(mailboxInfo.m_image->getTexture()->getCustomData()->size() == sizeof(mailboxInfo.m_mailbox.name));
- memcpy(&mailboxInfo.m_mailbox.name[0], mailboxInfo.m_image->getTexture()->getCustomData()->data(), sizeof(mailboxInfo.m_mailbox.name));
- } else {
- gl->GenMailboxCHROMIUM(mailboxInfo.m_mailbox.name);
- sk_sp<SkData> mailboxNameData = SkData::MakeWithCopy(&mailboxInfo.m_mailbox.name[0], sizeof(mailboxInfo.m_mailbox.name));
- mailboxInfo.m_image->getTexture()->setCustomData(mailboxNameData.get());
- gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo.m_mailbox.name);
- }
+ gl->GenMailboxCHROMIUM(mailboxInfo.m_mailbox.name);
+ gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo.m_mailbox.name);
if (isHidden()) {
// With hidden canvases, we release the SkImage immediately because
@@ -848,6 +840,10 @@ void Canvas2DLayerBridge::mailboxReleased(const WebExternalTextureMailbox& mailb
texture->abandon();
} else {
texture->textureParamsModified();
+ // Break the mailbox association to avoid leaking mailboxes every time skia recycles a texture.
+ gpu::gles2::GLES2Interface* gl = contextGL();
+ if (gl)
+ gl->ProduceTextureDirectCHROMIUM(0, GL_TEXTURE_2D, releasedMailboxInfo->m_mailbox.name);
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698