Skip to content

Conversation

@mrobinson
Copy link
Member

@mrobinson mrobinson commented Nov 21, 2025

This is the last major change before we can try to implement support for
multiple windows in Servo. This change makes it so that each WebView
(via WebViewBuilder) takes the RenderingContext as an argument,
rather than Servo (via ServoBuilder) as a whole.

In the compositor, when registering the RenderingContext, if a
Painter is found for it, it is returned. Otherwise, a new Painter
(and WebRender instance) is created for it. There is currently no way to
unregister a RenderingContext. We should come up with a good metric
for when is the best time to clean up Painters and WebRender instances
for defunct RenderingContexts. This could perhaps be done via a Weak
handle to the RenderingContext.

Testing: This should not really change observable behavior, so should be
covered by existing tests.
Fixes: #13995
Closes: #40261

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 21, 2025
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 21, 2025
This is the last major change before we can try to implement support for
multiple windows in Servo. This change makes it so that each `WebView`
(via `WebViewBuilder`) takes the `RenderingContext` as an argument,
rather than `Servo` (via `ServoBuilder`) as a whole.

In the compositor, when registering the `RenderingContext`, if a
`Painter` is found for it, it is returned. Otherwise, a new `Painter`
(and WebRender instance) is created for it. There is currently no way to
unregister a `RenderingContext`. We should come up with a good metric
for when is the best time to clean up `Painter`s and WebRender instances
for defunct `RenderingContext`s. This could perhaps be done via a `Weak`
handle to the `RenderingContext`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
@mrobinson mrobinson force-pushed the libservo-webview-rendering-context branch from f5e64c8 to d202bbc Compare November 21, 2025 18:05
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 21, 2025
@mrobinson mrobinson enabled auto-merge November 21, 2025 18:05
@mrobinson mrobinson added this pull request to the merge queue Nov 21, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 21, 2025
Merged via the queue into servo:main with commit 3b67bc7 Nov 21, 2025
36 checks passed
@mrobinson mrobinson deleted the libservo-webview-rendering-context branch November 21, 2025 18:59
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple RenderingContexts WebViewBuilder should take a RenderingContext to specify where it renders

3 participants