-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
net: Do not implement Serialize/Deserialize for RasterImage and introduce`SharedRasterImage
#40459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1d86d9e to
c1a4e39
Compare
mrobinson
left a comment
There was a problem hiding this 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>>, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
c1a4e39 to
3296850
Compare
Serialize/Deserialize for RasterImage and introduce`SharedRasterImage
mrobinson
left a comment
There was a problem hiding this 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.
RasterImage is now not seralizeable and backed by Vec storage. Add a new struct
SharedRasterImagethat 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.