[Mac] Remove backing store for layers that are outside the viewport
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 05:04:14 +0000 (05:04 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 05:04:14 +0000 (05:04 +0000)
commit59c04282ff41c80bd954c0bf74551fdc900b4f0e
tree8094703140cbd66201eb0f1a798d6ed093257e61
parent1511163c4155a68140380ea91be41af02db7e872
[Mac] Remove backing store for layers that are outside the viewport
https://bugs.webkit.org/show_bug.cgi?id=170082
<rdar://problem/31245009>

Reviewed by Simon Fraser.

Source/WebCore:

Implement the backingStoreAttached flag in PlatformCALayerCocoa. This means that
compositing layers outside the tiling coverage rect will no longer have backing
stores, saving large amounts of memory.

Also added a canDetachBackingStore flag that is set to false for scroll control
layers, to avoid complicating coverage rect computations.

Test: compositing/backing-store-attachment-1.html

* page/Frame.h:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
(WebCore::GraphicsLayer::dumpProperties):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::backingStoreAttached):
(WebCore::GraphicsLayer::setCanDetachBackingStore):
(WebCore::GraphicsLayer::canDetachBackingStore):
* platform/graphics/GraphicsLayerClient.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::backingStoreAttached):
(WebCore::GraphicsLayerCA::setNeedsDisplay):
(WebCore::GraphicsLayerCA::updateCoverage):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::setBackingStoreAttached):
(PlatformCALayerCocoa::backingStoreAttached):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateOverflowControlsLayers):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerTreeAsText):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
* testing/Internals.cpp:
(WebCore::toLayerTreeFlags):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

LayoutTests:

Add a simple test with two compositing layers far apart vertically. Only one of them
should have its backing store attached.

* compositing/backing-store-attachment-1-expected.txt: Added.
* compositing/backing-store-attachment-1.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/backing-store-attachment-1-expected.txt [new file with mode: 0644]
LayoutTests/compositing/backing-store-attachment-1.html [new file with mode: 0644]
LayoutTests/platform/ios/compositing/backing-store-attachment-1-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/Frame.h
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/GraphicsLayerClient.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h