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

Unified Diff: Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

Issue 10377150: Merge 116587 - [chromium] Don't draw when canDraw() is false (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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: Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
===================================================================
--- Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (revision 117086)
+++ Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (working copy)
@@ -620,8 +620,18 @@
m_inputHandlerOnImplThread->animate(monotonicTime);
m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
+
+ // This method is called on a forced draw, regardless of whether we are able to produce a frame,
+ // as the calling site on main thread is blocked until its request completes, and we signal
+ // completion here. If canDraw() is false, we will indicate success=false to the caller, but we
+ // must still signal completion to avoid deadlock.
+
+ // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only
+ // be used when such a frame is possible. Since drawLayers() depends on the result of
+ // prepareToDraw(), it is guarded on canDraw() as well.
+
CCLayerTreeHostImpl::FrameData frame;
- bool drawFrame = m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw;
+ bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw);
if (drawFrame) {
m_layerTreeHostImpl->drawLayers(frame);
result.didDraw = true;
@@ -630,9 +640,11 @@
// Check for a pending compositeAndReadback.
if (m_readbackRequestOnImplThread) {
- ASSERT(drawFrame); // This should be a forcedDraw
- m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect);
- m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContextLost();
+ m_readbackRequestOnImplThread->success = false;
+ if (drawFrame) {
+ m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect);
+ m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContextLost();
+ }
m_readbackRequestOnImplThread->completion.signal();
m_readbackRequestOnImplThread = 0;
}
@@ -642,7 +654,6 @@
// Process any finish request
if (m_finishAllRenderingCompletionEventOnImplThread) {
- ASSERT(drawFrame); // This should be a forcedDraw
m_layerTreeHostImpl->finishAllRendering();
m_finishAllRenderingCompletionEventOnImplThread->signal();
m_finishAllRenderingCompletionEventOnImplThread = 0;
@@ -654,7 +665,6 @@
m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didCommitAndDrawFrame));
}
- ASSERT(drawFrame || (!drawFrame && !forcedDraw));
return result;
}
« no previous file with comments | « Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp ('k') | Source/WebKit/chromium/ChangeLog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698