By-value serialization for display lists
Component: WebCore Display Lists | 68e51b9
Source/WebKit/GPUProcess/GPUProcess.messages.in
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
A display list is a recorded sequence of drawing commands replayed against a GraphicsContext. The GPU process builds them by replaying RemoteGraphicsContext IPC, so items can hold GPU-process-local objects such as fonts and image buffers. A remote snapshot composes per-frame display lists, with DrawPlaceholder items holding closures that draw another frame's content. Neither closures nor process-local references can cross a process boundary.
DisplayListData is a by-value IPC form of a display list plus every list it draws. Lists are stored in dependency order with the root last, an ordering meant to rule out forward references and cycles, and a list drawn more than once is encoded once. Value-only items reuse WebCore item classes with generated coders. DrawPlaceholder is resolved at encode time by drawing into a recorder and substituting the recorded list. Resource-bearing items (fonts, images, image buffers, gradients, filters, control parts, system images, graphics state) fail to encode for now. Whether the decoder enforces that ordering invariant on DrawDisplayListAtIndex indices is the first thing to audit. A GPU-process testing message exercises the round trip.
Significance
This is groundwork for sending completed remote snapshots from the GPU process to a dedicated print process, so embedded PDFs can print as vectors. It also creates a new cross-process deserialization path for display-list items that later changes will extend with resource-bearing items.
Audit directions
Nothing sends DisplayListData across processes yet; the only round trip runs inside the GPU process test, and RunDisplayListDataTestsForTesting is sent from the UI process, not WebContent. The decoder is still the right place to get ahead of the surface. The decoder logic lives in DisplayListData.cpp and the generated coders, so start the review there. Check how DrawDisplayListAtIndex references are validated on decode (out-of-range, self, and forward indices), since that ordering is the cycle defence. The generated coders accept whatever the item constructors accept, so path, geometry, and enum validation matter. Encode-side placeholder resolution runs arbitrary draw closures and relies on a failure path to stop self-reference, so check it for re-entrancy and mutation of the list being encoded, and check shared-list deduplication under large or deeply nested inputs. Most importantly, the "resource items fail to encode" deny-list is enforced only on the encode side. A compromised sender controls the bytes, so confirm the decoder also rejects those item types. The new WEBCORE_EXPORTs on DisplayList's TZone allocator and the DrawDisplayList/DrawPlaceholder members also widen what WebKit-side code can construct.