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 15c0d7d160ec6683b95ff31e533008b179c5e04a..a5be12b00dc7830f248080ef794ff021f49d855b 100644 |
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
@@ -38,6 +38,7 @@ |
#include "platform/graphics/AcceleratedStaticBitmapImage.h" |
#include "platform/graphics/GraphicsLayer.h" |
#include "platform/graphics/ImageBuffer.h" |
+#include "platform/graphics/WebGraphicsContext3DProviderWrapper.h" |
#include "platform/graphics/gpu/Extensions3DUtil.h" |
#include "platform/tracing/TraceEvent.h" |
#include "public/platform/Platform.h" |
@@ -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(); |
@@ -504,12 +491,15 @@ PassRefPtr<StaticBitmapImage> DrawingBuffer::transferToStaticBitmapImage() { |
// because the texture id it generated would only be valid for the |
// DrawingBuffer's context anyways. |
const auto& skImageSyncToken = textureMailbox.sync_token(); |
+ WebGraphicsContext3DProviderWrapper* contextProvider = |
Justin Novosad
2016/11/08 19:38:54
This wrapper object is being leaked. DrawingBuffer
xidachen
2016/11/08 20:30:58
Done.
|
+ new WebGraphicsContext3DProviderWrapper(m_contextProvider.get()); |
// TODO(xidachen): Create a small pool of recycled textures from |
// ImageBitmapRenderingContext's transferFromImageBitmap, and try to use them |
// in DrawingBuffer. |
return AcceleratedStaticBitmapImage::createFromWebGLContextImage( |
- std::move(skImage), skImageMailbox, skImageSyncToken); |
+ skImageMailbox, skImageSyncToken, textureId, |
+ contextProvider->createWeakPtr(), m_size); |
} |
DrawingBuffer::ColorBufferParameters |