[webkit-changes] [WebKit/WebKit] f2796e: IPC::Semaphore waits don't terminate if the remote...

mattwoodrow noreply at github.com
Mon Sep 18 14:54:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f2796edab1163daa5bb37135f7fee0dbe58f577e
      https://github.com/WebKit/WebKit/commit/f2796edab1163daa5bb37135f7fee0dbe58f577e
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h
    M Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.messages.in
    A Source/WebKit/Platform/IPC/IPCEvent.h
    M Source/WebKit/Platform/IPC/IPCSemaphore.h
    M Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm
    A Source/WebKit/Platform/IPC/darwin/IPCEventDarwin.cpp
    M Source/WebKit/Platform/IPC/darwin/IPCSemaphoreDarwin.cpp
    M Source/WebKit/Platform/SourcesCocoa.txt
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/IPC/EventTests.cpp

  Log Message:
  -----------
  IPC::Semaphore waits don't terminate if the remote process crashes and can cause hangs.
https://bugs.webkit.org/show_bug.cgi?id=260690
<rdar://114591255>

Reviewed by Kimmo Kinnunen.

This introduces new IPC::Event and Signal classes (implemented properly for cocoa
only so far) that can detect crashes (by the 'Signal' instance being destroyed).
It reimplements a semaphore using a mach_port_t, and uses no sender notifications to
detect when the last MachSendRight (owned by the Signal component) is released.

* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::setFlushSignal):
(WebKit::RemoteDisplayListRecorder::flushContext):
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h:
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in:
* Source/WebKit/Platform/IPC/IPCEvent.h: Added.
(IPC::Signal::signal):
(IPC::Signal::encode):
(IPC::Signal::decode):
(IPC::Signal::Signal):
(IPC::Event::Event):
(IPC::Event::operator=):
(IPC::Event::wait):
(IPC::Event::waitFor):
(IPC::createEventSignalPair):
* Source/WebKit/Platform/IPC/IPCSemaphore.h:
* Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm:
* Source/WebKit/Platform/IPC/darwin/IPCEventDarwin.cpp: Added.
(IPC::requestNoSenderNotifications):
(IPC::clearNoSenderNotifications):
(IPC::Signal::signal):
(IPC::Signal::encode):
(IPC::Signal::decode):
(IPC::createEventSignalPair):
(IPC::Event::~Event):
(IPC::Event::wait):
(IPC::Event::waitFor):
* Source/WebKit/Platform/IPC/darwin/IPCSemaphoreDarwin.cpp:
* Source/WebKit/Platform/SourcesCocoa.txt:
* Source/WebKit/Scripts/webkit/messages.py:
(types_that_must_be_moved):
(types_that_cannot_be_forward_declared):
(argument_coder_headers_for_type):
(headers_for_type):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::setFlushSignal):
(WebKit::RemoteDisplayListRecorderProxy::flushContext):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxyFlushFence::create):
(WebKit::RemoteImageBufferProxyFlushFence::waitFor):
(WebKit::RemoteImageBufferProxyFlushFence::tryTakeEvent):
(WebKit::RemoteImageBufferProxyFlushFence::RemoteImageBufferProxyFlushFence):
(WebKit::RemoteImageBufferProxy::flushDrawingContextAsync):
(WebKit::RemoteImageBufferProxyFlushFence::tryTakeSemaphore): Deleted.

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




More information about the webkit-changes mailing list