From 9989426944ed18f171dbbf71234ed5c53b2d450b Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Thu, 4 Aug 2011 17:10:50 -0700 Subject: Fix a potential sync problem for TransferQueue bug:5044597 Change-Id: Id8cd326774a174a537f2b104d934539269395151 --- .../platform/graphics/android/TransferQueue.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/TransferQueue.cpp') diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp index ae94b2e..a4fd594 100644 --- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp @@ -158,21 +158,38 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex, GL glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO // Add a sync point here to WAR a driver bug. - glViewport(0,0,0,0); + glViewport(0, 0, 0, 0); TilesManager::instance()->shader()->drawQuad(rect, destTex->m_ownTextureId, 1.0, GL_TEXTURE_2D); GLUtils::checkGlError("copy the surface texture into the normal one"); } +void TransferQueue::interruptTransferQueue(bool interrupt) +{ + m_transferQueueItemLocks.lock(); + m_interruptedByRemovingOp = interrupt; + if (m_interruptedByRemovingOp) + m_transferQueueItemCond.signal(); + m_transferQueueItemLocks.unlock(); +} + +// This function must be called inside the m_transferQueueItemLocks, for the +// wait, m_interruptedByRemovingOp and getHasGLContext(). +// Only called by updateQueueWithBitmap() for now. bool TransferQueue::readyForUpdate() { if (!getHasGLContext()) return false; // Don't use a while loop since when the WebView tear down, the emptyCount // will still be 0, and we bailed out b/c of GL context lost. - if (!m_emptyItemCount) + if (!m_emptyItemCount) { + if (m_interruptedByRemovingOp) + return false; m_transferQueueItemCond.wait(m_transferQueueItemLocks); + if (m_interruptedByRemovingOp) + return false; + } if (!getHasGLContext()) return false; -- cgit v1.1