[Webkit-unassigned] [Bug 257581] Add support to GeneratedSerializers for move-only types

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 31 23:16:49 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=257581

--- Comment #1 from Kimmo Kinnunen <kkinnunen at apple.com> ---
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);
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230601/14fc80c5/attachment-0001.htm>


More information about the webkit-unassigned mailing list