haikuwebkit/LayoutTests/compositing/backing/backing-store-attachment-ou...

36 lines
789 B
Plaintext
Raw Permalink Normal View History

https://hackernoon.com/ uses lots of layer backing store https://bugs.webkit.org/show_bug.cgi?id=186909 rdar://problem/40257540 Reviewed by Tim Horton. Source/bmalloc: Drive-by typo fix. * bmalloc/Scavenger.cpp: (bmalloc::dumpStats): Source/WebCore: The existing "backing store detached" logic, which was used to eliminate backing store for compositing layers outside the viewport, had a number of bugs that allowed layers to have backing store when they should not. Specifically, any code path that ended up in setNeedsDisplay{InRect}() in PlatformCALayer could trigger backing store creation on layers that should have never had any. Rather than monkeypatch all the GraphicsLayerCA call sites that call setNeedsDisplay{InRect}(), just bail early from the PlatformCALayer* methods that trigger repaints. Tests didn't catch this because they just dumped the state of the backingStoreAttached flag. To fix this, create backingStoreAttachedForTesting() which also tests whether the layer has contents. Test: compositing/backing/backing-store-attachment-outside-viewport.html * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::dumpProperties const): (showGraphicsLayerTree): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::backingStoreAttachedForTesting const): * platform/graphics/GraphicsLayerClient.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::backingStoreAttachedForTesting const): (WebCore::GraphicsLayerCA::setNeedsDisplay): * platform/graphics/ca/GraphicsLayerCA.h: * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayerCocoa::setNeedsDisplay): (PlatformCALayerCocoa::setNeedsDisplayInRect): (PlatformCALayerCocoa::hasContents const): Source/WebKit: PlatformCALayerRemote was actually holding onto backing stores for layers with backing store detached, which could increase memory use. When told that backing stores are not attached, explicitly throw away the backing, and re-create it (via setNeedsDisplay) when attached. This is now similar to what PlatformLayerCACocoa does. * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::setNeedsDisplayInRect): (WebKit::PlatformCALayerRemote::setNeedsDisplay): (WebKit::PlatformCALayerRemote::hasContents const): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: LayoutTests: New test. * compositing/backing/backing-store-attachment-outside-viewport-expected.txt: Added. * compositing/backing/backing-store-attachment-outside-viewport.html: Added. Canonical link: https://commits.webkit.org/202357@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-27 18:22:06 +00:00
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 785.00 3821.00)
(backingStoreAttached 1)
(children 1
(GraphicsLayer
(bounds 785.00 3821.00)
(contentsOpaque 1)
(backingStoreAttached 1)
(children 3
(GraphicsLayer
(position 8.00 13.00)
(bounds 600.00 600.00)
(drawsContent 1)
(backingStoreAttached 1)
)
(GraphicsLayer
(position 8.00 1613.00)
(bounds 600.00 600.00)
(drawsContent 1)
(backingStoreAttached 0)
)
(GraphicsLayer
(position 8.00 3213.00)
(bounds 600.00 600.00)
(drawsContent 1)
(backingStoreAttached 0)
)
)
)
)
)
I'm attached.
I'm detached.
I'm detached. Triggers repaint