NEW 224314
[GPU Process] Simplify DisplayList::Iterator part 7: Migrate ItemBufferReadingClient from ItemHandle to a const Variant&
https://bugs.webkit.org/show_bug.cgi?id=224314
Summary [GPU Process] Simplify DisplayList::Iterator part 7: Migrate ItemBufferReadin...
Myles C. Maxfield
Reported 2021-04-07 18:55:15 PDT
[GPU Process] Simplify DisplayList::Iterator part 7: Migrate ItemBufferReadingClient from ItemHandle to a const Variant&
Attachments
Patch (23.90 KB, patch)
2021-04-07 18:58 PDT, Myles C. Maxfield
darin: review+
Patch for committing (20.39 KB, patch)
2021-05-09 02:08 PDT, Myles C. Maxfield
no flags
Patch for committing (19.79 KB, patch)
2021-05-09 02:19 PDT, Myles C. Maxfield
no flags
Patch for committing (20.57 KB, patch)
2021-05-09 03:12 PDT, Myles C. Maxfield
no flags
Myles C. Maxfield
Comment 1 2021-04-07 18:58:32 PDT
Radar WebKit Bug Importer
Comment 2 2021-04-14 18:56:15 PDT
Darin Adler
Comment 3 2021-04-17 22:08:17 PDT
Comment on attachment 425469 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425469&action=review > Source/WebCore/platform/graphics/displaylists/DisplayList.cpp:397 > + m_isValid = false; > + if (auto decodedItem = client->decodeItem(startOfData, dataLength, itemType)) { > + if (safeCopy(decodedItem.value(), ItemHandle { m_currentBufferForItem })) > + m_isValid = true; > + } I often prefer the form *decodedItem to the form decodedItem.value(). Not sure I understand the meaning of the word "safe" in this function name. Since we are setting a boolean, seems like we could stick with a single if statement instead of two. > Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.h:85 > +bool safeCopy(const DisplayListItem& source, ItemHandle destination); Copying from the left argument into the right argument goes against C tradition and functions like memcpy and strcpy. > Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:2285 > +using DisplayListItem = Variant< It’s hard to keep this in "logical" order. I suggest alphabetical order instead when the list is this long. Like includes, with conditional sections at the bottom also in alphabetical order.
Myles C. Maxfield
Comment 4 2021-04-21 15:53:49 PDT
Comment on attachment 425469 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425469&action=review >> Source/WebCore/platform/graphics/displaylists/DisplayList.cpp:397 >> + } > > I often prefer the form *decodedItem to the form decodedItem.value(). > > Not sure I understand the meaning of the word "safe" in this function name. > > Since we are setting a boolean, seems like we could stick with a single if statement instead of two. Do you mean like if (auto decodedItem = client->decodeItem(startOfData, dataLength, itemType); safeCopy(decodedItem.value(), ItemHandle { m_currentBufferForItem })) m_isValid = true; ?
Darin Adler
Comment 5 2021-04-21 16:18:15 PDT
Comment on attachment 425469 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425469&action=review >>> Source/WebCore/platform/graphics/displaylists/DisplayList.cpp:397 >>> + } >> >> I often prefer the form *decodedItem to the form decodedItem.value(). >> >> Not sure I understand the meaning of the word "safe" in this function name. >> >> Since we are setting a boolean, seems like we could stick with a single if statement instead of two. > > Do you mean like > > if (auto decodedItem = client->decodeItem(startOfData, dataLength, itemType); safeCopy(decodedItem.value(), ItemHandle { m_currentBufferForItem })) > m_isValid = true; > > ? I actually meant this: if (auto decodedItem = client->decodeItem(startOfData, dataLength, itemType)) m_isValid = safeCopy(*decodedItem, ItemHandle { m_currentBufferForItem });
Myles C. Maxfield
Comment 6 2021-05-09 01:48:17 PDT
Comment on attachment 425469 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425469&action=review > Source/WebCore/platform/graphics/displaylists/DisplayList.cpp:395 > + if (safeCopy(decodedItem.value(), ItemHandle { m_currentBufferForItem })) I need to add a comment around this copy operation saying that it's temporary and will be removed in a later patch.
Myles C. Maxfield
Comment 7 2021-05-09 02:08:54 PDT
Created attachment 428119 [details] Patch for committing
Myles C. Maxfield
Comment 8 2021-05-09 02:19:50 PDT
Created attachment 428120 [details] Patch for committing
Myles C. Maxfield
Comment 9 2021-05-09 03:12:02 PDT
Created attachment 428122 [details] Patch for committing
Myles C. Maxfield
Comment 10 2021-05-09 03:58:26 PDT
I'm going to wait to land this until https://bugs.webkit.org/show_bug.cgi?id=225579 is ready, so I can land them both together. This patch introduces an extra copy that will end up getting deleted in that patch, and I don't want to cause a regression.
Myles C. Maxfield
Comment 11 2021-05-09 15:14:42 PDT
Comment on attachment 428122 [details] Patch for committing View in context: https://bugs.webkit.org/attachment.cgi?id=428122&action=review > Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp:629 > + using I = typename WTF::RemoveCVAndReference<decltype(type)>::type::type; We can apply the treatment from https://bugs.webkit.org/show_bug.cgi?id=225579#c8 here.
Note You need to log in before you can comment on or make changes to this bug.