diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index b3dafcd0a482a..a017a9d03c6a7 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,26 @@ +2012-08-20 Alexandre Elias + + [chromium] Texture layer should not generate zero textureId quads + https://bugs.webkit.org/show_bug.cgi?id=94550 + + Reviewed by Adrienne Walker. + + After a context loss, CCTextureLayerImpl would clear its textureId + but continued to produce external resources and quads with the zero + textureid. Add early returns so that CCTextureLayerImpl becomes + inert after a context loss. + + Added assertion in read lock so that dontUseOldResourcesAfterLostContext + test catches the problem. + + * platform/graphics/chromium/cc/CCResourceProvider.h: + (WebCore::CCScopedLockResourceForRead::CCScopedLockResourceForRead): + * platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: + (WebCore::CCTextureLayerImpl::willDraw): + (WebCore::CCTextureLayerImpl::appendQuads): + (WebCore::CCTextureLayerImpl::didDraw): + (WebCore::CCTextureLayerImpl::didLoseContext): + 2012-08-20 Kent Tamura [Chromium] Make the popup positioning code testable diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h index b8733a1638fda..e927d292fcdc8 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h @@ -224,7 +224,10 @@ class CCScopedLockResourceForRead { CCScopedLockResourceForRead(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) : m_resourceProvider(resourceProvider) , m_resourceId(resourceId) - , m_textureId(resourceProvider->lockForRead(resourceId)) { } + , m_textureId(resourceProvider->lockForRead(resourceId)) + { + ASSERT(m_textureId); + } ~CCScopedLockResourceForRead() { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp index 4ad96e189b317..b981f713d1aff 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp @@ -52,20 +52,24 @@ CCTextureLayerImpl::~CCTextureLayerImpl() void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) { + if (!m_textureId) + return; ASSERT(!m_externalTextureResource); m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId); } void CCTextureLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { - ASSERT(m_externalTextureResource); + if (!m_externalTextureResource) + return; IntRect quadRect(IntPoint(), contentBounds()); quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped)); } void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) { - ASSERT(m_externalTextureResource); + if (!m_externalTextureResource) + return; // FIXME: the following assert will not be true when sending resources to a // parent compositor. A synchronization scheme (double-buffering or // pipelining of updates) for the client will need to exist to solve this. @@ -84,6 +88,7 @@ void CCTextureLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const void CCTextureLayerImpl::didLoseContext() { m_textureId = 0; + m_externalTextureResource = 0; } }