[webkit-changes] [WebKit/WebKit] 04253f: [WK2] Add ArgumentCoder<std::unique_ptr<T>> specia...

Žan Doberšek noreply at github.com
Sat Dec 10 05:08:01 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 04253f86f805ac7b882535bdfc2feb3f148a3808
      https://github.com/WebKit/WebKit/commit/04253f86f805ac7b882535bdfc2feb3f148a3808
  Author: Žan Doberšek <zdobersek at igalia.com>
  Date:   2022-12-10 (Sat, 10 Dec 2022)

  Changed paths:
    M Source/WebKit/Platform/IPC/ArgumentCoders.h
    M Source/WebKit/Scripts/generate-serializers.py
    M Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp
    M Tools/TestWebKitAPI/Tests/IPC/ArgumentCoderTests.cpp

  Log Message:
  -----------
  [WK2] Add ArgumentCoder<std::unique_ptr<T>> specialization
https://bugs.webkit.org/show_bug.cgi?id=249022

Reviewed by Kimmo Kinnunen.

Add the ArgumentCoder<std::unique_ptr<T>> specialization, supporting
encoding and decoding such objects. The logic follows similar
specializations like the ones for std::optional<T> or RefPtr<T>.

This can be used to replace std::unique_ptr<T> special-casing in the
generate-serializers.py script, since the logic of encoding and decoding
is identical.

The testing baseline for the generated serializers code is updated. Test
cases covering std::unique_ptr<T> variants in ArgumentCoderTests suite
are added.

* Source/WebKit/Platform/IPC/ArgumentCoders.h:
(IPC::ArgumentCoder<std::unique_ptr<T>>::encode):
(IPC::ArgumentCoder<std::unique_ptr<T>>::decode):
* Source/WebKit/Scripts/generate-serializers.py:
(MemberVariable.__init__):
(encode_type):
(decode_type):
(MemberVariable.unique_ptr_type): Deleted.
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp:
(IPC::ArgumentCoder<Namespace::ReturnRefClass>::encode):
(IPC::ArgumentCoder<Namespace::ReturnRefClass>::decode):
* Tools/TestWebKitAPI/Tests/IPC/ArgumentCoderTests.cpp:
(TestWebKitAPI::TEST_P):
(TestWebKitAPI::TEST_F):

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




More information about the webkit-changes mailing list