[webkit-changes] [WebKit/WebKit] b807bf: [WK2] constexpr-ify IPC encoding, decoding of std:...

Žan Doberšek noreply at github.com
Thu Oct 13 12:12:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b807bfd9ce0a83f31884a9b093d37a127cca7d5a
      https://github.com/WebKit/WebKit/commit/b807bfd9ce0a83f31884a9b093d37a127cca7d5a
  Author: Žan Doberšek <zan at falconsigh.net>
  Date:   2022-10-13 (Thu, 13 Oct 2022)

  Changed paths:
    M Source/WebKit/Platform/IPC/ArgumentCoders.h

  Log Message:
  -----------
  [WK2] constexpr-ify IPC encoding, decoding of std::tuple<> objects
https://bugs.webkit.org/show_bug.cgi?id=246149

Reviewed by Kimmo Kinnunen.

Simplify the ArgumentCoder<std::tuple<>> specialization, removing helper structs
and leaning into constexpr for a finer implementation.

The encoding remains the same, just the helper struct's methods inlined into the
ArgumentCoder specialization.

The decoding methods are reworked to use constexpr to make compile-time codepaths.
For each desired element, decoding is done into std::optional<> values that are
then passed through tuples of rvalue references into recursive calls, with the
index sequence adjusted each time to address the next element. Once all elements
are successfully decoded, the final tuple is constructed, with the decoded objects
all moved into that tuple. If decoding was unsuccessful at any point, a nullopt
value is returned immediately, as before.

This avoids concatenating tuples that was occurring for each decoded element, and
was ending up moving each contained element into the concatenation result for each
such concatenation.

* Source/WebKit/Platform/IPC/ArgumentCoders.h:
(IPC::TupleEncoder::encode): Deleted.
(IPC::TupleDecoder<>::decode): Deleted.

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




More information about the webkit-changes mailing list