Index: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp |
index a5731bd3c5c3724706613592ce59578c5172c540..6f67537b926fb7ccafd374d4c73c038d0ac7a91b 100644 |
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp |
@@ -90,17 +90,6 @@ static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size, |
return fromSkSp(surface); |
} |
-PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) |
-{ |
- TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_SCOPE_GLOBAL); |
- std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); |
- if (!contextProvider) |
- return nullptr; |
- RefPtr<Canvas2DLayerBridge> layerBridge; |
- layerBridge = adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), size, msaaSampleCount, opacityMode, accelerationMode)); |
- return layerBridge.release(); |
-} |
- |
Canvas2DLayerBridge::Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) |
: m_contextProvider(std::move(contextProvider)) |
, m_logger(wrapUnique(new Logger)) |
@@ -803,6 +792,12 @@ bool Canvas2DLayerBridge::PrepareTextureMailbox( |
return false; |
} |
+ // If the context is lost, we don't know if we should be producing GPU or |
danakj
2016/08/22 22:57:44
I made Canvas2DLB check for context loss explicitl
|
+ // software frames, until we get a new context, since the compositor will |
+ // be trying to get a new context and may change modes. |
+ if (m_contextProvider->contextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) |
+ return false; |
+ |
RefPtr<SkImage> image = newImageSnapshot(PreferAcceleration, SnapshotReasonUnknown); |
if (!image || !image->getTexture()) |
return false; |