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

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

Issue 2165913003: Invalidate m_image after GPU-GPU texture copy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 3 formats still fails on windows Created 4 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 | « third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h ('k') | 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/StaticBitmapImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
index 3d85460343ee69b82b0ae05d01995c03eb727b2f..d22047c4ab1f12a27c603bcc683772020f40fd0c 100644
--- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -104,7 +104,7 @@ GLuint StaticBitmapImage::switchStorageToSkImage(WebGraphicsContext3DProvider* p
void StaticBitmapImage::copyToTexture(WebGraphicsContext3DProvider* provider, GLuint destinationTexture, GLenum internalFormat, GLenum destType, bool flipY)
{
- GLuint textureId = textureIdForWebGL(provider);
+ GLuint textureId = switchStorageToSkImageForWebGL(provider);
gpu::gles2::GLES2Interface* gl = provider->contextGL();
if (!gl)
return;
@@ -113,6 +113,8 @@ void StaticBitmapImage::copyToTexture(WebGraphicsContext3DProvider* provider, GL
gl->Flush();
GLbyte syncToken[24];
gl->GenSyncTokenCHROMIUM(fenceSync, syncToken);
+ // Get a new mailbox because we cannot retain a texture in the WebGL context.
+ switchStorageToMailbox(provider);
}
bool StaticBitmapImage::switchStorageToMailbox(WebGraphicsContext3DProvider* provider)
@@ -137,11 +139,12 @@ bool StaticBitmapImage::switchStorageToMailbox(WebGraphicsContext3DProvider* pro
m_mailbox.validSyncToken = true;
gl->BindTexture(GL_TEXTURE_2D, 0);
grContext->resetContext(kTextureBinding_GrGLBackendState);
+ m_image = nullptr;
return true;
}
// This function is called only in the case that m_image is texture backed.
-GLuint StaticBitmapImage::textureIdForWebGL(WebGraphicsContext3DProvider* contextProvider)
+GLuint StaticBitmapImage::switchStorageToSkImageForWebGL(WebGraphicsContext3DProvider* contextProvider)
{
DCHECK(!m_image || m_image->isTextureBacked());
GLuint textureId = 0;
@@ -152,16 +155,11 @@ GLuint StaticBitmapImage::textureIdForWebGL(WebGraphicsContext3DProvider* contex
if (!switchStorageToMailbox(sharedProvider.get()))
return 0;
textureId = switchStorageToSkImage(contextProvider);
- // Get a new mailbox because we cannot retain a texture in the WebGL context.
- if (!switchStorageToMailbox(contextProvider))
- return 0;
return textureId;
}
}
DCHECK(hasMailbox());
textureId = switchStorageToSkImage(contextProvider);
- if (!switchStorageToMailbox(contextProvider))
- return 0;
return textureId;
}
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698