[webkit-changes] [WebKit/WebKit] 4e2a24: [WK2] Provide IPC encoding, decoding helper method...

Žan Doberšek noreply at github.com
Tue Jan 31 11:11:01 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4e2a24122f1668f09693e0df1510bd07da46fe46
      https://github.com/WebKit/WebKit/commit/4e2a24122f1668f09693e0df1510bd07da46fe46
  Author: Žan Doberšek <zdobersek at igalia.com>
  Date:   2023-01-31 (Tue, 31 Jan 2023)

  Changed paths:
    M Source/WTF/wtf/ArgumentCoder.h
    M Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.h
    M Source/WebCore/platform/mediastream/RealtimeMediaSourceCapabilities.h
    M Source/WebKit/Platform/IPC/ArgumentCoders.h
    M Source/WebKit/Platform/IPC/Decoder.h
    M Source/WebKit/Platform/IPC/Encoder.h
    M Source/WebKit/Platform/IPC/StreamConnectionEncoder.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.h
    M Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp

  Log Message:
  -----------
  [WK2] Provide IPC encoding, decoding helper methods for objects
https://bugs.webkit.org/show_bug.cgi?id=250785

Reviewed by Kimmo Kinnunen.

Provide helper methods for encoding trivially-copyable objects on the IPC
encoder and decoder classes. These would be used instead of encoding and
decoding these objects as fixed-length data. That would of course still be done
internally, but through a nicer interface.

encodeObject() on the IPC::Encoder and IPC::StreamConnectionEncoder classes
takes a given object of a trivially-copyable type and encodes it as fixed-length
data through a single-element Span. decodeObject() on the IPC::Decoder class
reverses that, decoding a single-element Span and returning an object of a
trivially-copyable type.

Remaining uses of encodeFixedLengthData() and decodeFixedLengthData() methods
are replaced with the new alternatives.

* Source/WTF/wtf/ArgumentCoder.h:
(IPC::ArgumentCoder<bool>::decode):
* Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.h:
(WebCore::CAAudioStreamDescription::encode const):
(WebCore::CAAudioStreamDescription::decode):
* Source/WebCore/platform/mediastream/RealtimeMediaSourceCapabilities.h:
(WebCore::CapabilityValueOrRange::encode const):
(WebCore::CapabilityValueOrRange::decode):
* Source/WebKit/Platform/IPC/ArgumentCoders.h:
(IPC::SimpleArgumentCoder::encode):
(IPC::SimpleArgumentCoder::decode):
* Source/WebKit/Platform/IPC/Decoder.h:
(IPC::Decoder::decodeObject):
* Source/WebKit/Platform/IPC/Encoder.h:
(IPC::Encoder::encodeObject):
* Source/WebKit/Platform/IPC/StreamConnectionEncoder.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<RectEdges<bool>>::decode):
(IPC::ArgumentCoder<ViewportArguments>::decode):
* Source/WebKit/Shared/WebCoreArgumentCoders.h:
* Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<LOGFONT>::encode):
(IPC::ArgumentCoder<LOGFONT>::decode):

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




More information about the webkit-changes mailing list