Skip to content

Conversation

@Narfinger
Copy link
Contributor

@Narfinger Narfinger commented Nov 6, 2025

RasterImage is now not seralizeable and backed by Vec storage. Add a new struct SharedRasterImage that allows serializeing. This can be constructed from RasterImage. This introduces some more copying but I think the tradeoff is ok. Newly introduced copies are for favicon response to the embedder and EmbedderNotifications.

Testing: Should not change functionality, so covered by existing tests.
Fixes: #39626 and related issues.

@Narfinger Narfinger force-pushed the image-cache-no-ipc branch 2 times, most recently from 1d86d9e to c1a4e39 Compare November 6, 2025 13:21
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few minor comments...

pub icon_url: Option<ServoUrl>,
/// Icon's raw image data and metadata.
pub icon_resource: Option<Arc<RasterImage>>,
pub icon_resource: Option<Arc<SharedRasterImage>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave all of these types as RasterImage but implement a From<SharedRasterImage> for RasterImage and just call into() when filling these fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notification is Serializable, so I think we need to keep this SharedRasterImage.

Add a new struct `SharedRasterImage` that allows serializeing. This can
be constructed from RasterImage.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
@Narfinger Narfinger marked this pull request as ready for review November 6, 2025 16:10
@Narfinger Narfinger requested a review from gterzian as a code owner November 6, 2025 16:10
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 6, 2025
@mrobinson mrobinson changed the title net: Disallow RasterImage to be serialized and introduce SharedRasterImage net: Do not implement Serialize/Deserialize for RasterImage and introduce`SharedRasterImage Nov 7, 2025
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's give this a shot. If we notice a large performance regression we can revert it. I think we have eliminated a few copies in the image code already, so I'm pretty sure this is okay.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 7, 2025
@mrobinson mrobinson added this pull request to the merge queue Nov 7, 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 7, 2025
Merged via the queue into servo:main with commit 3bfd107 Nov 7, 2025
37 checks passed
@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 7, 2025
@Narfinger Narfinger deleted the image-cache-no-ipc branch November 10, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speedometer 3.1 crashes due to "too many open files"

3 participants