Changeset 293723 in webkit
- Timestamp:
- May 3, 2022, 7:16:55 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 28 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/ipc/stream-sync-crash-no-timeout-expected.txt (added)
-
LayoutTests/ipc/stream-sync-crash-no-timeout.html (added)
-
LayoutTests/ipc/stream-sync-reply-shared-memory.html (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp (modified) (1 diff)
-
Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (modified) (1 diff)
-
Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp (modified) (1 diff)
-
Source/WebKit/Platform/IPC/StreamClientConnection.cpp (modified) (2 diffs)
-
Source/WebKit/Platform/IPC/StreamClientConnection.h (modified) (4 diffs)
-
Source/WebKit/Platform/IPC/StreamConnectionBuffer.cpp (modified) (5 diffs)
-
Source/WebKit/Platform/IPC/StreamConnectionBuffer.h (modified) (4 diffs)
-
Source/WebKit/Platform/IPC/StreamServerConnection.cpp (modified) (2 diffs)
-
Source/WebKit/Platform/IPC/StreamServerConnection.h (modified) (3 diffs)
-
Source/WebKit/Shared/IPCStreamTester.cpp (modified) (2 diffs)
-
Source/WebKit/Shared/IPCStreamTester.h (modified) (1 diff)
-
Source/WebKit/Shared/IPCStreamTester.messages.in (modified) (1 diff)
-
Source/WebKit/Shared/IPCStreamTesterProxy.h (modified) (1 diff)
-
Source/WebKit/Shared/IPCStreamTesterProxy.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r293719 r293723 1 2022-05-03 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 IPC stream connection sends should fail immediately when connection closes 4 https://bugs.webkit.org/show_bug.cgi?id=238253 5 6 Reviewed by Simon Fraser. 7 8 The test works on minibrowser but GPUP startup code fails in run-webkit-tests, 9 thus disabled. 10 11 * TestExpectations: 12 * ipc/stream-sync-crash-no-timeout-expected.txt: Added. 13 * ipc/stream-sync-crash-no-timeout.html: Added. 14 * ipc/stream-sync-reply-shared-memory.html: Adjust after API change. 15 1 16 2022-05-03 Youenn Fablet <youenn@apple.com> 2 17 -
trunk/LayoutTests/TestExpectations
r293719 r293723 5094 5094 [ Debug ] ipc/send-invalid-message.html [ Skip ] 5095 5095 5096 # Restarted GPUP seems to crash. 5097 webkit.org/b/239959 ipc/stream-sync-crash-no-timeout.html [ Skip ] 5098 5096 5099 # The test invokes random messages, potentially produces random results. 5097 5100 ipc/start-message-testing.html [ Skip ] -
trunk/LayoutTests/ipc/stream-sync-reply-shared-memory.html
r290505 r293723 17 17 ]); 18 18 const arguments = IPC.waitForMessage(processTarget, streamTesterID, IPC.messages.IPCStreamTesterProxy_WasCreated.name, defaultTimeout); 19 streamConnection.set WakeUpSemaphore(arguments[0].value);19 streamConnection.setSemaphores(arguments[0].value, arguments[1].value); 20 20 21 21 // Test starts here. -
trunk/Source/WebKit/ChangeLog
r293716 r293723 1 2022-05-03 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 IPC stream connection sends should fail immediately when connection closes 4 https://bugs.webkit.org/show_bug.cgi?id=238253 5 6 Reviewed by Simon Fraser. 7 8 Send the StreamClientConnection client wait semaphore from 9 StreamServerConnection. This way the client will fail the wait 10 when the server crashes. 11 12 Test: ipc/stream-sync-crash-no-timeout.html 13 14 * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: 15 (WebKit::RemoteGraphicsContextGL::workQueueInitialize): 16 * GPUProcess/graphics/RemoteRenderingBackend.cpp: 17 (WebKit::RemoteRenderingBackend::startListeningForIPC): 18 * GPUProcess/graphics/WebGPU/RemoteGPU.cpp: 19 (WebKit::RemoteGPU::workQueueInitialize): 20 * Platform/IPC/StreamClientConnection.cpp: 21 (IPC::StreamClientConnection::setSemaphores): 22 (IPC::StreamClientConnection::wakeUpServer): 23 * Platform/IPC/StreamClientConnection.h: 24 (IPC::StreamClientConnection::tryAcquire): 25 (IPC::StreamClientConnection::tryAcquireAll): 26 * Platform/IPC/StreamConnectionBuffer.cpp: 27 (IPC::StreamConnectionBuffer::StreamConnectionBuffer): 28 (IPC::StreamConnectionBuffer::operator=): 29 (IPC::StreamConnectionBuffer::encode const): 30 (IPC::StreamConnectionBuffer::decode): 31 * Platform/IPC/StreamConnectionBuffer.h: 32 (IPC::StreamConnectionBuffer::dataSize const): 33 * Platform/IPC/StreamServerConnection.cpp: 34 (IPC::StreamServerConnection::release): 35 (IPC::StreamServerConnection::releaseAll): 36 * Platform/IPC/StreamServerConnection.h: 37 * Shared/IPCStreamTester.cpp: 38 (WebKit::IPCStreamTester::initialize): 39 (WebKit::IPCStreamTester::syncCrashOnZero): 40 * Shared/IPCStreamTester.h: 41 * Shared/IPCStreamTester.messages.in: 42 * Shared/IPCStreamTesterProxy.h: 43 * Shared/IPCStreamTesterProxy.messages.in: 44 * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: 45 (WebKit::RemoteGraphicsContextGLProxy::wasCreated): 46 * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: 47 * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in: 48 * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: 49 (WebKit::RemoteRenderingBackendProxy::streamConnection): 50 (WebKit::RemoteRenderingBackendProxy::didInitialize): 51 * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 52 * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: 53 * WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp: 54 (WebKit::RemoteGPUProxy::wasCreated): 55 * WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h: 56 * WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.messages.in: 57 * WebProcess/WebPage/IPCTestingAPI.cpp: 58 (WebKit::IPCTestingAPI::JSIPCStreamClientConnection::setSemaphores): 59 (WebKit::IPCTestingAPI::JSIPCStreamClientConnection::staticFunctions): 60 (WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendIPCStreamTesterSyncCrashOnZero): 61 1 62 2022-05-02 Tim Horton <timothy_horton@apple.com> 2 63 -
trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
r293211 r293723 132 132 String extensions = m_context->getString(GraphicsContextGL::EXTENSIONS); 133 133 String requestableExtensions = m_context->getString(GraphicsContextGL::REQUESTABLE_EXTENSIONS_ANGLE); 134 send(Messages::RemoteGraphicsContextGLProxy::WasCreated(true, remoteGraphicsContextGLStreamWorkQueue().wakeUpSemaphore(), extensions, requestableExtensions));134 send(Messages::RemoteGraphicsContextGLProxy::WasCreated(true, remoteGraphicsContextGLStreamWorkQueue().wakeUpSemaphore(), m_streamConnection->clientWaitSemaphore(), extensions, requestableExtensions)); 135 135 } else 136 send(Messages::RemoteGraphicsContextGLProxy::WasCreated(false, IPC::Semaphore{ }, emptyString(), emptyString()));136 send(Messages::RemoteGraphicsContextGLProxy::WasCreated(false, { }, { }, emptyString(), emptyString())); 137 137 } 138 138 -
trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
r293683 r293723 112 112 m_streamConnection->startReceivingMessages(*this, Messages::RemoteRenderingBackend::messageReceiverName(), m_renderingBackendIdentifier.toUInt64()); 113 113 m_streamConnection->open(); 114 send(Messages::RemoteRenderingBackendProxy::Did CreateWakeUpSemaphoreForDisplayListStream(m_workQueue->wakeUpSemaphore()), m_renderingBackendIdentifier);114 send(Messages::RemoteRenderingBackendProxy::DidInitialize(m_workQueue->wakeUpSemaphore(), m_streamConnection->clientWaitSemaphore()), m_renderingBackendIdentifier); 115 115 } 116 116 -
trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp
r293106 r293723 95 95 if (backing) { 96 96 m_backing = backing.releaseNonNull(); 97 send(Messages::RemoteGPUProxy::WasCreated(true, workQueue().wakeUpSemaphore() ));97 send(Messages::RemoteGPUProxy::WasCreated(true, workQueue().wakeUpSemaphore(), m_streamConnection->clientWaitSemaphore())); 98 98 } else 99 send(Messages::RemoteGPUProxy::WasCreated(false, workQueue().wakeUpSemaphore()));99 send(Messages::RemoteGPUProxy::WasCreated(false, { }, { })); 100 100 } 101 101 -
trunk/Source/WebKit/Platform/IPC/StreamClientConnection.cpp
r292803 r293723 97 97 } 98 98 99 void StreamClientConnection::set WakeUpSemaphore(IPC::Semaphore&& semaphore)99 void StreamClientConnection::setSemaphores(IPC::Semaphore&& wakeUp, IPC::Semaphore&& clientWait) 100 100 { 101 m_ wakeUpSemaphore = WTFMove(semaphore);101 m_semaphores = { WTFMove(wakeUp), WTFMove(clientWait) }; 102 102 wakeUpServer(); 103 103 } … … 105 105 void StreamClientConnection::wakeUpServer() 106 106 { 107 if (!m_ wakeUpSemaphore)107 if (!m_semaphores) 108 108 return; 109 109 110 m_ wakeUpSemaphore->signal();110 m_semaphores->wakeUp.signal(); 111 111 m_remainingMessageCountBeforeSendingWakeUp = 0; 112 112 } -
trunk/Source/WebKit/Platform/IPC/StreamClientConnection.h
r292803 r293723 84 84 85 85 StreamConnectionBuffer& streamBuffer() { return m_buffer; } 86 void set WakeUpSemaphore(IPC::Semaphore&&);87 bool has WakeUpSemaphore() const { return m_wakeUpSemaphore.has_value(); }86 void setSemaphores(IPC::Semaphore&& wakeUp, IPC::Semaphore&& clientWait); 87 bool hasSemaphores() const { return m_semaphores.has_value(); } 88 88 89 89 void setWakeUpMessageHysteresis(unsigned hysteresis) … … 156 156 size_t m_clientOffset { 0 }; 157 157 StreamConnectionBuffer m_buffer; 158 std::optional<Semaphore> m_wakeUpSemaphore; 158 struct Semaphores { 159 Semaphore wakeUp; 160 Semaphore clientWait; 161 }; 162 std::optional<Semaphores> m_semaphores; 159 163 unsigned m_remainingMessageCountBeforeSendingWakeUp { 0 }; 160 164 unsigned m_wakeUpMessageHysteresis { 0 }; … … 308 312 ClientLimit oldClientLimit = sharedClientLimit().compareExchangeStrong(clientLimit, ClientLimit::clientIsWaitingTag, std::memory_order_acq_rel, std::memory_order_acq_rel); 309 313 if (clientLimit == oldClientLimit) { 310 m_buffer.clientWaitSemaphore().waitFor(timeout); 314 if (!m_semaphores || !m_semaphores->clientWait.waitFor(timeout)) 315 return std::nullopt; 311 316 clientLimit = sharedClientLimit().load(std::memory_order_acquire); 312 317 } else … … 339 344 break; 340 345 341 m_buffer.clientWaitSemaphore().waitFor(timeout); 346 if (!m_semaphores || !m_semaphores->clientWait.waitFor(timeout)) 347 return std::nullopt; 342 348 if (timeout.didTimeOut()) 343 349 return std::nullopt; -
trunk/Source/WebKit/Platform/IPC/StreamConnectionBuffer.cpp
r291428 r293723 47 47 } 48 48 49 StreamConnectionBuffer::StreamConnectionBuffer(Ref<WebKit::SharedMemory>&& memory, size_t memorySize , Semaphore&& clientWaitSemaphore)49 StreamConnectionBuffer::StreamConnectionBuffer(Ref<WebKit::SharedMemory>&& memory, size_t memorySize) 50 50 : m_dataSize(memorySize - headerSize()) 51 51 , m_sharedMemory(WTFMove(memory)) 52 , m_clientWaitSemaphore(WTFMove(clientWaitSemaphore))53 52 { 54 53 ASSERT(m_dataSize > 0); … … 65 64 m_dataSize = other.m_dataSize; 66 65 m_sharedMemory = WTFMove(other.m_sharedMemory); 67 m_clientWaitSemaphore = WTFMove(other.m_clientWaitSemaphore);68 66 } 69 67 return *this; … … 77 75 WebKit::SharedMemory::IPCHandle ipcHandle { WTFMove(handle), m_sharedMemory->size() }; 78 76 encoder << ipcHandle; 79 encoder << m_clientWaitSemaphore;80 77 } 81 78 … … 85 82 decoder >> ipcHandle; 86 83 if (!ipcHandle) 87 return std::nullopt;88 std::optional<Semaphore> semaphore;89 decoder >> semaphore;90 if (!semaphore)91 84 return std::nullopt; 92 85 size_t dataSize = static_cast<size_t>(ipcHandle->dataSize); … … 98 91 if (sharedMemory->size() < dataSize) 99 92 return std::nullopt; 100 return StreamConnectionBuffer { sharedMemory.releaseNonNull(), dataSize , WTFMove(*semaphore)};93 return StreamConnectionBuffer { sharedMemory.releaseNonNull(), dataSize }; 101 94 } 102 95 -
trunk/Source/WebKit/Platform/IPC/StreamConnectionBuffer.h
r291428 r293723 27 27 28 28 #include "Decoder.h" 29 #include "IPCSemaphore.h"30 29 #include "SharedMemory.h" 31 30 #include <wtf/Atomics.h> … … 110 109 uint8_t* data() const { return static_cast<uint8_t*>(m_sharedMemory->data()) + headerSize(); } 111 110 size_t dataSize() const { return m_dataSize; } 112 Semaphore& clientWaitSemaphore() { return m_clientWaitSemaphore; }113 111 114 112 static constexpr size_t maximumSize() { return std::min(static_cast<size_t>(ClientOffset::serverIsSleepingTag), static_cast<size_t>(ClientOffset::serverIsSleepingTag)) - 1; } … … 120 118 121 119 private: 122 StreamConnectionBuffer(Ref<WebKit::SharedMemory>&&, size_t memorySize , Semaphore&& clientWaitSemaphore);120 StreamConnectionBuffer(Ref<WebKit::SharedMemory>&&, size_t memorySize); 123 121 124 122 struct Header { … … 133 131 size_t m_dataSize { 0 }; 134 132 Ref<WebKit::SharedMemory> m_sharedMemory; 135 Semaphore m_clientWaitSemaphore;136 133 }; 137 134 -
trunk/Source/WebKit/Platform/IPC/StreamServerConnection.cpp
r292803 r293723 173 173 // If the client wrote over serverOffset, it means the client is waiting. 174 174 if (oldServerOffset == ServerOffset::clientIsWaitingTag) 175 m_ buffer.clientWaitSemaphore().signal();175 m_clientWaitSemaphore.signal(); 176 176 else 177 177 ASSERT(!(oldServerOffset & ServerOffset::clientIsWaitingTag)); … … 186 186 // If the client wrote over serverOffset, it means the client is waiting. 187 187 if (oldServerOffset == ServerOffset::clientIsWaitingTag) 188 m_ buffer.clientWaitSemaphore().signal();188 m_clientWaitSemaphore.signal(); 189 189 else 190 190 ASSERT(!(oldServerOffset & ServerOffset::clientIsWaitingTag)); -
trunk/Source/WebKit/Platform/IPC/StreamServerConnection.h
r292863 r293723 29 29 #include "Decoder.h" 30 30 #include "Encoder.h" 31 #include "IPCSemaphore.h" 31 32 #include "MessageNames.h" 32 33 #include "StreamConnectionBuffer.h" … … 87 88 void sendSyncReply(Connection::SyncRequestID, Arguments&&...); 88 89 90 Semaphore& clientWaitSemaphore() { return m_clientWaitSemaphore; } 91 89 92 private: 90 93 enum class HasDedicatedConnection : bool { No, Yes }; … … 121 124 122 125 Ref<IPC::Connection> m_connection; 126 Semaphore m_clientWaitSemaphore; 123 127 StreamConnectionWorkQueue& m_workQueue; 124 128 -
trunk/Source/WebKit/Shared/IPCStreamTester.cpp
r292803 r293723 58 58 m_streamConnection->open(); 59 59 workQueue().dispatch([this] { 60 m_streamConnection->connection().send(Messages::IPCStreamTesterProxy::WasCreated(workQueue().wakeUpSemaphore() ), m_identifier);60 m_streamConnection->connection().send(Messages::IPCStreamTesterProxy::WasCreated(workQueue().wakeUpSemaphore(), m_streamConnection->clientWaitSemaphore()), m_identifier); 61 61 }); 62 62 } … … 88 88 } 89 89 90 void IPCStreamTester::syncCrashOnZero(int32_t value, CompletionHandler<void(int32_t)>&& completionHandler) 91 { 92 if (!value) { 93 // Use exit so that we don't leave a crash report. 94 #if OS(WINDOWS) 95 // Calling _exit in non-main threads may cause a deadlock in WTF::Thread::ThreadHolder::~ThreadHolder. 96 TerminateProcess(GetCurrentProcess(), EXIT_SUCCESS); 97 #else 98 _exit(EXIT_SUCCESS); 99 #endif 100 } 101 completionHandler(value); 102 } 103 90 104 } 91 105 -
trunk/Source/WebKit/Shared/IPCStreamTester.h
r292280 r293723 59 59 // Messages. 60 60 void syncMessageReturningSharedMemory1(uint32_t byteCount, CompletionHandler<void(SharedMemory::IPCHandle)>&&); 61 void syncCrashOnZero(int32_t, CompletionHandler<void(int32_t)>&&); 61 62 62 63 const Ref<IPC::StreamConnectionWorkQueue> m_workQueue; -
trunk/Source/WebKit/Shared/IPCStreamTester.messages.in
r290505 r293723 25 25 messages -> IPCStreamTester NotRefCounted Stream { 26 26 SyncMessageReturningSharedMemory1(uint32_t byteCount) -> (WebKit::SharedMemory::IPCHandle handle) Synchronous NotStreamEncodableReply 27 SyncCrashOnZero(int32_t value) -> (int32_t sameValue) Synchronous 27 28 } 28 29 -
trunk/Source/WebKit/Shared/IPCStreamTesterProxy.h
r290594 r293723 50 50 51 51 // Messages. 52 void wasCreated(IPC::Semaphore&& ) { }52 void wasCreated(IPC::Semaphore&&, IPC::Semaphore&&) { } 53 53 }; 54 54 -
trunk/Source/WebKit/Shared/IPCStreamTesterProxy.messages.in
r290505 r293723 24 24 25 25 messages -> IPCStreamTesterProxy NotRefCounted { 26 void WasCreated(IPC::Semaphore streamWakeUpSemaphore )26 void WasCreated(IPC::Semaphore streamWakeUpSemaphore, IPC::Semaphore streamClientWaitSemaphore) 27 27 } 28 28 -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
r293211 r293723 318 318 } 319 319 320 void RemoteGraphicsContextGLProxy::wasCreated(bool didSucceed, IPC::Semaphore&& semaphore, String&& availableExtensions, String&& requestedExtensions)320 void RemoteGraphicsContextGLProxy::wasCreated(bool didSucceed, IPC::Semaphore&& wakeUpSemaphore, IPC::Semaphore&& clientWaitSemaphore, String&& availableExtensions, String&& requestedExtensions) 321 321 { 322 322 if (isContextLost()) … … 327 327 } 328 328 ASSERT(!m_didInitialize); 329 m_streamConnection.set WakeUpSemaphore(WTFMove(semaphore));329 m_streamConnection.setSemaphores(WTFMove(wakeUpSemaphore), WTFMove(clientWaitSemaphore)); 330 330 m_didInitialize = true; 331 331 initialize(availableExtensions, requestedExtensions); -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
r293211 r293723 347 347 private: 348 348 // Messages to be received. 349 void wasCreated(bool didSucceed, IPC::Semaphore&&, String&& availableExtensions, String&& requestedExtensions);349 void wasCreated(bool didSucceed, IPC::Semaphore&&, IPC::Semaphore&&, String&& availableExtensions, String&& requestedExtensions); 350 350 void wasLost(); 351 351 void wasChanged(); -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in
r273204 r293723 24 24 25 25 messages -> RemoteGraphicsContextGLProxy NotRefCounted { 26 void WasCreated(bool didSucceed, IPC::Semaphore streamWakeUpSemaphore, String availableExtensions, String requestableExtensions)26 void WasCreated(bool didSucceed, IPC::Semaphore streamWakeUpSemaphore, IPC::Semaphore streamClientWaitSemaphore, String availableExtensions, String requestableExtensions) 27 27 void WasLost() 28 28 void WasChanged() -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
r293683 r293723 428 428 { 429 429 ensureGPUProcessConnection(); 430 if (UNLIKELY(!m_streamConnection->has WakeUpSemaphore()))431 m_streamConnection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::Did CreateWakeUpSemaphoreForDisplayListStream>(renderingBackendIdentifier(), 3_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);430 if (UNLIKELY(!m_streamConnection->hasSemaphores())) 431 m_streamConnection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidInitialize>(renderingBackendIdentifier(), 3_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); 432 432 return *m_streamConnection; 433 433 } 434 434 435 void RemoteRenderingBackendProxy::did CreateWakeUpSemaphoreForDisplayListStream(IPC::Semaphore&& semaphore)435 void RemoteRenderingBackendProxy::didInitialize(IPC::Semaphore&& wakeUp, IPC::Semaphore&& clientWait) 436 436 { 437 437 if (!m_streamConnection) { … … 439 439 return; 440 440 } 441 m_streamConnection->set WakeUpSemaphore(WTFMove(semaphore));441 m_streamConnection->setSemaphores(WTFMove(wakeUp), WTFMove(clientWait)); 442 442 } 443 443 -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h
r293683 r293723 134 134 bool isGPUProcessConnectionClosed() const { return !m_gpuProcessConnection; } 135 135 136 void did CreateWakeUpSemaphoreForDisplayListStream(IPC::Semaphore&&);136 void didInitialize(IPC::Semaphore&& wakeUpSemaphore, IPC::Semaphore&& clientWaitSemaphore); 137 137 138 138 template<typename T, typename U> -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in
r293683 r293723 27 27 DidFlush(WebCore::GraphicsContextFlushIdentifier flushIdentifier, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) 28 28 DidFinalizeRenderingUpdate(WebKit::RenderingUpdateID didRenderingUpdateID) 29 Did CreateWakeUpSemaphoreForDisplayListStream(IPC::Semaphore wakeUpSemaphore)29 DidInitialize(IPC::Semaphore wakeUpSemaphore, IPC::Semaphore clientWaitSemaphore) 30 30 DidMarkLayersAsVolatile(WebKit::MarkSurfacesAsVolatileRequestIdentifier requestIdentifier, Vector<WebCore::RenderingResourceIdentifier> markedVolatileBufferIdentifiers, bool didMarkAllLayersAsVolatile) 31 31 } -
trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp
r292803 r293723 76 76 } 77 77 78 void RemoteGPUProxy::wasCreated(bool didSucceed, IPC::Semaphore&& semaphore)78 void RemoteGPUProxy::wasCreated(bool didSucceed, IPC::Semaphore&& wakeUpSemaphore, IPC::Semaphore&& clientWaitSemaphore) 79 79 { 80 80 ASSERT(!m_didInitialize); 81 m_streamConnection.set WakeUpSemaphore(WTFMove(semaphore));81 m_streamConnection.setSemaphores(WTFMove(wakeUpSemaphore), WTFMove(clientWaitSemaphore)); 82 82 m_didInitialize = true; 83 83 m_lost = !didSucceed; -
trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h
r291323 r293723 77 77 78 78 // Messages to be received. 79 void wasCreated(bool didSucceed, IPC::Semaphore&& );79 void wasCreated(bool didSucceed, IPC::Semaphore&& wakeUpSemaphore, IPC::Semaphore&& clientWaitSemaphore); 80 80 81 81 void waitUntilInitialized(); -
trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.messages.in
r286320 r293723 24 24 25 25 messages -> RemoteGPUProxy NotRefCounted { 26 void WasCreated(bool didSucceed, IPC::Semaphore streamWakeUpSemaphore )26 void WasCreated(bool didSucceed, IPC::Semaphore streamWakeUpSemaphore, IPC::Semaphore streamClientWaitSemaphore) 27 27 } 28 28 -
trunk/Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp
r293612 r293723 33 33 #include "GPUProcessConnection.h" 34 34 #include "IPCSemaphore.h" 35 #include "IPCStreamTesterMessages.h" 35 36 #include "JSIPCBinding.h" 36 37 #include "MessageArgumentDescriptions.h" … … 194 195 { } 195 196 196 void set WakeUpSemaphore(JSIPCSemaphore& jsSemaphore) { m_streamConnection.setWakeUpSemaphore(jsSemaphore.exchange()); }197 void setSemaphores(JSIPCSemaphore& jsWakeUpSemaphore, JSIPCSemaphore& jsClientWaitSemaphore) { m_streamConnection.setSemaphores(jsWakeUpSemaphore.exchange(), jsClientWaitSemaphore.exchange()); } 197 198 198 199 static JSClassRef wrapperClass(); … … 205 206 static const JSStaticFunction* staticFunctions(); 206 207 static JSValueRef streamBuffer(JSContextRef, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 207 static JSValueRef set WakeUpSemaphore(JSContextRef, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);208 static JSValueRef setSemaphores(JSContextRef, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 208 209 static JSValueRef sendMessage(JSContextRef, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 209 210 static JSValueRef sendSyncMessage(JSContextRef, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 211 static JSValueRef sendIPCStreamTesterSyncCrashOnZero(JSContextRef, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 210 212 211 213 WeakPtr<JSIPC> m_jsIPC; … … 855 857 static const JSStaticFunction functions[] = { 856 858 { "streamBuffer", streamBuffer, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, 857 { "set WakeUpSemaphore", setWakeUpSemaphore, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },859 { "setSemaphores", setSemaphores, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, 858 860 { "sendMessage", sendMessage, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, 859 861 { "sendSyncMessage", sendSyncMessage, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, 862 { "sendIPCStreamTesterSyncCrashOnZero", sendIPCStreamTesterSyncCrashOnZero, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, 860 863 { 0, 0, 0 } 861 864 }; … … 876 879 } 877 880 878 JSValueRef JSIPCStreamClientConnection::set WakeUpSemaphore(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)881 JSValueRef JSIPCStreamClientConnection::setSemaphores(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 879 882 { 880 883 auto* globalObject = toJS(context); … … 886 889 } 887 890 888 if (argumentCount < 1) {889 *exception = createTypeError(context, "Must specify an IPC semaphore as the first a rgument"_s);890 return JSValueMakeUndefined(context); 891 } 892 893 RefPtr js Semaphore = JSIPCSemaphore::toWrapped(context, arguments[0]);894 if (!js Semaphore) {891 if (argumentCount < 2) { 892 *exception = createTypeError(context, "Must specify an IPC semaphore as the first and second argument"_s); 893 return JSValueMakeUndefined(context); 894 } 895 896 RefPtr jsWakeUpSemaphore = JSIPCSemaphore::toWrapped(context, arguments[0]); 897 if (!jsWakeUpSemaphore) { 895 898 *exception = createTypeError(context, "Wrong type (expected Semaphore)"_s); 896 899 return JSValueMakeUndefined(context); 897 900 } 898 901 899 jsStreamConnection->setWakeUpSemaphore(*jsSemaphore); 902 RefPtr jsClientWaitSemaphore = JSIPCSemaphore::toWrapped(context, arguments[1]); 903 if (!jsClientWaitSemaphore) { 904 *exception = createTypeError(context, "Wrong type (expected Semaphore)"_s); 905 return JSValueMakeUndefined(context); 906 } 907 908 jsStreamConnection->setSemaphores(*jsWakeUpSemaphore, *jsClientWaitSemaphore); 900 909 return JSValueMakeUndefined(context); 901 910 } … … 1018 1027 1019 1028 return JSValueMakeUndefined(context); 1029 } 1030 1031 // FIXME(http://webkit.org/b/237197): Cannot send arbitrary messages, so we hard-code this one to be able to send it. 1032 JSValueRef JSIPCStreamClientConnection::sendIPCStreamTesterSyncCrashOnZero(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1033 { 1034 auto* globalObject = toJS(context); 1035 JSC::JSLockHolder lock(globalObject->vm()); 1036 1037 RefPtr jsStreamConnection = toWrapped(context, thisObject); 1038 if (!jsStreamConnection) { 1039 *exception = createTypeError(context, "Wrong type"_s); 1040 return JSValueMakeUndefined(context); 1041 } 1042 1043 if (argumentCount < 3) { 1044 *exception = createTypeError(context, "Must specify destination ID, value, and timeout as the first three arguments"_s); 1045 return JSValueMakeUndefined(context); 1046 } 1047 1048 auto destinationID = destinationIDFromArgument(globalObject, arguments[0], exception); 1049 if (!destinationID) 1050 return JSValueMakeUndefined(context); 1051 1052 int32_t value; 1053 { 1054 auto jsValue = toJS(globalObject, arguments[1]); 1055 if (!jsValue.isNumber()) { 1056 *exception = createTypeError(context, "value must be a number"_s); 1057 return JSValueMakeUndefined(context); 1058 } 1059 value = static_cast<int32_t>(jsValue.asNumber()); 1060 } 1061 1062 Seconds timeoutDuration; 1063 { 1064 auto jsValue = toJS(globalObject, arguments[2]); 1065 if (!jsValue.isNumber()) { 1066 *exception = createTypeError(context, "timeout must be a number"_s); 1067 return JSValueMakeUndefined(context); 1068 } 1069 timeoutDuration = Seconds { jsValue.asNumber() }; 1070 } 1071 1072 auto& streamConnection = jsStreamConnection->connection(); 1073 int32_t resultValue = 0; 1074 enum JSIPCStreamTesterIdentifierType { }; 1075 auto destination = makeObjectIdentifier<JSIPCStreamTesterIdentifierType>(*destinationID); 1076 1077 auto result = streamConnection.sendSync(Messages::IPCStreamTester::SyncCrashOnZero(value), Messages::IPCStreamTester::SyncCrashOnZero::Reply(resultValue), destination, timeoutDuration); 1078 if (!result) { 1079 *exception = createTypeError(context, "sync send failed"_s); 1080 return JSValueMakeUndefined(context); 1081 } 1082 1083 return JSValueMakeNumber(context, resultValue); 1020 1084 } 1021 1085
Note:
See TracChangeset
for help on using the changeset viewer.