[GPU Process] Simplify DisplayList::Iterator part 6: Migrate ItemBufferWritingClient...
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 May 2021 09:52:48 +0000 (09:52 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 May 2021 09:52:48 +0000 (09:52 +0000)
commita4a0bfa37b850ed9a285785a8491ef413e91ee1a
tree217a42b749acdadd3a187c1cdca5962bee407d75
parent8c414a743188c82ff4374e5e9e6634545896d750
[GPU Process] Simplify DisplayList::Iterator part 6: Migrate ItemBufferWritingClient from ItemHandle to a const Variant&
https://bugs.webkit.org/show_bug.cgi?id=224270

Reviewed by Wenson Hsieh.

Source/WebCore:

This patch adds a new Variant that contains all the DisplayList item types, named DisplayListItem. It also migrates
ItemBufferWritingClient from ItemHandle to this new Variant.

There are two benefits to this:
1. The templated overload of ItemBuffer::append() is way simpler now. Previously, we used to allocate a byte buffer
       on the stack and run a placement new of the display list item type into it. Now, we can just run the DisplayListItem
       constructor instead. Using the Variant does require more stack space, but we only will ever have one of these objects
       on the stack at a time.
2. The big table inside RemoteImageBufferProxy::encodeItemOutOfLine() is gone, and is replaced with just 7 lines. This is
       one fewer place where we'll have to make sure the DisplayListItem types match a function in an entirely different
       framework.

No new tests, because there is no behavior change.

* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::copyInto):
(WebCore::DisplayList::safeCopyHelper):
(WebCore::DisplayList::safeCopy):
(WebCore::DisplayList::ItemBuffer::append):
* platform/graphics/displaylists/DisplayListItemBuffer.h:
(WebCore::DisplayList::ItemBufferWritingClient::requiredSizeForItem const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemOutOfLine const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemInline const):
(WebCore::DisplayList::ItemBuffer::append):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::paddedSizeOfTypeAndItemInBytes):
(WebCore::DisplayList::displayListItemType):
* platform/graphics/displaylists/DisplayListItems.h:
* platform/graphics/displaylists/InMemoryDisplayList.cpp:
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::requiredSizeForItem const):
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::encodeItemInline const):
* platform/graphics/displaylists/InMemoryDisplayList.h:

Source/WebKit:

* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::encodeItemOutOfLineHelper):

Tools:

* TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277244 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.h
Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/graphics/displaylists/InMemoryDisplayList.cpp
Source/WebCore/platform/graphics/displaylists/InMemoryDisplayList.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp
Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp