Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated IPC decoders check the decode success twice
https://bugs.webkit.org/show_bug.cgi?id=258604 rdar://problem/111434133 Reviewed by Alex Christensen. The check would be like: decode property check success decode property check success On first decode error, the subsequent decodes will fail as per design. Thus we can omit the redundant caller checks and check only once after series of decodes, before using the decoded properties. Instead of checking each decode operation result, check as follows: decode properties if (!decoder.isValid()) return std::nullopt; use properties decode more properties if (!decoder.isValid()) return std::nullopt; use properties This should, very slightly, optimize for the standard case of all decodes succeeding. * Source/WebKit/Scripts/generate-serializers.py: (decode_type): (generate_impl): * Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp: (IPC::ArgumentCoder<Namespace::Subnamespace::StructName>::decode): (IPC::ArgumentCoder<Namespace::OtherClass>::decode): (IPC::ArgumentCoder<Namespace::ReturnRefClass>::decode): (IPC::ArgumentCoder<Namespace::EmptyConstructorStruct>::decode): (IPC::ArgumentCoder<Namespace::EmptyConstructorNullable>::decode): (IPC::ArgumentCoder<WithoutNamespace>::decode): (IPC::ArgumentCoder<WithoutNamespaceWithAttributes>::decode): (IPC::ArgumentCoder<WebCore::InheritsFrom>::decode): (IPC::ArgumentCoder<WebCore::InheritanceGrandchild>::decode): (IPC::ArgumentCoder<WTF::Seconds>::decode): (IPC::ArgumentCoder<WTF::CreateUsingClass>::decode): (IPC::ArgumentCoder<WebCore::FloatBoxExtent>::decode): (IPC::ArgumentCoder<NullableSoftLinkedMember>::decode): (IPC::ArgumentCoder<WebCore::TimingFunction>::decode): (IPC::ArgumentCoder<Namespace::ConditionalCommonClass>::decode): (IPC::ArgumentCoder<Namespace::CommonClass>::decode): (IPC::ArgumentCoder<Namespace::AnotherCommonClass>::decode): (IPC::ArgumentCoder<WebCore::MoveOnlyBaseClass>::decode): (IPC::ArgumentCoder<WebCore::MoveOnlyDerivedClass>::decode): Canonical link: https://commits.webkit.org/265717@main
- Loading branch information