Diff
Modified: trunk/Source/WTF/ChangeLog (272304 => 272305)
--- trunk/Source/WTF/ChangeLog 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WTF/ChangeLog 2021-02-03 11:13:06 UTC (rev 272305)
@@ -1,3 +1,17 @@
+2021-02-03 Kimmo Kinnunen <[email protected]>
+
+ MachSemaphore does not work well with IPC messages
+ https://bugs.webkit.org/show_bug.cgi?id=220919
+ <rdar://problem/73826848>
+
+ Reviewed by Sam Weinig.
+
+ Move WTF::MachSemaphore to WebKit IPC::Semaphore. Currently the
+ MachSemaphore is useful only in cross-process IPC, implemented by the
+ IPC::.
+
+ * WTF.xcodeproj/project.pbxproj:
+
2021-02-02 Said Abou-Hallawa <[email protected]>
[macOS] Force loading the HEIF reader symbols before transcoding any HEIF image
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (272304 => 272305)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2021-02-03 11:13:06 UTC (rev 272305)
@@ -68,7 +68,6 @@
3337DB9CE743410FAF076E17 /* StackTrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 313EDEC9778E49C9BEA91CFC /* StackTrace.cpp */; };
4427C5AA21F6D6C300A612A4 /* ASCIICType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4427C5A921F6D6C300A612A4 /* ASCIICType.cpp */; };
46BEB6EB22FFE24900269867 /* RefCounted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46BEB6E922FFDDD500269867 /* RefCounted.cpp */; };
- 46CB6B3D258AD93F006333B3 /* MachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46BAA9C8258AD5A500795877 /* MachSemaphore.cpp */; };
50DE35F5215BB01500B979C7 /* ExternalStringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50DE35F3215BB01500B979C7 /* ExternalStringImpl.cpp */; };
515F794E1CFC9F4A00CCED93 /* CrossThreadCopier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515F794B1CFC9F4A00CCED93 /* CrossThreadCopier.cpp */; };
517F82D71FD22F3000DA3DEA /* CrossThreadTaskHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517F82D51FD22F2F00DA3DEA /* CrossThreadTaskHandler.cpp */; };
@@ -378,8 +377,6 @@
4427C5A921F6D6C300A612A4 /* ASCIICType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASCIICType.cpp; sourceTree = "<group>"; };
4468567225094FE8008CCA05 /* ThreadSanitizerSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSanitizerSupport.h; sourceTree = "<group>"; };
46BA9EAB1F4CD61E009A2BBC /* CompletionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompletionHandler.h; sourceTree = "<group>"; };
- 46BAA9C8258AD5A500795877 /* MachSemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachSemaphore.cpp; sourceTree = "<group>"; };
- 46BAA9C9258AD5A500795877 /* MachSemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachSemaphore.h; sourceTree = "<group>"; };
46BEB6E922FFDDD500269867 /* RefCounted.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RefCounted.cpp; sourceTree = "<group>"; };
50DE35F3215BB01500B979C7 /* ExternalStringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExternalStringImpl.cpp; sourceTree = "<group>"; };
50DE35F4215BB01500B979C7 /* ExternalStringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExternalStringImpl.h; sourceTree = "<group>"; };
@@ -1548,8 +1545,6 @@
143DDE9520C8BC37007F76FA /* Entitlements.mm */,
A331D95E21F249F6009F02AA /* FileSystemCocoa.mm */,
1C503BE523AAE0AE0072E66B /* LanguageCocoa.mm */,
- 46BAA9C8258AD5A500795877 /* MachSemaphore.cpp */,
- 46BAA9C9258AD5A500795877 /* MachSemaphore.h */,
7A6EBA3320746C34004F9C44 /* MachSendRight.cpp */,
A8A472C5151A825A004123FF /* MainThreadCocoa.mm */,
ADF2CE651E39F106006889DB /* MemoryFootprintCocoa.cpp */,
@@ -1708,7 +1703,6 @@
0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */,
93B5B45122171EEA004B7AA7 /* Logger.cpp in Sources */,
53534F2A1EC0E10E00141B2F /* MachExceptions.defs in Sources */,
- 46CB6B3D258AD93F006333B3 /* MachSemaphore.cpp in Sources */,
7A6EBA3420746C34004F9C44 /* MachSendRight.cpp in Sources */,
A8A473E5151A825B004123FF /* MainThread.cpp in Sources */,
A8A473E4151A825B004123FF /* MainThreadCocoa.mm in Sources */,
Deleted: trunk/Source/WTF/wtf/cocoa/MachSemaphore.cpp (272304 => 272305)
--- trunk/Source/WTF/wtf/cocoa/MachSemaphore.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WTF/wtf/cocoa/MachSemaphore.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "MachSemaphore.h"
-
-#include <mach/mach.h>
-
-namespace WTF {
-
-MachSemaphore::MachSemaphore()
-{
- auto ret = semaphore_create(mach_task_self(), &m_semaphore, SYNC_POLICY_FIFO, 0);
- ASSERT_UNUSED(ret, ret == KERN_SUCCESS);
-}
-
-MachSemaphore::MachSemaphore(MachSendRight&& sendRight)
- : m_sendRight(WTFMove(sendRight))
- , m_semaphore(m_sendRight.sendRight())
-{
- ASSERT(m_sendRight);
-}
-
-MachSemaphore::~MachSemaphore()
-{
- if (!m_sendRight)
- semaphore_destroy(mach_task_self(), m_semaphore);
-}
-
-void MachSemaphore::signal()
-{
- semaphore_signal(m_semaphore);
-}
-
-void MachSemaphore::wait()
-{
- semaphore_wait(m_semaphore);
-}
-
-void MachSemaphore::waitFor(Seconds timeout)
-{
- auto seconds = timeout.secondsAs<unsigned>();
- semaphore_timedwait(m_semaphore, { seconds, static_cast<clock_res_t>(timeout.nanosecondsAs<uint64_t>() - seconds * NSEC_PER_SEC) });
-}
-
-MachSendRight MachSemaphore::createSendRight()
-{
- return MachSendRight::create(m_semaphore);
-}
-
-} // namespace WTF
Deleted: trunk/Source/WTF/wtf/cocoa/MachSemaphore.h (272304 => 272305)
--- trunk/Source/WTF/wtf/cocoa/MachSemaphore.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WTF/wtf/cocoa/MachSemaphore.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <mach/semaphore.h>
-#include <wtf/MachSendRight.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/Seconds.h>
-
-namespace WTF {
-
-class MachSemaphore {
- WTF_MAKE_FAST_ALLOCATED;
- WTF_MAKE_NONCOPYABLE(MachSemaphore);
-public:
- WTF_EXPORT_PRIVATE MachSemaphore();
- WTF_EXPORT_PRIVATE explicit MachSemaphore(MachSendRight&&);
- WTF_EXPORT_PRIVATE ~MachSemaphore();
-
- WTF_EXPORT_PRIVATE void signal();
- WTF_EXPORT_PRIVATE void wait();
- WTF_EXPORT_PRIVATE void waitFor(Seconds);
-
- WTF_EXPORT_PRIVATE MachSendRight createSendRight();
-
-private:
- MachSendRight m_sendRight;
- semaphore_t m_semaphore { SEMAPHORE_NULL };
-};
-
-} // namespace WTF
-
-using WTF::MachSemaphore;
Modified: trunk/Source/WebKit/ChangeLog (272304 => 272305)
--- trunk/Source/WebKit/ChangeLog 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/ChangeLog 2021-02-03 11:13:06 UTC (rev 272305)
@@ -1,3 +1,137 @@
+2021-02-03 Kimmo Kinnunen <[email protected]>
+
+ MachSemaphore does not work well with IPC messages
+ https://bugs.webkit.org/show_bug.cgi?id=220919
+ <rdar://problem/73826848>
+
+ Reviewed by Sam Weinig.
+
+ Move WTF::MachSemaphore to WebKit IPC::Semaphore. Currently the
+ MachSemaphore is useful only in cross-process IPC, implemented by the
+ IPC::.
+
+ Adds a stub IPC::Semaphore to all non-COCOA platforms, so that
+ constructors do not need to ifdef'ed to be able to compile platforms
+ that do not yet support GPU process fully.
+
+ Implement move constructor and move assignment operator for Semaphore.
+ Makes it possible to create types that hold Semaphore but still are
+ decode()able from a IPC message. The decoded objects are held with
+ Optional, and this forces the subobjects to have move assignment
+ operator.
+
+ Add asserts that the moved-away object is not used. Add the asserts as
+ asserts on the call return values, so the values are also checked on
+ normal objects on normal operation.
+
+ Implement an encoder and decoder for IPC::Semaphore. Makes it possible
+ to send it via IPC as its own type, not as MachSendRight.
+
+ As an example, changes existing uses of MachSendRight for semaphores in
+ messages as Semaphores, described below.
+
+ No new tests, a refactor.
+
+ * GPUProcess/GPUConnectionToWebProcess.cpp:
+ (WebKit::GPUConnectionToWebProcess::createRenderingBackend):
+ * GPUProcess/GPUConnectionToWebProcess.h:
+ * GPUProcess/GPUConnectionToWebProcess.messages.in:
+ * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+ (WebKit::RemoteRenderingBackend::create):
+ (WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
+ (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
+ * GPUProcess/graphics/RemoteRenderingBackend.h:
+ * Shared/RemoteRenderingBackendCreationParameters.h: Removed.
+ Changes RemoteRenderingBackend to receive its parameters from the normal
+ message parameters instead of redundant
+ RemoteRenderingBackendCreationParameters. The IPC generator already
+ generates 1:1 identical structure, it is just the message
+ Messages::GPUConnectionToWebProcess::CreateRenderingBackend. There is no
+ need to double-wrap the simple list of parameters. The double-wrapping
+ is a problem: The message system parameters are of ownership "const
+ reference", which is what is expected.
+ RemoteRenderingBackendCreationParameters contents were of ownership
+ "value", which works as expected only for simple primitive types.
+ Essentially previously calling the IPC function meant transfering
+ objects to RemoteRenderingBackendCreationParameters. This is not how the
+ IPC system is meant to work. The intention of a IPC call is to, by
+ default, reference its arguments for the purpose of encoding.
+
+ * GPUProcess/media/RemoteAudioDestinationManager.cpp:
+ (WebKit::RemoteAudioDestination::create):
+ (WebKit::RemoteAudioDestination::RemoteAudioDestination):
+ (WebKit::RemoteAudioDestinationManager::createAudioDestination):
+ * GPUProcess/media/RemoteAudioDestinationManager.h:
+ * GPUProcess/media/RemoteAudioDestinationManager.messages.in:
+
+ Receive the semaphore from RemoteAudioDestinationProxy. Previously
+ it was created during RemoteAudioDestination creation and
+ be sent back by RemoteAudioDestinationManager.
+
+ * Platform/IPC/Semaphore.cpp: Renamed from Source/WTF/wtf/cocoa/MachSemaphore.cpp.
+ (IPC::Semaphore::encode const):
+ (IPC::Semaphore::decode):
+ * Platform/IPC/Semaphore.h: Renamed from Source/WTF/wtf/cocoa/MachSemaphore.h.
+ (IPC::Semaphore::operator bool const):
+ * Platform/IPC/cocoa/SemaphoreCocoa.cpp: Added.
+ (IPC::Semaphore::Semaphore):
+ (IPC::Semaphore::~Semaphore):
+ (IPC::Semaphore::operator=):
+ (IPC::Semaphore::signal):
+ (IPC::Semaphore::wait):
+ (IPC::Semaphore::waitFor):
+ (IPC::Semaphore::createSendRight const):
+ (IPC::Semaphore::encode const):
+ (IPC::Semaphore::decode):
+ (IPC::Semaphore::destroy):
+ * Scripts/webkit/messages.py:
+ * Scripts/webkit/messages_unittest.py:
+ * Scripts/webkit/tests/Makefile:
+ * Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
+ (IPC::jsValueForArguments):
+ (IPC::messageArgumentDescriptions):
+ * Scripts/webkit/tests/MessageNames.cpp:
+ (IPC::description):
+ (IPC::receiverName):
+ (IPC::isValidMessageName):
+ * Scripts/webkit/tests/MessageNames.h:
+ * Scripts/webkit/tests/TestWithMachSemaphore.messages.in: Copied from Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in.
+ * Scripts/webkit/tests/TestWithMachSemaphoreMessageReceiver.cpp: Added.
+ * Scripts/webkit/tests/TestWithMachSemaphoreMessages.h: Added.
+ * Scripts/webkit/tests/TestWithMachSemaphoreMessagesReplies.h: Added.
+ * Sources.txt:
+ * SourcesCocoa.txt:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
+ (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess):
+ * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
+ * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
+ (WebKit::RemoteAudioDestinationProxy::startRenderingThread):
+ (WebKit::RemoteAudioDestinationProxy::stopRenderingThread):
+ Change the semaphore usage from unique_ptr to the normal
+ object access. The semaphore is now created by the proxy,
+ so there is no unique_ptr.
+
+ (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess):
+ (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose):
+ * WebProcess/GPU/media/RemoteAudioDestinationProxy.h:
+
+ Changes RemoteAudioDestinationProxy to send its own semaphore from
+ WebProcess to GPUProcess. Previously the semaphore would be sent back by
+ RemoteAudioDestinationManager. Previously the code structure is more
+ complicated than neccessary, as the semaphore holder was being
+ null-checked, reset and re-seated. The WebProcess gets already to choose
+ the semaphores GPUProcess uses, so this should not increase security
+ surface. The change chosen here side-steps the shortcoming of the IPC
+ system where unpacking objects from the Reply messages mandates that a
+ constructed version of that type exists. For previous MachSendRight
+ empty-constructed object is simple, but for MachSemaphore
+ empty-constructed object creates unnecessary complication that is not
+ required otherwise at the moment. The alternative to what was chosen
+ here would be to hold with Optional<MachSemaphore> and add a
+ empty-initializing constructor to hold the object where to unpack the
+ semaphore object from the Reply.
+
2021-02-03 Carlos Garcia Campos <[email protected]>
[GTK][WPE] Reduce the use of SoupURI in preparation for libsoup3
Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -48,7 +48,6 @@
#include "RemoteMediaResourceManager.h"
#include "RemoteMediaResourceManagerMessages.h"
#include "RemoteRenderingBackend.h"
-#include "RemoteRenderingBackendCreationParameters.h"
#include "RemoteSampleBufferDisplayLayerManager.h"
#include "RemoteSampleBufferDisplayLayerManagerMessages.h"
#include "RemoteSampleBufferDisplayLayerMessages.h"
@@ -291,10 +290,10 @@
}
#endif
-void GPUConnectionToWebProcess::createRenderingBackend(RemoteRenderingBackendCreationParameters&& parameters)
+void GPUConnectionToWebProcess::createRenderingBackend(RenderingBackendIdentifier identifier, IPC::Semaphore&& resumeDisplayListSemaphore)
{
- auto addResult = m_remoteRenderingBackendMap.ensure(parameters.identifier, [&]() {
- return makeUnique<RemoteRenderingBackendWrapper>(RemoteRenderingBackend::create(*this, WTFMove(parameters)));
+ auto addResult = m_remoteRenderingBackendMap.ensure(identifier, [&]() {
+ return makeUnique<RemoteRenderingBackendWrapper>(RemoteRenderingBackend::create(*this, identifier, WTFMove(resumeDisplayListSemaphore)));
});
ASSERT_UNUSED(addResult, addResult.isNewEntry);
}
Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -65,7 +65,6 @@
class RemoteSampleBufferDisplayLayerManager;
class UserMediaCaptureManagerProxy;
struct RemoteAudioSessionConfiguration;
-struct RemoteRenderingBackendCreationParameters;
class GPUConnectionToWebProcess
: public ThreadSafeRefCounted<GPUConnectionToWebProcess, WTF::DestructionThread::Main>
@@ -127,7 +126,7 @@
#endif
#endif
- void createRenderingBackend(RemoteRenderingBackendCreationParameters&&);
+ void createRenderingBackend(RenderingBackendIdentifier, IPC::Semaphore&& resumeDisplayListSemaphore);
void releaseRenderingBackend(RenderingBackendIdentifier);
#if ENABLE(WEBGL)
Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in 2021-02-03 11:13:06 UTC (rev 272305)
@@ -23,7 +23,7 @@
#if ENABLE(GPU_PROCESS)
messages -> GPUConnectionToWebProcess WantsDispatchMessage {
- void CreateRenderingBackend(struct WebKit::RemoteRenderingBackendCreationParameters parameters)
+ void CreateRenderingBackend(WebKit::RenderingBackendIdentifier identifier, IPC::Semaphore resumeDisplayListSemaphore)
void ReleaseRenderingBackend(WebKit::RenderingBackendIdentifier renderingBackendIdentifier)
#if ENABLE(WEBGL)
void CreateGraphicsContextGL(struct WebCore::GraphicsContextGLAttributes attributes, WebKit::GraphicsContextGLIdentifier graphicsContextGLIdentifier)
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -33,16 +33,13 @@
#include "PlatformRemoteImageBuffer.h"
#include "RemoteMediaPlayerManagerProxy.h"
#include "RemoteMediaPlayerProxy.h"
-#include "RemoteRenderingBackendCreationParameters.h"
#include "RemoteRenderingBackendMessages.h"
#include "RemoteRenderingBackendProxyMessages.h"
+#include "Semaphore.h"
#include <wtf/CheckedArithmetic.h>
#include <wtf/SystemTracing.h>
#include <wtf/WorkQueue.h>
-#if PLATFORM(COCOA)
-#include <wtf/cocoa/MachSemaphore.h>
-#endif
#define TERMINATE_WEB_PROCESS_WITH_MESSAGE(message) \
RELEASE_LOG_FAULT(IPC, "Requesting termination of web process %" PRIu64 " for reason: %" PUBLIC_LOG_STRING, m_gpuConnectionToWebProcess->webProcessIdentifier().toUInt64(), #message); \
@@ -65,18 +62,16 @@
namespace WebKit {
using namespace WebCore;
-Ref<RemoteRenderingBackend> RemoteRenderingBackend::create(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RemoteRenderingBackendCreationParameters&& parameters)
+Ref<RemoteRenderingBackend> RemoteRenderingBackend::create(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier identifier, IPC::Semaphore&& resumeDisplayListSemaphore)
{
- return adoptRef(*new RemoteRenderingBackend(gpuConnectionToWebProcess, WTFMove(parameters)));
+ return adoptRef(*new RemoteRenderingBackend(gpuConnectionToWebProcess, identifier, WTFMove(resumeDisplayListSemaphore)));
}
-RemoteRenderingBackend::RemoteRenderingBackend(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RemoteRenderingBackendCreationParameters&& parameters)
+RemoteRenderingBackend::RemoteRenderingBackend(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier identifier, IPC::Semaphore&& resumeDisplayListSemaphore)
: m_workQueue(WorkQueue::create("RemoteRenderingBackend work queue", WorkQueue::Type::Serial, WorkQueue::QOS::UserInteractive))
, m_gpuConnectionToWebProcess(gpuConnectionToWebProcess)
- , m_renderingBackendIdentifier(parameters.identifier)
-#if PLATFORM(COCOA)
- , m_resumeDisplayListSemaphore(makeUnique<MachSemaphore>(WTFMove(parameters.sendRightForResumeDisplayListSemaphore)))
-#endif
+ , m_renderingBackendIdentifier(identifier)
+ , m_resumeDisplayListSemaphore(WTFMove(resumeDisplayListSemaphore))
{
ASSERT(RunLoop::isMain());
gpuConnectionToWebProcess.connection().addWorkQueueMessageReceiver(Messages::RemoteRenderingBackend::messageReceiverName(), m_workQueue, this, m_renderingBackendIdentifier.toUInt64());
@@ -231,7 +226,7 @@
handle.startWaiting();
#if PLATFORM(COCOA)
- m_resumeDisplayListSemaphore->waitFor(30_us);
+ m_resumeDisplayListSemaphore.waitFor(30_us);
#else
sleep(30_us);
#endif
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -35,6 +35,7 @@
#include "MessageSender.h"
#include "RemoteResourceCache.h"
#include "RenderingBackendIdentifier.h"
+#include "Semaphore.h"
#include <WebCore/ColorSpace.h>
#include <WebCore/DisplayList.h>
#include <WebCore/DisplayListItems.h>
@@ -41,11 +42,6 @@
#include <WebCore/DisplayListReplayer.h>
#include <wtf/WeakPtr.h>
-#if PLATFORM(COCOA)
-namespace WTF {
-class MachSemaphore;
-}
-#endif
namespace WebCore {
namespace DisplayList {
@@ -62,7 +58,6 @@
class DisplayListReaderHandle;
class GPUConnectionToWebProcess;
-struct RemoteRenderingBackendCreationParameters;
class RemoteRenderingBackend
: private IPC::MessageSender
@@ -69,7 +64,8 @@
, public IPC::Connection::WorkQueueMessageReceiver
, public WebCore::DisplayList::ItemBufferReadingClient {
public:
- static Ref<RemoteRenderingBackend> create(GPUConnectionToWebProcess&, RemoteRenderingBackendCreationParameters&&);
+
+ static Ref<RemoteRenderingBackend> create(GPUConnectionToWebProcess&, RenderingBackendIdentifier, IPC::Semaphore&& resumeDisplayListSemaphore);
virtual ~RemoteRenderingBackend();
RemoteResourceCache& remoteResourceCache() { return m_remoteResourceCache; }
@@ -86,7 +82,7 @@
void disconnect();
private:
- RemoteRenderingBackend(GPUConnectionToWebProcess&, RemoteRenderingBackendCreationParameters&&);
+ RemoteRenderingBackend(GPUConnectionToWebProcess&, RenderingBackendIdentifier, IPC::Semaphore&&);
Optional<WebCore::DisplayList::ItemHandle> WARN_UNUSED_RETURN decodeItem(const uint8_t* data, size_t length, WebCore::DisplayList::ItemType, uint8_t* handleLocation) override;
@@ -148,9 +144,7 @@
RenderingBackendIdentifier m_renderingBackendIdentifier;
HashMap<WebCore::DisplayList::ItemBufferIdentifier, RefPtr<DisplayListReaderHandle>> m_sharedDisplayListHandles;
Optional<PendingWakeupInformation> m_pendingWakeupInfo;
-#if PLATFORM(COCOA)
- std::unique_ptr<WTF::MachSemaphore> m_resumeDisplayListSemaphore;
-#endif
+ IPC::Semaphore m_resumeDisplayListSemaphore;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -29,9 +29,9 @@
#if ENABLE(GPU_PROCESS) && ENABLE(WEB_AUDIO)
#include "GPUConnectionToWebProcess.h"
+#include "Semaphore.h"
#include <WebCore/AudioUtilities.h>
#include <wtf/ThreadSafeRefCounted.h>
-#include <wtf/threads/BinarySemaphore.h>
#if PLATFORM(COCOA)
#include "SharedRingBufferStorage.h"
@@ -39,7 +39,6 @@
#include <WebCore/CAAudioStreamDescription.h>
#include <WebCore/CARingBuffer.h>
#include <WebCore/WebAudioBufferList.h>
-#include <wtf/cocoa/MachSemaphore.h>
#endif
namespace WebKit {
@@ -52,9 +51,9 @@
{
public:
static Ref<RemoteAudioDestination> create(GPUConnectionToWebProcess& connection, RemoteAudioDestinationIdentifier identifier,
- const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate)
+ const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate, IPC::Semaphore&& renderSemaphore)
{
- return adoptRef(*new RemoteAudioDestination(connection, identifier, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, hardwareSampleRate));
+ return adoptRef(*new RemoteAudioDestination(connection, identifier, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, hardwareSampleRate, WTFMove(renderSemaphore)));
}
virtual ~RemoteAudioDestination() = default;
@@ -68,8 +67,6 @@
}
#if PLATFORM(COCOA)
- MachSendRight createRenderSemaphoreSendRight() { return m_renderSemaphore.createSendRight(); }
-
void audioSamplesStorageChanged(const SharedMemory::IPCHandle& ipcHandle, const WebCore::CAAudioStreamDescription& description, uint64_t numberOfFrames)
{
m_ringBuffer = makeUniqueRef<WebCore::CARingBuffer>(makeUniqueRef<ReadOnlySharedRingBufferStorage>(ipcHandle.handle), description, numberOfFrames);
@@ -104,12 +101,13 @@
bool isPlaying() const { return m_isPlaying; }
private:
- RemoteAudioDestination(GPUConnectionToWebProcess&, RemoteAudioDestinationIdentifier identifier, const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate)
+ RemoteAudioDestination(GPUConnectionToWebProcess&, RemoteAudioDestinationIdentifier identifier, const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate, IPC::Semaphore&& renderSemaphore)
: m_id(identifier)
#if PLATFORM(COCOA)
, m_audioOutputUnitAdaptor(*this)
, m_ringBuffer(makeUniqueRef<WebCore::CARingBuffer>())
#endif
+ , m_renderSemaphore(WTFMove(renderSemaphore))
{
#if PLATFORM(COCOA)
m_audioOutputUnitAdaptor.configure(hardwareSampleRate, numberOfOutputChannels);
@@ -148,9 +146,9 @@
WebCore::AudioOutputUnitAdaptor m_audioOutputUnitAdaptor;
UniqueRef<WebCore::CARingBuffer> m_ringBuffer;
- MachSemaphore m_renderSemaphore;
uint64_t m_startFrame { 0 };
#endif
+ IPC::Semaphore m_renderSemaphore;
bool m_isPlaying { false };
};
@@ -162,16 +160,12 @@
RemoteAudioDestinationManager::~RemoteAudioDestinationManager() = default;
-void RemoteAudioDestinationManager::createAudioDestination(const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate, CreationCompletionHandler&& completionHandler)
+void RemoteAudioDestinationManager::createAudioDestination(const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate, IPC::Semaphore&& renderSemaphore, CompletionHandler<void(const WebKit::RemoteAudioDestinationIdentifier)>&& completionHandler)
{
auto newID = RemoteAudioDestinationIdentifier::generateThreadSafe();
- auto destination = RemoteAudioDestination::create(m_gpuConnectionToWebProcess, newID, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, hardwareSampleRate);
+ auto destination = RemoteAudioDestination::create(m_gpuConnectionToWebProcess, newID, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, hardwareSampleRate, WTFMove(renderSemaphore));
m_audioDestinations.add(newID, destination.copyRef());
-#if PLATFORM(COCOA)
- completionHandler(newID, destination->createRenderSemaphoreSendRight());
-#else
completionHandler(newID);
-#endif
}
void RemoteAudioDestinationManager::deleteAudioDestination(RemoteAudioDestinationIdentifier identifier, CompletionHandler<void()>&& completionHandler)
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.h (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -29,6 +29,7 @@
#include "Connection.h"
#include "RemoteAudioDestinationIdentifier.h"
+#include "Semaphore.h"
#include "SharedMemory.h"
#include <memory>
#include <wtf/CompletionHandler.h>
@@ -38,10 +39,6 @@
namespace WebCore {
class CAAudioStreamDescription;
}
-
-namespace WTF {
-class MachSendRight;
-}
#endif
namespace WebKit {
@@ -63,12 +60,8 @@
void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
-#if PLATFORM(COCOA)
- using CreationCompletionHandler = CompletionHandler<void(RemoteAudioDestinationIdentifier, WTF::MachSendRight)>;
-#else
- using CreationCompletionHandler = CompletionHandler<void(RemoteAudioDestinationIdentifier)>;
-#endif
- void createAudioDestination(const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate, CreationCompletionHandler&&);
+ void createAudioDestination(const String& inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate, IPC::Semaphore&& renderSemaphore, CompletionHandler<void(const WebKit::RemoteAudioDestinationIdentifier)>&&);
+
void deleteAudioDestination(RemoteAudioDestinationIdentifier, CompletionHandler<void()>&&);
void startAudioDestination(RemoteAudioDestinationIdentifier, CompletionHandler<void(bool)>&&);
void stopAudioDestination(RemoteAudioDestinationIdentifier, CompletionHandler<void(bool)>&&);
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.messages.in (272304 => 272305)
--- trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.messages.in 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.messages.in 2021-02-03 11:13:06 UTC (rev 272305)
@@ -24,12 +24,7 @@
#if ENABLE(GPU_PROCESS) && ENABLE(WEB_AUDIO)
messages -> RemoteAudioDestinationManager NotRefCounted {
-#if PLATFORM(COCOA)
- CreateAudioDestination(String inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate) -> (WebKit::RemoteAudioDestinationIdentifier identifier, MachSendRight renderSemaphoreSendRight) Synchronous
-#endif
-#if !PLATFORM(COCOA)
- CreateAudioDestination(String inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate) -> (WebKit::RemoteAudioDestinationIdentifier identifier) Synchronous
-#endif
+ CreateAudioDestination(String inputDeviceId, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, float sampleRate, float hardwareSampleRate, IPC::Semaphore renderSemaphore) -> (WebKit::RemoteAudioDestinationIdentifier identifier) Synchronous
DeleteAudioDestination(WebKit::RemoteAudioDestinationIdentifier identifier) -> () Async
Copied: trunk/Source/WebKit/Platform/IPC/Semaphore.cpp (from rev 272304, trunk/Source/WTF/wtf/cocoa/MachSemaphore.cpp) (0 => 272305)
--- trunk/Source/WebKit/Platform/IPC/Semaphore.cpp (rev 0)
+++ trunk/Source/WebKit/Platform/IPC/Semaphore.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Semaphore.h"
+
+#if !OS(DARWIN)
+
+namespace IPC {
+
+Semaphore::Semaphore() = default;
+
+Semaphore::Semaphore(Semaphore&&) = default;
+
+Semaphore::~Semaphore() = default;
+
+Semaphore& Semaphore::operator=(Semaphore&&) = default;
+
+void Semaphore::encode(Encoder&) const { }
+
+Optional<Semaphore> Semaphore::decode(Decoder&)
+{
+ return Semaphore { };
+}
+
+}
+
+#endif
Copied: trunk/Source/WebKit/Platform/IPC/Semaphore.h (from rev 272304, trunk/Source/WTF/wtf/cocoa/MachSemaphore.h) (0 => 272305)
--- trunk/Source/WebKit/Platform/IPC/Semaphore.h (rev 0)
+++ trunk/Source/WebKit/Platform/IPC/Semaphore.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Noncopyable.h>
+#include <wtf/Optional.h>
+#include <wtf/Seconds.h>
+
+#if OS(DARWIN)
+#include <mach/semaphore.h>
+#include <wtf/MachSendRight.h>
+#endif
+
+namespace IPC {
+
+class Decoder;
+class Encoder;
+
+class Semaphore {
+ WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(Semaphore);
+public:
+ Semaphore();
+ Semaphore(Semaphore&&);
+ ~Semaphore();
+ Semaphore& operator=(Semaphore&&);
+
+ void encode(Encoder&) const;
+ static Optional<Semaphore> decode(Decoder&);
+
+#if OS(DARWIN)
+ explicit Semaphore(MachSendRight&&);
+
+ void signal();
+ void wait();
+ void waitFor(Seconds);
+ MachSendRight createSendRight() const;
+ explicit operator bool() const { return m_sendRight || m_semaphore != SEMAPHORE_NULL; }
+#else
+ explicit operator bool() const { return true; }
+#endif
+
+private:
+#if OS(DARWIN)
+ void destroy();
+ MachSendRight m_sendRight;
+ semaphore_t m_semaphore { SEMAPHORE_NULL };
+#endif
+};
+
+} // namespace IPC
Added: trunk/Source/WebKit/Platform/IPC/darwin/SemaphoreDarwin.cpp (0 => 272305)
--- trunk/Source/WebKit/Platform/IPC/darwin/SemaphoreDarwin.cpp (rev 0)
+++ trunk/Source/WebKit/Platform/IPC/darwin/SemaphoreDarwin.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Semaphore.h"
+
+#include "WebCoreArgumentCoders.h"
+#include <mach/mach.h>
+
+namespace IPC {
+
+Semaphore::Semaphore()
+{
+ auto ret = semaphore_create(mach_task_self(), &m_semaphore, SYNC_POLICY_FIFO, 0);
+ ASSERT_UNUSED(ret, ret == KERN_SUCCESS);
+}
+
+Semaphore::Semaphore(Semaphore&& other)
+ : m_sendRight(WTFMove(other.m_sendRight))
+ , m_semaphore(std::exchange(other.m_semaphore, SEMAPHORE_NULL))
+{
+}
+
+Semaphore::Semaphore(MachSendRight&& sendRight)
+ : m_sendRight(WTFMove(sendRight))
+ , m_semaphore(m_sendRight.sendRight())
+{
+ ASSERT(m_sendRight);
+}
+
+Semaphore::~Semaphore()
+{
+ destroy();
+}
+
+Semaphore& Semaphore::operator=(Semaphore&& other)
+{
+ if (this != &other) {
+ destroy();
+ m_sendRight = WTFMove(other.m_sendRight);
+ m_semaphore = std::exchange(other.m_semaphore, SEMAPHORE_NULL);
+ }
+
+ return *this;
+}
+
+void Semaphore::signal()
+{
+ auto ret = semaphore_signal(m_semaphore);
+ ASSERT_UNUSED(ret, ret == KERN_SUCCESS);
+}
+
+void Semaphore::wait()
+{
+ auto ret = semaphore_wait(m_semaphore);
+ ASSERT_UNUSED(ret, ret == KERN_SUCCESS);
+}
+
+void Semaphore::waitFor(Seconds timeout)
+{
+ auto seconds = timeout.secondsAs<unsigned>();
+ auto ret = semaphore_timedwait(m_semaphore, { seconds, static_cast<clock_res_t>(timeout.nanosecondsAs<uint64_t>() - seconds * NSEC_PER_SEC) });
+ ASSERT_UNUSED(ret, ret == KERN_SUCCESS || ret == KERN_OPERATION_TIMED_OUT);
+}
+
+MachSendRight Semaphore::createSendRight() const
+{
+ return MachSendRight::create(m_semaphore);
+}
+
+void Semaphore::encode(Encoder& encoder) const
+{
+ encoder << createSendRight();
+}
+
+Optional<Semaphore> Semaphore::decode(Decoder& decoder)
+{
+ MachSendRight sendRight;
+ if (!decoder.decode(sendRight))
+ return WTF::nullopt;
+ return Optional<Semaphore> { std::in_place, WTFMove(sendRight) };
+}
+
+
+void Semaphore::destroy()
+{
+ if (m_sendRight) {
+ m_sendRight = MachSendRight();
+ m_semaphore = SEMAPHORE_NULL;
+ return;
+ }
+ if (m_semaphore == SEMAPHORE_NULL)
+ return;
+ auto ret = semaphore_destroy(mach_task_self(), m_semaphore);
+ ASSERT_UNUSED(ret, ret == KERN_SUCCESS);
+ m_semaphore = SEMAPHORE_NULL;
+}
+
+} // namespace IPC
Modified: trunk/Source/WebKit/Scripts/webkit/messages_unittest.py (272304 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/messages_unittest.py 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/Scripts/webkit/messages_unittest.py 2021-02-03 11:13:06 UTC (rev 272305)
@@ -39,7 +39,7 @@
reset_results = False
-_test_receiver_names = ['TestWithSuperclass', 'TestWithLegacyReceiver', 'TestWithoutAttributes', 'TestWithIfMessage']
+_test_receiver_names = ['TestWithSuperclass', 'TestWithLegacyReceiver', 'TestWithoutAttributes', 'TestWithIfMessage', 'TestWithSemaphore']
def receiver_header_file_name(receiver_name):
Modified: trunk/Source/WebKit/Scripts/webkit/tests/Makefile (272304 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/Makefile 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/Scripts/webkit/tests/Makefile 2021-02-03 11:13:06 UTC (rev 272305)
@@ -1,2 +1,2 @@
all:
- python ../../generate-message-receiver.py . TestWithSuperclass TestWithLegacyReceiver TestWithoutAttributes TestWithIfMessage
+ python ../../generate-message-receiver.py . TestWithSuperclass TestWithLegacyReceiver TestWithoutAttributes TestWithIfMessage TestWithSemaphore
Modified: trunk/Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp (272304 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -40,6 +40,7 @@
#include "MachPort.h"
#endif
#include "Plugin.h"
+#include "Semaphore.h"
#include "TestClassName.h"
#if ENABLE(TEST_FEATURE)
#include "TestTwoStateEnum.h"
@@ -46,6 +47,7 @@
#endif
#include "TestWithIfMessageMessages.h"
#include "TestWithLegacyReceiverMessages.h"
+#include "TestWithSemaphoreMessages.h"
#include "TestWithSuperclassMessages.h"
#include "TestWithoutAttributesMessages.h"
#include "WebCoreArgumentCoders.h"
@@ -216,6 +218,10 @@
case MessageName::TestWithIfMessage_LoadURL:
return jsValueForDecodedArguments<Messages::TestWithIfMessage::LoadURL::Arguments>(globalObject, decoder);
#endif
+ case MessageName::TestWithSemaphore_SendSemaphore:
+ return jsValueForDecodedArguments<Messages::TestWithSemaphore::SendSemaphore::Arguments>(globalObject, decoder);
+ case MessageName::TestWithSemaphore_ReceiveSemaphore:
+ return jsValueForDecodedArguments<Messages::TestWithSemaphore::ReceiveSemaphore::Arguments>(globalObject, decoder);
default:
break;
}
@@ -517,6 +523,12 @@
{"value", "int64_t", nullptr, false},
};
#endif
+ case MessageName::TestWithSemaphore_SendSemaphore:
+ return Vector<ArgumentDescription> {
+ {"s0", "IPC::Semaphore", nullptr, false},
+ };
+ case MessageName::TestWithSemaphore_ReceiveSemaphore:
+ return Vector<ArgumentDescription> { };
default:
break;
}
Modified: trunk/Source/WebKit/Scripts/webkit/tests/MessageNames.cpp (272304 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/MessageNames.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/Scripts/webkit/tests/MessageNames.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -72,6 +72,10 @@
return "TestWithLegacyReceiver_TestParameterAttributes";
case MessageName::TestWithLegacyReceiver_TouchEvent:
return "TestWithLegacyReceiver_TouchEvent";
+ case MessageName::TestWithSemaphore_ReceiveSemaphore:
+ return "TestWithSemaphore_ReceiveSemaphore";
+ case MessageName::TestWithSemaphore_SendSemaphore:
+ return "TestWithSemaphore_SendSemaphore";
case MessageName::TestWithSuperclass_LoadURL:
return "TestWithSuperclass_LoadURL";
case MessageName::TestWithSuperclass_TestAsyncMessage:
@@ -181,6 +185,9 @@
case MessageName::TestWithLegacyReceiver_TestParameterAttributes:
case MessageName::TestWithLegacyReceiver_TouchEvent:
return ReceiverName::TestWithLegacyReceiver;
+ case MessageName::TestWithSemaphore_ReceiveSemaphore:
+ case MessageName::TestWithSemaphore_SendSemaphore:
+ return ReceiverName::TestWithSemaphore;
case MessageName::TestWithSuperclass_LoadURL:
case MessageName::TestWithSuperclass_TestAsyncMessage:
case MessageName::TestWithSuperclass_TestAsyncMessageWithConnection:
@@ -299,6 +306,10 @@
if (messageName == IPC::MessageName::TestWithLegacyReceiver_TouchEvent)
return true;
#endif
+ if (messageName == IPC::MessageName::TestWithSemaphore_ReceiveSemaphore)
+ return true;
+ if (messageName == IPC::MessageName::TestWithSemaphore_SendSemaphore)
+ return true;
if (messageName == IPC::MessageName::TestWithSuperclass_LoadURL)
return true;
#if ENABLE(TEST_FEATURE)
Modified: trunk/Source/WebKit/Scripts/webkit/tests/MessageNames.h (272304 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/MessageNames.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/Scripts/webkit/tests/MessageNames.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -31,11 +31,12 @@
enum class ReceiverName : uint8_t {
TestWithIfMessage = 1
, TestWithLegacyReceiver = 2
- , TestWithSuperclass = 3
- , TestWithoutAttributes = 4
- , IPC = 5
- , AsyncReply = 6
- , Invalid = 7
+ , TestWithSemaphore = 3
+ , TestWithSuperclass = 4
+ , TestWithoutAttributes = 5
+ , IPC = 6
+ , AsyncReply = 7
+ , Invalid = 8
};
enum class MessageName : uint16_t {
@@ -60,6 +61,8 @@
, TestWithLegacyReceiver_TemplateTest
, TestWithLegacyReceiver_TestParameterAttributes
, TestWithLegacyReceiver_TouchEvent
+ , TestWithSemaphore_ReceiveSemaphore
+ , TestWithSemaphore_SendSemaphore
, TestWithSuperclass_LoadURL
, TestWithSuperclass_TestAsyncMessage
, TestWithSuperclass_TestAsyncMessageWithConnection
Copied: trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphore.messages.in (from rev 272304, trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in) (0 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphore.messages.in (rev 0)
+++ trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphore.messages.in 2021-02-03 11:13:06 UTC (rev 272305)
@@ -0,0 +1,26 @@
+# Copyright (C) 2021 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> TestWithSemaphore {
+ void SendSemaphore(IPC::Semaphore s0)
+ void ReceiveSemaphore() -> (IPC::Semaphore r0)
+}
Added: trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp (0 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp (rev 0)
+++ trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TestWithSemaphore.h"
+
+#include "Decoder.h"
+#include "HandleMessage.h"
+#include "Semaphore.h"
+#include "TestWithSemaphoreMessages.h"
+
+namespace WebKit {
+
+void TestWithSemaphore::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
+{
+ auto protectedThis = makeRef(*this);
+ if (decoder.messageName() == Messages::TestWithSemaphore::SendSemaphore::name()) {
+ IPC::handleMessage<Messages::TestWithSemaphore::SendSemaphore>(decoder, this, &TestWithSemaphore::sendSemaphore);
+ return;
+ }
+ UNUSED_PARAM(connection);
+ UNUSED_PARAM(decoder);
+ ASSERT_NOT_REACHED();
+}
+
+void TestWithSemaphore::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder)
+{
+ auto protectedThis = makeRef(*this);
+ if (decoder.messageName() == Messages::TestWithSemaphore::ReceiveSemaphore::name()) {
+ IPC::handleMessage<Messages::TestWithSemaphore::ReceiveSemaphore>(decoder, *replyEncoder, this, &TestWithSemaphore::receiveSemaphore);
+ return;
+ }
+ UNUSED_PARAM(connection);
+ UNUSED_PARAM(decoder);
+ UNUSED_PARAM(replyEncoder);
+ ASSERT_NOT_REACHED();
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessages.h (0 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessages.h (rev 0)
+++ trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessages.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ArgumentCoders.h"
+#include "Connection.h"
+#include "MessageNames.h"
+#include "TestWithSemaphoreMessagesReplies.h"
+#include <wtf/Forward.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace IPC {
+class Semaphore;
+}
+
+namespace Messages {
+namespace TestWithSemaphore {
+
+static inline IPC::ReceiverName messageReceiverName()
+{
+ return IPC::ReceiverName::TestWithSemaphore;
+}
+
+class SendSemaphore {
+public:
+ using Arguments = std::tuple<const IPC::Semaphore&>;
+
+ static IPC::MessageName name() { return IPC::MessageName::TestWithSemaphore_SendSemaphore; }
+ static const bool isSync = false;
+
+ explicit SendSemaphore(const IPC::Semaphore& s0)
+ : m_arguments(s0)
+ {
+ }
+
+ const Arguments& arguments() const
+ {
+ return m_arguments;
+ }
+
+private:
+ Arguments m_arguments;
+};
+
+class ReceiveSemaphore {
+public:
+ using Arguments = std::tuple<>;
+
+ static IPC::MessageName name() { return IPC::MessageName::TestWithSemaphore_ReceiveSemaphore; }
+ static const bool isSync = true;
+
+ using Reply = std::tuple<IPC::Semaphore&>;
+ using ReplyArguments = std::tuple<IPC::Semaphore>;
+ const Arguments& arguments() const
+ {
+ return m_arguments;
+ }
+
+private:
+ Arguments m_arguments;
+};
+
+} // namespace TestWithSemaphore
+} // namespace Messages
Added: trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessagesReplies.h (0 => 272305)
--- trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessagesReplies.h (rev 0)
+++ trunk/Source/WebKit/Scripts/webkit/tests/TestWithSemaphoreMessagesReplies.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "MessageNames.h"
+#include <wtf/Forward.h>
+
+
+namespace Messages {
+namespace TestWithSemaphore {
+
+
+} // namespace TestWithSemaphore
+} // namespace Messages
Deleted: trunk/Source/WebKit/Shared/RemoteRenderingBackendCreationParameters.h (272304 => 272305)
--- trunk/Source/WebKit/Shared/RemoteRenderingBackendCreationParameters.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/Shared/RemoteRenderingBackendCreationParameters.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(GPU_PROCESS)
-
-#include "RenderingBackendIdentifier.h"
-#include <wtf/MachSendRight.h>
-
-namespace WebKit {
-
-struct RemoteRenderingBackendCreationParameters {
- RenderingBackendIdentifier identifier;
-#if PLATFORM(COCOA)
- MachSendRight sendRightForResumeDisplayListSemaphore;
-#endif
-
- template<class Encoder> void encode(Encoder&) const;
- template<class Decoder> static Optional<RemoteRenderingBackendCreationParameters> decode(Decoder&);
-};
-
-template<class Encoder>
-void RemoteRenderingBackendCreationParameters::encode(Encoder& encoder) const
-{
- encoder << identifier;
-#if PLATFORM(COCOA)
- encoder << sendRightForResumeDisplayListSemaphore;
-#endif
-}
-
-template<class Decoder>
-Optional<RemoteRenderingBackendCreationParameters> RemoteRenderingBackendCreationParameters::decode(Decoder& decoder)
-{
- RemoteRenderingBackendCreationParameters parameters;
-
- Optional<RenderingBackendIdentifier> identifier;
- decoder >> identifier;
- if (!identifier)
- return WTF::nullopt;
-
- parameters.identifier = *identifier;
-
-#if PLATFORM(COCOA)
- Optional<MachSendRight> sendRightForResumeDisplayListSemaphore;
- decoder >> sendRightForResumeDisplayListSemaphore;
- if (!sendRightForResumeDisplayListSemaphore)
- return WTF::nullopt;
-
- parameters.sendRightForResumeDisplayListSemaphore = WTFMove(*sendRightForResumeDisplayListSemaphore);
-#endif
-
- return parameters;
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/Sources.txt (272304 => 272305)
--- trunk/Source/WebKit/Sources.txt 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/Sources.txt 2021-02-03 11:13:06 UTC (rev 272305)
@@ -144,6 +144,7 @@
Platform/IPC/JSIPCBinding.cpp @no-unify
Platform/IPC/MessageReceiverMap.cpp @no-unify
Platform/IPC/MessageSender.cpp @no-unify
+Platform/IPC/Semaphore.cpp @no-unify
Platform/IPC/SharedBufferCopy.cpp @no-unify
Platform/IPC/SharedBufferDataReference.cpp @no-unify
Platform/IPC/StringReference.cpp @no-unify
Modified: trunk/Source/WebKit/SourcesCocoa.txt (272304 => 272305)
--- trunk/Source/WebKit/SourcesCocoa.txt 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2021-02-03 11:13:06 UTC (rev 272305)
@@ -87,7 +87,9 @@
Platform/IPC/cocoa/ConnectionCocoa.mm
Platform/IPC/cocoa/MachMessage.cpp
+Platform/IPC/darwin/SemaphoreDarwin.cpp
+
Platform/mac/MachUtilities.cpp
Platform/mac/MenuUtilities.mm
Platform/mac/StringUtilities.mm
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (272304 => 272305)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-02-03 11:13:06 UTC (rev 272305)
@@ -1327,6 +1327,8 @@
7AFBD36721E51BAB005DBACB /* ResourceLoadStatisticsMemoryStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFBD36521E51BAB005DBACB /* ResourceLoadStatisticsMemoryStore.h */; };
7AFBD36F21E546F8005DBACB /* PersistencyUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFBD36D21E546E3005DBACB /* PersistencyUtils.h */; };
7B1DB26625668CE1000E26BC /* ArrayReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B1DB26525668CE0000E26BC /* ArrayReference.h */; };
+ 7B73122825C988AA003B2796 /* Semaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B73122625C988AA003B2796 /* Semaphore.cpp */; };
+ 7B73122925C988AB003B2796 /* Semaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B73122725C988AA003B2796 /* Semaphore.h */; };
7C065F2C1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C065F2A1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h */; };
7C135AA9173B0BCA00586AE2 /* WKPluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C135AA7173B0BCA00586AE2 /* WKPluginInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C1BA33E1A4A0E600043E249 /* APIDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1BA33C1A4A0E600043E249 /* APIDictionary.h */; };
@@ -1970,7 +1972,6 @@
F42D634122A0EFDF00D2FB3A /* WebAutocorrectionData.h in Headers */ = {isa = PBXBuildFile; fileRef = F42D633F22A0EFD300D2FB3A /* WebAutocorrectionData.h */; };
F430E9422247335F005FE053 /* WebsiteMetaViewportPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F430E941224732A9005FE053 /* WebsiteMetaViewportPolicy.h */; };
F430E94422473DFF005FE053 /* WebContentMode.h in Headers */ = {isa = PBXBuildFile; fileRef = F430E94322473DB8005FE053 /* WebContentMode.h */; };
- F437C8D92593B7E300DB8A1C /* RemoteRenderingBackendCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = F437C8D82593B7E300DB8A1C /* RemoteRenderingBackendCreationParameters.h */; };
F438CD1C2241421400DE6DDA /* WKWebpagePreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD1B224140A600DE6DDA /* WKWebpagePreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
F438CD1F22414D4000DE6DDA /* WKWebpagePreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD1E22414D4000DE6DDA /* WKWebpagePreferencesInternal.h */; };
F438CD212241F69500DE6DDA /* WKWebpagePreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD202241F69500DE6DDA /* WKWebpagePreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4517,6 +4518,9 @@
7AFBD36E21E546E3005DBACB /* PersistencyUtils.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PersistencyUtils.cpp; sourceTree = "<group>"; };
7B1DB26525668CE0000E26BC /* ArrayReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayReference.h; sourceTree = "<group>"; };
7B64C0B6254C5C250006B4AF /* GraphicsContextGLIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLIdentifier.h; sourceTree = "<group>"; };
+ 7B73122625C988AA003B2796 /* Semaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Semaphore.cpp; sourceTree = "<group>"; };
+ 7B73122725C988AA003B2796 /* Semaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Semaphore.h; sourceTree = "<group>"; };
+ 7B73122A25C988C6003B2796 /* SemaphoreDarwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SemaphoreDarwin.cpp; sourceTree = "<group>"; };
7B904165254AFDEA006EEB8C /* RemoteGraphicsContextGLProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteGraphicsContextGLProxy.cpp; sourceTree = "<group>"; };
7B904166254AFDEB006EEB8C /* RemoteGraphicsContextGLProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteGraphicsContextGLProxy.h; sourceTree = "<group>"; };
7B904167254AFE17006EEB8C /* RemoteGraphicsContextGLProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = RemoteGraphicsContextGLProxy.messages.in; sourceTree = "<group>"; };
@@ -5789,7 +5793,6 @@
F42D634022A0EFD300D2FB3A /* WebAutocorrectionData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebAutocorrectionData.mm; path = ios/WebAutocorrectionData.mm; sourceTree = "<group>"; };
F430E941224732A9005FE053 /* WebsiteMetaViewportPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebsiteMetaViewportPolicy.h; sourceTree = "<group>"; };
F430E94322473DB8005FE053 /* WebContentMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebContentMode.h; sourceTree = "<group>"; };
- F437C8D82593B7E300DB8A1C /* RemoteRenderingBackendCreationParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRenderingBackendCreationParameters.h; sourceTree = "<group>"; };
F438CD1B224140A600DE6DDA /* WKWebpagePreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWebpagePreferences.h; sourceTree = "<group>"; };
F438CD1D22414AD600DE6DDA /* WKWebpagePreferences.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebpagePreferences.mm; sourceTree = "<group>"; };
F438CD1E22414D4000DE6DDA /* WKWebpagePreferencesInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWebpagePreferencesInternal.h; sourceTree = "<group>"; };
@@ -6528,7 +6531,6 @@
E1CC1B8E12D7EADF00625838 /* PrintInfo.h */,
463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */,
9B1229D023FF2A5E008CA751 /* RemoteAudioDestinationIdentifier.h */,
- F437C8D82593B7E300DB8A1C /* RemoteRenderingBackendCreationParameters.h */,
5CB7AFE623C681B000E49CF3 /* ResourceLoadInfo.h */,
5C00993B2417FB7E00D53C25 /* ResourceLoadStatisticsParameters.h */,
410482CB1DDD2FB500F006D0 /* RTCNetwork.cpp */,
@@ -6880,6 +6882,7 @@
isa = PBXGroup;
children = (
BCC56F751159955E001CCAF9 /* cocoa */,
+ 7B73122C25CA67AE003B2796 /* darwin */,
1AEFD27811D16C81008219D3 /* ArgumentCoder.h */,
1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */,
1AEFD2F611D1807B008219D3 /* ArgumentCoders.h */,
@@ -6906,6 +6909,8 @@
1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */,
1AAB0377185A7C6A00EDF501 /* MessageSender.cpp */,
1AAB0378185A7C6A00EDF501 /* MessageSender.h */,
+ 7B73122625C988AA003B2796 /* Semaphore.cpp */,
+ 7B73122725C988AA003B2796 /* Semaphore.h */,
2DC18001D90DDD15FC6991A9 /* SharedBufferCopy.cpp */,
5CC5DB9121488E16006CB8A8 /* SharedBufferCopy.h */,
2DC1855EDBFB850BA0B6D06D /* SharedBufferDataReference.cpp */,
@@ -9009,6 +9014,14 @@
name = Classifier;
sourceTree = "<group>";
};
+ 7B73122C25CA67AE003B2796 /* darwin */ = {
+ isa = PBXGroup;
+ children = (
+ 7B73122A25C988C6003B2796 /* SemaphoreDarwin.cpp */,
+ );
+ path = darwin;
+ sourceTree = "<group>";
+ };
7C6E70F818B2D47E00F24E2E /* cocoa */ = {
isa = PBXGroup;
children = (
@@ -11733,6 +11746,7 @@
839902031BE9A02B000F3653 /* NetworkLoad.h in Headers */,
83D454D71BE9D3C4006C93BD /* NetworkLoadClient.h in Headers */,
839149651BEA838500D2D953 /* NetworkLoadParameters.h in Headers */,
+ E47FC8A025B8331C005495FC /* NetworkLoadScheduler.h in Headers */,
5179556A162876F300FA43B6 /* NetworkProcess.h in Headers */,
517CF0E4163A486C00C2950E /* NetworkProcessConnectionMessages.h in Headers */,
5C1426ED1C23F80900D41183 /* NetworkProcessCreationParameters.h in Headers */,
@@ -11875,7 +11889,6 @@
1A5704FC1BE1751100874AF1 /* RemoteObjectInvocation.h in Headers */,
1AC1338018590AE400F3EC05 /* RemoteObjectRegistry.h in Headers */,
1AC1338618590C4600F3EC05 /* RemoteObjectRegistryMessages.h in Headers */,
- F437C8D92593B7E300DB8A1C /* RemoteRenderingBackendCreationParameters.h in Headers */,
0F594790187B3B3A00437857 /* RemoteScrollingCoordinator.h in Headers */,
0F5947A8187B517600437857 /* RemoteScrollingCoordinatorMessages.h in Headers */,
0F59479B187B3B6000437857 /* RemoteScrollingCoordinatorProxy.h in Headers */,
@@ -11907,6 +11920,7 @@
E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */,
E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */,
570AB8F320AE3BD700B8BE87 /* SecKeyProxyStore.h in Headers */,
+ 7B73122925C988AB003B2796 /* Semaphore.h in Headers */,
514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
1A002D49196B345D00B9AD44 /* SessionStateCoding.h in Headers */,
@@ -12096,7 +12110,6 @@
93A88B331BC6E9CD00ABA5C2 /* WebHitTestResultData.h in Headers */,
F44DFEB21E9E752F0038D196 /* WebIconUtilities.h in Headers */,
93261161214054F4000806E7 /* WebIDBConnectionToClient.h in Headers */,
- E47FC8A025B8331C005495FC /* NetworkLoadScheduler.h in Headers */,
514129941C6428BB0059E714 /* WebIDBConnectionToServer.h in Headers */,
510523741C73D38B007993CB /* WebIDBConnectionToServerMessages.h in Headers */,
933E835523A07C0600DEF289 /* WebIDBServer.h in Headers */,
@@ -13759,6 +13772,7 @@
A55BA8261BA25CFD007CD33D /* RemoteWebInspectorProxyMessageReceiver.cpp in Sources */,
1BBBE4A019B66C53006B7D81 /* RemoteWebInspectorUIMessageReceiver.cpp in Sources */,
E18E6917169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp in Sources */,
+ 7B73122825C988AA003B2796 /* Semaphore.cpp in Sources */,
41DE7C6C22278F1E00532B65 /* ServiceWorkerFetchTask.cpp in Sources */,
2D92A787212B6AB100F493FD /* ShareableBitmap.cpp in Sources */,
2DC18FEBF337B9671C88E3CD /* SharedBufferCopy.cpp in Sources */,
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (272304 => 272305)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -32,7 +32,6 @@
#include "GPUConnectionToWebProcess.h"
#include "ImageDataReference.h"
#include "PlatformRemoteImageBufferProxy.h"
-#include "RemoteRenderingBackendCreationParameters.h"
#include "RemoteRenderingBackendMessages.h"
#include "RemoteRenderingBackendProxyMessages.h"
#include "SharedMemory.h"
@@ -67,12 +66,7 @@
auto& connection = WebProcess::singleton().ensureGPUProcessConnection();
connection.addClient(*this);
connection.messageReceiverMap().addMessageReceiver(Messages::RemoteRenderingBackendProxy::messageReceiverName(), m_renderingBackendIdentifier.toUInt64(), *this);
- send(Messages::GPUConnectionToWebProcess::CreateRenderingBackend({
- m_renderingBackendIdentifier,
-#if PLATFORM(COCOA)
- m_resumeDisplayListSemaphore.createSendRight(),
-#endif
- }), 0);
+ send(Messages::GPUConnectionToWebProcess::CreateRenderingBackend(m_renderingBackendIdentifier, m_resumeDisplayListSemaphore), 0);
}
void RemoteRenderingBackendProxy::reestablishGPUProcessConnection()
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h (272304 => 272305)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -34,15 +34,12 @@
#include "MessageSender.h"
#include "RemoteResourceCacheProxy.h"
#include "RenderingBackendIdentifier.h"
+#include "Semaphore.h"
#include <WebCore/DisplayList.h>
#include <WebCore/RenderingResourceIdentifier.h>
#include <wtf/Deque.h>
#include <wtf/WeakPtr.h>
-#if PLATFORM(COCOA)
-#include <wtf/cocoa/MachSemaphore.h>
-#endif
-
namespace WebCore {
namespace DisplayList {
class DisplayList;
@@ -126,9 +123,7 @@
Optional<WebCore::RenderingResourceIdentifier> m_currentDestinationImageBufferIdentifier;
Optional<GPUProcessWakeupMessageArguments> m_deferredWakeupMessageArguments;
unsigned m_remainingItemsToAppendBeforeSendingWakeup { 0 };
-#if PLATFORM(COCOA)
- MachSemaphore m_resumeDisplayListSemaphore;
-#endif
+ IPC::Semaphore m_resumeDisplayListSemaphore;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp (272304 => 272305)
--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp 2021-02-03 11:13:06 UTC (rev 272305)
@@ -40,7 +40,6 @@
#include <WebCore/CARingBuffer.h>
#include <WebCore/WebAudioBufferList.h>
#include <mach/mach_time.h>
-#include <wtf/cocoa/MachSemaphore.h>
#endif
namespace WebKit {
@@ -80,7 +79,7 @@
auto offThreadRendering = [this]() mutable {
do {
- m_renderSemaphore->wait();
+ m_renderSemaphore.wait();
if (m_shouldStopThread)
break;
@@ -98,8 +97,7 @@
return;
m_shouldStopThread = true;
- if (m_renderSemaphore)
- m_renderSemaphore->signal();
+ m_renderSemaphore.signal();
m_renderThread->waitForCompletion();
m_renderThread = nullptr;
#endif
@@ -107,20 +105,10 @@
void RemoteAudioDestinationProxy::connectToGPUProcess()
{
- RemoteAudioDestinationIdentifier destinationID;
-#if PLATFORM(COCOA)
- MachSendRight renderSemaphoreSendRight;
-#endif
-
auto& connection = WebProcess::singleton().ensureGPUProcessConnection();
connection.addClient(*this);
auto didSucceed = connection.connection().sendSync(
- Messages::RemoteAudioDestinationManager::CreateAudioDestination(m_inputDeviceId, m_numberOfInputChannels, numberOfOutputChannels(), sampleRate(), hardwareSampleRate()),
- Messages::RemoteAudioDestinationManager::CreateAudioDestination::Reply(destinationID
-#if PLATFORM(COCOA)
- , renderSemaphoreSendRight
-#endif
- ), 0);
+ Messages::RemoteAudioDestinationManager::CreateAudioDestination(m_inputDeviceId, m_numberOfInputChannels, numberOfOutputChannels(), sampleRate(), hardwareSampleRate(), m_renderSemaphore), Messages::RemoteAudioDestinationManager::CreateAudioDestination::Reply(m_destinationID), 0);
if (!didSucceed) {
// The GPUProcess likely crashed during this synchronous IPC. gpuProcessConnectionDidClose() will get called to reconnect to the GPUProcess.
@@ -128,7 +116,6 @@
return;
}
- m_destinationID = destinationID;
#if PLATFORM(COCOA)
m_currentFrame = 0;
@@ -136,7 +123,6 @@
getAudioStreamBasicDescription(streamFormat);
m_ringBuffer->allocate(streamFormat, m_numberOfFrames);
m_audioBufferList = makeUnique<WebCore::WebAudioBufferList>(streamFormat);
- m_renderSemaphore = makeUnique<MachSemaphore>(WTFMove(renderSemaphoreSendRight));
#endif
startRenderingThread();
@@ -205,9 +191,7 @@
oldConnection.removeClient(*this);
stopRenderingThread();
-#if PLATFORM(COCOA)
- m_renderSemaphore = nullptr;
-#endif
+
connectToGPUProcess();
if (isPlaying())
Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.h (272304 => 272305)
--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.h 2021-02-03 10:34:39 UTC (rev 272304)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.h 2021-02-03 11:13:06 UTC (rev 272305)
@@ -30,6 +30,7 @@
#include "Connection.h"
#include "GPUProcessConnection.h"
#include "RemoteAudioDestinationIdentifier.h"
+#include "Semaphore.h"
#include <WebCore/AudioIOCallback.h>
#include <wtf/CrossThreadQueue.h>
#include <wtf/MediaTime.h>
@@ -38,6 +39,7 @@
#if PLATFORM(COCOA)
#include "SharedRingBufferStorage.h"
#include <WebCore/AudioDestinationCocoa.h>
+#include <wtf/Optional.h>
#else
#include <WebCore/AudioDestinationGStreamer.h>
#endif
@@ -47,12 +49,6 @@
class WebAudioBufferList;
}
-namespace WTF {
-#if PLATFORM(COCOA)
-class MachSemaphore;
-#endif
-}
-
namespace WebKit {
class SharedRingBufferFrameBounds;
@@ -104,7 +100,6 @@
#if PLATFORM(COCOA)
uint64_t m_numberOfFrames { 0 };
std::unique_ptr<WebCore::CARingBuffer> m_ringBuffer;
- std::unique_ptr<WTF::MachSemaphore> m_renderSemaphore;
std::unique_ptr<WebCore::WebAudioBufferList> m_audioBufferList;
uint64_t m_currentFrame { 0 };
float m_sampleRate;
@@ -111,6 +106,7 @@
#else
unsigned m_numberOfOutputChannels;
#endif
+ IPC::Semaphore m_renderSemaphore;
String m_inputDeviceId;
unsigned m_numberOfInputChannels;