Connect worker process to compositor#10727
Merged
kalenikaliaksandr merged 2 commits intoJul 17, 2026
Merged
Conversation
The CompositorConnection and the CompositorHost implementation driving it lived in Services/WebContent, which only WebContent can link. The WebWorker process is about to need the same plumbing so OffscreenCanvas contexts created in workers can stream canvas commands to the Compositor process. Move CompositorConnection into LibWebView unchanged, and pull the reusable part of WebContentCompositorHost into a new WebView::CompositorHostBase whose subclasses supply the connection. WebContent keeps a thin subclass that routes context-destruction notifications back to its client connection. LibWebView now links LibMedia because the moved connection encodes Media::VideoFrame for the video frame update messages. No behavior change.
OffscreenCanvas contexts in dedicated workers need to stream canvas commands to the Compositor process, but worker processes only had RequestServer and ImageDecoder connections, and WebWorker::PageHost reported no compositor support, so every remote-canvas creation path no-ops in a worker. Mint a Compositor transport for each spawned worker in the UI process (reusing the same control-channel handshake WebContent uses; the returned connection id is only meaningful for navigable contexts, which workers never create) and send it over the worker's control socket before start_worker, so the connection exists before any worker script can run. The worker wraps it in the shared WebView::CompositorConnection and exposes it through a WebWorkerCompositorHost via the PageClient compositor virtuals, making page.compositor_host() work in worker realms the same way it does in WebContent. Minting failure is tolerated: the worker then runs in the same degraded no-canvas mode WebContent enters when the Compositor is unavailable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preparation work for OffscreenCanvas support.