Chromium Code Reviews| 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 bb9cfa9e6d32867abdcbf4541e2a9eb8da4377f9..d690aad946af21ce539d3fca205646ba381569f4 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp |
| @@ -846,9 +846,9 @@ bool Canvas2DLayerBridge::checkSurfaceValid() { |
| bool Canvas2DLayerBridge::restoreSurface() { |
| DCHECK(!m_destructionInProgress); |
| - if (m_destructionInProgress) |
| + if (m_destructionInProgress || !isAccelerated()) |
|
xlai (Olivia)
2017/01/27 22:23:25
Why is this change related to the decoupling of fi
Justin Novosad
2017/02/07 21:52:29
I was getting DCHECK failures below in some of the
|
| return false; |
| - DCHECK(isAccelerated() && !m_surface); |
| + DCHECK(!m_surface); |
| gpu::gles2::GLES2Interface* sharedGL = nullptr; |
| m_layer->clearTexture(); |
| @@ -918,12 +918,6 @@ bool Canvas2DLayerBridge::PrepareTextureMailbox( |
| // 4. Here. |
| return false; |
| } |
| - DCHECK(isAccelerated() || isHibernating() || m_softwareRenderingWhileHidden); |
| - |
| - // if hibernating but not hidden, we want to wake up from |
| - // hibernation |
| - if ((isHibernating() || m_softwareRenderingWhileHidden) && isHidden()) |
| - return false; |
| // If the context is lost, we don't know if we should be producing GPU or |
| // software frames, until we get a new context, since the compositor will |
| @@ -933,6 +927,13 @@ bool Canvas2DLayerBridge::PrepareTextureMailbox( |
| GL_NO_ERROR) |
| return false; |
| + DCHECK(isAccelerated() || isHibernating() || m_softwareRenderingWhileHidden); |
|
xlai (Olivia)
2017/01/27 22:23:25
Same question.
Justin Novosad
2017/02/07 21:52:29
Same answer.
|
| + |
| + // if hibernating but not hidden, we want to wake up from |
| + // hibernation |
| + if ((isHibernating() || m_softwareRenderingWhileHidden) && isHidden()) |
| + return false; |
| + |
| sk_sp<SkImage> image = |
| newImageSnapshot(PreferAcceleration, SnapshotReasonUnknown); |
| if (!image || !image->getTexture()) |
| @@ -1062,17 +1063,22 @@ void Canvas2DLayerBridge::didDraw(const FloatRect& rect) { |
| m_didDrawSinceLastGpuFlush = true; |
| } |
| -void Canvas2DLayerBridge::prepareSurfaceForPaintingIfNeeded() { |
| +void Canvas2DLayerBridge::finalizeFrame() { |
| + DCHECK(!m_destructionInProgress); |
| + |
| + // Make sure surface is ready for painting: fix the rendering mode now |
| + // because it will be too late during the paint invalidation phase. |
| getOrCreateSurface(PreferAcceleration); |
| + |
| + if (m_rateLimiter) |
| + m_rateLimiter->reset(); |
| + m_renderingTaskCompletedForCurrentFrame = false; |
| } |
| -void Canvas2DLayerBridge::finalizeFrame(const FloatRect& dirtyRect) { |
| +void Canvas2DLayerBridge::doPaintInvalidation(const FloatRect& dirtyRect) { |
| DCHECK(!m_destructionInProgress); |
| if (m_layer && m_accelerationMode != DisableAcceleration) |
| m_layer->layer()->invalidateRect(enclosingIntRect(dirtyRect)); |
| - if (m_rateLimiter) |
| - m_rateLimiter->reset(); |
| - m_renderingTaskCompletedForCurrentFrame = false; |
| } |
| void Canvas2DLayerBridge::didProcessTask() { |