From e401f0c2d81b96df37afa879c72265847454b8ea Mon Sep 17 00:00:00 2001 From: "timothy_horton@apple.com" Date: Tue, 22 Jul 2014 01:26:24 +0000 Subject: [PATCH] Avoid putting empty-sized surfaces into IOSurfacePool https://bugs.webkit.org/show_bug.cgi?id=135136 Reviewed by Simon Fraser. * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::addSurface): Avoid adding 0x0 surfaces to the pool, because they will wreak havoc when their size is used as the key in the CachedSurfaceMap. Additionally, avoid any empty sizes, because they're just pointless. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171332 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 13 +++++++++++++ .../WebCore/platform/graphics/cg/IOSurfacePool.cpp | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 59ceee45e190..259278b1fd9b 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2014-07-21 Tim Horton + + Avoid putting empty-sized surfaces into IOSurfacePool + https://bugs.webkit.org/show_bug.cgi?id=135136 + + Reviewed by Simon Fraser. + + * platform/graphics/cg/IOSurfacePool.cpp: + (WebCore::IOSurfacePool::addSurface): + Avoid adding 0x0 surfaces to the pool, because they will wreak havoc + when their size is used as the key in the CachedSurfaceMap. + Additionally, avoid any empty sizes, because they're just pointless. + 2014-07-21 Beth Dakin WK1 should always setAcceleratedCompositingForFixedPositionEnabled(true) on diff --git a/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp b/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp index 0c609a81badd..a941c9305892 100644 --- a/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp +++ b/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp @@ -164,6 +164,11 @@ void IOSurfacePool::addSurface(IOSurface* surface) if (surface->totalBytes() > m_maximumBytesCached) return; + // There's no reason to pool empty surfaces; we should never allocate them in the first place. + // This also covers isZero(), which would cause trouble when used as the key in m_cachedSurfaces. + if (surface->size().isEmpty()) + return; + bool surfaceIsInUse = surface->isInUse(); willAddSurface(surface, surfaceIsInUse); -- 2.36.0