Chromium Code Reviews| 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..85a1dcd32ed4bd3368287d7f61e0f7dd8ee55c8a 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" |
| @@ -142,13 +143,15 @@ DrawingBuffer::DrawingBuffer( |
| : m_client(client), |
| m_preserveDrawingBuffer(preserve), |
| m_webGLVersion(webGLVersion), |
| - m_contextProvider(std::move(contextProvider)), |
| - m_gl(m_contextProvider->contextGL()), |
| + m_contextProvider(wrapUnique( |
| + new WebGraphicsContext3DProviderWrapper(std::move(contextProvider)))), |
| + m_gl(m_contextProvider->contextProvider()->contextGL()), |
| m_extensionsUtil(std::move(extensionsUtil)), |
| m_discardFramebufferSupported(discardFramebufferSupported), |
| m_wantAlphaChannel(wantAlphaChannel), |
| m_premultipliedAlpha(premultipliedAlpha), |
| - m_softwareRendering(m_contextProvider->isSoftwareRendering()), |
| + m_softwareRendering( |
| + m_contextProvider->contextProvider()->isSoftwareRendering()), |
|
Justin Novosad
2016/11/08 20:41:50
No need for m_contextProvider->
Just:
m_softwareRe
xidachen
2016/11/08 21:01:54
Done.
|
| m_wantDepth(wantDepth), |
| m_wantStencil(wantStencil), |
| m_chromiumImageUsage(chromiumImageUsage) { |
| @@ -185,7 +188,7 @@ gpu::gles2::GLES2Interface* DrawingBuffer::contextGL() { |
| } |
| WebGraphicsContext3DProvider* DrawingBuffer::contextProvider() { |
| - return m_contextProvider.get(); |
| + return m_contextProvider->contextProvider(); |
| } |
| void DrawingBuffer::setIsHidden(bool hidden) { |
| @@ -442,7 +445,7 @@ PassRefPtr<StaticBitmapImage> DrawingBuffer::transferToStaticBitmapImage() { |
| // This can be null if the context is lost before the first call to |
| // grContext(). |
| - GrContext* grContext = m_contextProvider->grContext(); |
| + GrContext* grContext = m_contextProvider->contextProvider()->grContext(); |
|
Justin Novosad
2016/11/08 20:41:50
No need for "m_contextProvider->"
xidachen
2016/11/08 21:01:54
Done.
|
| cc::TextureMailbox textureMailbox; |
| std::unique_ptr<cc::SingleReleaseCallback> releaseCallback; |
| @@ -481,20 +484,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 +498,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_contextProvider->createWeakPtr(), m_size); |
| } |
| DrawingBuffer::ColorBufferParameters |