Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
index 498c75e75a4c627ace6fd546a004d5bf620b0e47..0294fa77683cdbece4c6945557ccd146629fa107 100644 |
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
@@ -151,7 +151,8 @@ DrawingBuffer::DrawingBuffer( |
m_softwareRendering(m_contextProvider->isSoftwareRendering()), |
m_wantDepth(wantDepth), |
m_wantStencil(wantStencil), |
- m_chromiumImageUsage(chromiumImageUsage) { |
+ m_chromiumImageUsage(chromiumImageUsage), |
+ m_weakPtrFactory(this) { |
// Used by browser tests to detect the use of a DrawingBuffer. |
TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation", |
TRACE_EVENT_SCOPE_GLOBAL); |
@@ -481,20 +482,6 @@ PassRefPtr<StaticBitmapImage> DrawingBuffer::transferToStaticBitmapImage() { |
// reference to the backing via our |textureId|. |
releaseCallback->Run(gpu::SyncToken(), true /* lostResource */); |
- // Store that texture id as the backing for an SkImage. |
- GrGLTextureInfo textureInfo; |
- textureInfo.fTarget = GL_TEXTURE_2D; |
- textureInfo.fID = textureId; |
- GrBackendTextureDesc backendTexture; |
- backendTexture.fOrigin = kBottomLeft_GrSurfaceOrigin; |
- backendTexture.fWidth = m_size.width(); |
- backendTexture.fHeight = m_size.height(); |
- backendTexture.fConfig = kSkia8888_GrPixelConfig; |
- backendTexture.fTextureHandle = |
- skia::GrGLTextureInfoToGrBackendObject(textureInfo); |
- sk_sp<SkImage> skImage = |
- SkImage::MakeFromAdoptedTexture(grContext, backendTexture); |
- |
// We reuse the same mailbox name from above since our texture id was consumed |
// from it. |
const auto& skImageMailbox = textureMailbox.mailbox(); |
@@ -509,7 +496,8 @@ PassRefPtr<StaticBitmapImage> DrawingBuffer::transferToStaticBitmapImage() { |
// ImageBitmapRenderingContext's transferFromImageBitmap, and try to use them |
// in DrawingBuffer. |
return AcceleratedStaticBitmapImage::createFromWebGLContextImage( |
- std::move(skImage), skImageMailbox, skImageSyncToken); |
+ skImageMailbox, skImageSyncToken, textureId, |
+ m_weakPtrFactory.createWeakPtr(), m_size); |
} |
DrawingBuffer::ColorBufferParameters |