Index: third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp |
index f27638f7aef834f7366574b1e21f9b64b8a78930..7b9a8bbfa285390fd5a3a586b0ba58cedf01b0ef 100644 |
--- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp |
@@ -30,9 +30,8 @@ |
#include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" |
+#include "platform/graphics/gpu/SharedGpuContext.h" |
#include "platform/graphics/skia/SkiaUtils.h" |
-#include "public/platform/Platform.h" |
-#include "public/platform/WebGraphicsContext3DProvider.h" |
#include "skia/ext/texture_handle.h" |
#include "third_party/skia/include/gpu/GrContext.h" |
#include "wtf/PtrUtil.h" |
@@ -43,12 +42,11 @@ namespace blink { |
AcceleratedImageBufferSurface::AcceleratedImageBufferSurface(const IntSize& size, OpacityMode opacityMode, sk_sp<SkColorSpace> colorSpace) |
: ImageBufferSurface(size, opacityMode, colorSpace) |
{ |
- m_contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); |
- if (!m_contextProvider) |
- return; |
- GrContext* grContext = m_contextProvider->grContext(); |
- if (!grContext) |
+ if (!SharedGpuContext::isValid()) |
return; |
+ GrContext* grContext = SharedGpuContext::gr(); |
+ m_contextId = SharedGpuContext::contextId(); |
+ CHECK(grContext); |
SkAlphaType alphaType = (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), alphaType); |
@@ -60,6 +58,11 @@ AcceleratedImageBufferSurface::AcceleratedImageBufferSurface(const IntSize& size |
clear(); |
} |
+bool AcceleratedImageBufferSurface::isValid() const |
+{ |
+ return m_surface && SharedGpuContext::isValid() && m_contextId == SharedGpuContext::contextId(); |
+} |
+ |
sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint, SnapshotReason) |
{ |
return m_surface->makeImageSnapshot(); |