[webkit-changes] [WebKit/WebKit] 4ad01b: generate-serializers.py should support nested cond...

Abrar Rahman Protyasha noreply at github.com
Wed Feb 7 12:03:37 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4ad01b4b62e7120bfc5bf78f62b5946884e2743a
      https://github.com/WebKit/WebKit/commit/4ad01b4b62e7120bfc5bf78f62b5946884e2743a
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
    M Source/WebKit/Scripts/generate-serializers.py
    M Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp
    M Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h
    M Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp
    M Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in

  Log Message:
  -----------
  generate-serializers.py should support nested conditions
https://bugs.webkit.org/show_bug.cgi?id=268519
rdar://122056394

Reviewed by Brady Eidson and Alex Christensen.

generate-serializers.py does not currently support nested conditions,
not because of a lack of intention, but just because there hasn't been a
need. However, with the proposed changes for https://webkit.org/b/267428,
the watchOS/tvOS/GTK ports fail to compile because several Apple Pay
enablement conditions are being stacked when declaring data types in
WebCoreArgumentCodersCocoa.serialization.in.

This patch addresses the issue by introducing support for nested
conditions in the serializer generation script. It does so by imbibing
the parse_serialized_types method with the concept of a stack of
conditions, pushing to the stack (or negating the top entry) when an IF
or ELSE is seen, respectively, and only popping from the stack when an
ENDIF is seen. The script now keeps an aggregated condition expression
by walking through the condition stack and logically concatenating
conditions.

* Source/WebKit/Scripts/generate-serializers.py:
(ConditionStackEntry):
(ConditionStackEntry.__init__):
(ConditionStackEntry.expression):
(generate_condition_expression):
(parse_serialized_types):
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp:
(IPC::ArgumentCoder<Namespace::OuterClass>::encode):
(IPC::ArgumentCoder<Namespace::OuterClass>::decode):
(IPC::ArgumentCoder<Namespace::OtherOuterClass>::encode):
(IPC::ArgumentCoder<Namespace::OtherOuterClass>::decode):
(WTF::isValidOptionSet<EnumNamespace2::OptionSetEnumType>):
(WTF::void>):
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h:
* Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp:
(WebKit::allSerializedTypes):
(WebKit::allSerializedEnums):
* Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in:

Canonical link: https://commits.webkit.org/274233@main




More information about the webkit-changes mailing list