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
Make sure ImageData objects are shared when doing structured cloning #14605
Conversation
EWS run on previous version of this PR (hash d318b54) |
d318b54
to
d1e0764
Compare
EWS run on current version of this PR (hash d1e0764) |
EWS run on previous version of this PR (hash d1e0764) |
@@ -437,6 +437,7 @@ static const unsigned CurrentVersion = 13; | |||
static const unsigned TerminatorTag = 0xFFFFFFFF; | |||
static const unsigned StringPoolTag = 0xFFFFFFFE; | |||
static const unsigned NonIndexPropertiesTag = 0xFFFFFFFD; | |||
static const uint32_t ImageDataPoolTag = 0xFFFFFFFE; |
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.
In new code we want to use constexpr
.
@@ -2178,6 +2190,8 @@ class CloneSerializer : CloneBase { | |||
#endif | |||
typedef HashMap<RefPtr<UniquedStringImpl>, uint32_t, IdentifierRepHash> StringConstantPool; | |||
StringConstantPool m_constantPool; | |||
using ImageDataPool = HashMap<RefPtr<ImageData>, uint32_t>; |
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.
Ref
?
@@ -4072,6 +4091,18 @@ class CloneDeserializer : CloneBase { | |||
uint32_t width; | |||
if (!read(width)) | |||
return JSValue(); | |||
if (width == ImageDataPoolTag) { | |||
unsigned index = 0; |
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.
Seems like this would be better using std::optional
instead of an out argument.
d1e0764
to
a69b05f
Compare
EWS run on current version of this PR (hash a69b05f) |
EWS run on previous version of this PR (hash a69b05f) |
a69b05f
to
7bf6bc1
Compare
EWS run on current version of this PR (hash 7bf6bc1) |
https://bugs.webkit.org/show_bug.cgi?id=257626 Reviewed by Darin Adler. Make sure ImageData objects are shared when doing structured cloning so that if you send the same ImageData object is present multiple times in the object being serialized, the object identity is preserved after deserializing. * LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028-expected.txt: * Source/WebCore/bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneSerializer::writeImageDataIndex): (WebCore::CloneDeserializer::readImageDataIndex): (WebCore::CloneDeserializer::readTerminal): Canonical link: https://commits.webkit.org/264824@main
Committed 264824@main (dd1484f): https://commits.webkit.org/264824@main Reviewed commits have been landed. Closing PR #14605 and removing active labels. |
7bf6bc1
to
dd1484f
Compare
dd1484f
7bf6bc1
π§ͺ api-mac