[webkit-changes] [WebKit/WebKit] bd0da0: IPC::Attachment is used as an encoded type on Unix

Kimmo Kinnunen noreply at github.com
Thu Sep 15 04:44:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd0da08a754582fb65d029cdbbd6268de8e16a68
      https://github.com/WebKit/WebKit/commit/bd0da08a754582fb65d029cdbbd6268de8e16a68
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2022-09-15 (Thu, 15 Sep 2022)

  Changed paths:
    M Source/WebKit/Platform/IPC/Attachment.h
    M Source/WebKit/Platform/IPC/unix/AttachmentUnix.cpp
    M Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp
    M Source/WebKit/Platform/SharedMemory.h
    M Source/WebKit/Platform/unix/SharedMemoryUnix.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp
    M Source/WebKit/UIProcess/API/wpe/PageClientImpl.h

  Log Message:
  -----------
  IPC::Attachment is used as an encoded type on Unix
https://bugs.webkit.org/show_bug.cgi?id=244925
rdar://problem/99684383

Reviewed by Žan Doberšek.

IPC::Attachment is an attachment to the encoded and decoded data.
The attachment itself should not be encoded or decoded.
This causes problems:
 - SharedMemory implementations of other platforms are harder
   to maintain
 - General IPC code related to attachments are harder to
   implement
 - Unix connection implementation is more complex than it should
   be.

The SharedMemory::Handle should encode the size of the underlying
memory object, pointed by the file descriptor. The file descriptor
is the attachment that should be sent via domain sockets.
Removes the size from the IPC::Attachment, and make the IPC file
descriptor message structures. Simplifies the implementation
because the IPC::Attachment transfers only file descriptor type,
where as before it would transfer socket type and shared memory type.

* Source/WebKit/Platform/IPC/Attachment.h:
(IPC::Attachment::Attachment::isNull const):
(IPC::Attachment::Attachment::size const): Deleted.
* Source/WebKit/Platform/IPC/unix/AttachmentUnix.cpp:
(IPC::Attachment::Attachment):
(IPC::Attachment::operator=):
* Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::AttachmentInfo::type const):
(IPC::Connection::processMessage):
(IPC::Connection::sendOutputMessage):
(IPC::AttachmentInfo::setSize): Deleted.
(IPC::AttachmentInfo::size const): Deleted.
* Source/WebKit/Platform/SharedMemory.h:
* Source/WebKit/Platform/unix/SharedMemoryUnix.cpp:
(WebKit::SharedMemory::Handle::clear):
(WebKit::SharedMemory::Handle::isNull const):
(WebKit::SharedMemory::Handle::encode const):
(WebKit::SharedMemory::Handle::decode):
(WebKit::createSharedMemory):
(WebKit::SharedMemory::allocate):
(WebKit::SharedMemory::map):
(WebKit::SharedMemory::wrapMap):
(WebKit::SharedMemory::~SharedMemory):
(WebKit::SharedMemory::createHandle):

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




More information about the webkit-changes mailing list