Bug 257581
| Summary: | Add support to GeneratedSerializers for move-only types | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Matt Woodrow <mattwoodrow> |
| Component: | WebKit2 | Assignee: | Matt Woodrow <mattwoodrow> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | don.olmstead, kkinnunen, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=258608 | ||
| Bug Depends on: | |||
| Bug Blocks: | 257580 | ||
Matt Woodrow
We should be able to define types as being move-only, and generate appropriate serialisers for them.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Kimmo Kinnunen
This should not need much of additional markup in the .serializers.in file.
The fix should be to use different pattern to decode
std::optional<Ref<WebCore::TimingFunction>> ArgumentCoder<WebCore::TimingFunction>::decode(Decoder& decoder)
{
std::optional<WebCore_TimingFunction_Subclass> type;
decoder >> type;
if (!type)
return std::nullopt;
if (type == WebCore_TimingFunction_Subclass::LinearTimingFunction) {
std::optional<Ref<WebCore::LinearTimingFunction>> result;
decoder >> result;
if (!result)
return std::nullopt;
return WTFMove(*result);
}
should be
std::optional<Ref<WebCore::TimingFunction>> ArgumentCoder<WebCore::TimingFunction>::decode(Decoder& decoder)
{
auto type = decoder.decode<WebCore_TimingFunction_Subclass>();
if (UNLIKELY(!decoder.isValid()))
return std::nullopt;
if (type == WebCore_TimingFunction_Subclass::LinearTimingFunction) {
auto result = decoder.decode<Ref<WebCore::LinearTimingFunction>>()
if (UNLIKELY(!decoder.isValid()))
return std::nullopt;
return WTFMove(*result);
}
Matt Woodrow
Pull request: https://github.com/WebKit/WebKit/pull/14658
EWS
Committed 264912@main (6b8b65111faf): <https://commits.webkit.org/264912@main>
Reviewed commits have been landed. Closing PR #14658 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/110350309>