Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Unified Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 2653933003: Make stream captures work on canvases that are not in the DOM. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698