Changeset 275553 in webkit
- Timestamp:
- Apr 6, 2021 2:27:06 PM (3 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r275549 r275553 1 2021-04-06 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 Add IPC::Semaphore stub for Unix ports 4 https://bugs.webkit.org/show_bug.cgi?id=224223 5 6 Reviewed by Don Olmstead. 7 8 PlayStation, GTK and WPE ports don't use it yet. Just add stubs 9 instead of scattering #if everywhere using Semaphore. 10 11 * GPUProcess/graphics/RemoteRenderingBackend.cpp: 12 (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): 13 (WebKit::RemoteRenderingBackend::populateGetImageDataSharedMemory): 14 * Platform/IPC/StreamClientConnection.cpp: 15 (IPC::StreamClientConnection::setWakeUpSemaphore): 16 (IPC::StreamClientConnection::wakeUpServer): 17 * Platform/IPC/StreamClientConnection.h: 18 (IPC::StreamClientConnection::tryAcquire): 19 (IPC::StreamClientConnection::tryAcquireAll): 20 * Platform/IPC/StreamConnectionWorkQueue.cpp: 21 (IPC::StreamConnectionWorkQueue::StreamConnectionWorkQueue): 22 (IPC::StreamConnectionWorkQueue::removeStreamConnection): 23 (IPC::StreamConnectionWorkQueue::stop): 24 (IPC::StreamConnectionWorkQueue::wakeUp): 25 (IPC::StreamConnectionWorkQueue::wakeUpProcessingThread): 26 * Platform/IPC/StreamConnectionWorkQueue.h: 27 * Platform/IPC/StreamServerConnection.cpp: 28 (IPC::StreamServerConnectionBase::release): 29 (IPC::StreamServerConnectionBase::releaseAll): 30 * Platform/IPC/unix/IPCSemaphoreUnix.cpp: Added. 31 (IPC::Semaphore::Semaphore): 32 (IPC::Semaphore::signal): 33 (IPC::Semaphore::wait): 34 (IPC::Semaphore::waitFor): 35 (IPC::Semaphore::encode const): 36 (IPC::Semaphore::decode): 37 (IPC::Semaphore::destroy): 38 * PlatformPlayStation.cmake: 39 * Sources.txt: 40 * SourcesGTK.txt: 41 * SourcesWPE.txt: 42 * WebKit.xcodeproj/project.pbxproj: 43 * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: 44 (WebKit::RemoteRenderingBackendProxy::waitForGetImageDataToComplete): 45 (WebKit::RemoteRenderingBackendProxy::didAppendData): 46 * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: 47 (WebKit::RemoteAudioDestinationProxy::startRenderingThread): 48 (WebKit::RemoteAudioDestinationProxy::stopRenderingThread): 49 1 50 2021-04-06 Ryosuke Niwa <rniwa@webkit.org> 2 51 -
trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
r275403 r275553 248 248 249 249 handle.startWaiting(); 250 #if PLATFORM(COCOA)251 250 m_resumeDisplayListSemaphore.waitFor(30_us); 252 #else253 sleep(30_us);254 #endif255 251 256 252 auto resumeReadingInfo = handle.stopWaiting(); … … 377 373 memset(m_getImageDataSharedMemory->data(), 0, m_getImageDataSharedMemory->size()); 378 374 379 #if OS(DARWIN)380 375 m_getImageDataSemaphore.signal(); 381 #endif382 376 } 383 377 -
trunk/Source/WebKit/Platform/IPC/StreamClientConnection.cpp
r275463 r275553 41 41 void StreamClientConnection::setWakeUpSemaphore(IPC::Semaphore&& semaphore) 42 42 { 43 #if PLATFORM(COCOA) || PLATFORM(WIN)44 43 m_wakeUpSemaphore = WTFMove(semaphore); 45 #endif46 44 wakeUpServer(); 47 45 } … … 49 47 void StreamClientConnection::wakeUpServer() 50 48 { 51 #if PLATFORM(COCOA) || PLATFORM(WIN)52 49 if (m_wakeUpSemaphore) 53 50 m_wakeUpSemaphore->signal(); 54 #endif55 51 } 56 52 -
trunk/Source/WebKit/Platform/IPC/StreamClientConnection.h
r275463 r275553 103 103 size_t m_clientOffset { 0 }; 104 104 StreamConnectionBuffer m_buffer; 105 #if PLATFORM(COCOA) || PLATFORM(WIN)106 105 Optional<Semaphore> m_wakeUpSemaphore; 107 #endif108 106 }; 109 107 … … 241 239 if (timeout.didTimeOut()) 242 240 break; 243 #if PLATFORM(COCOA) || PLATFORM(WIN)244 241 ClientLimit oldClientLimit = sharedClientLimit().compareExchangeStrong(clientLimit, ClientLimit::clientIsWaitingTag, std::memory_order_acq_rel, std::memory_order_acq_rel); 245 242 if (clientLimit == oldClientLimit) { … … 248 245 } else 249 246 clientLimit = oldClientLimit; 250 #else251 Thread::yield();252 clientLimit = sharedClientLimit().load(std::memory_order_acquire);253 #endif254 247 // The alignedSpan uses the minimumMessageSize to calculate the next beginning position in the buffer, 255 248 // and not the size. The size might be more or less what is needed, depending on where the reader is. … … 274 267 275 268 for (;;) { 276 #if PLATFORM(COCOA) || PLATFORM(WIN)277 269 ClientLimit clientLimit = sharedClientLimit().exchange(ClientLimit::clientIsWaitingTag, std::memory_order_acq_rel); 278 270 ClientOffset clientOffset = sharedClientOffset().load(std::memory_order_acquire); 279 #else280 ClientLimit clientLimit = sharedClientLimit().load(std::memory_order_acquire);281 ClientOffset clientOffset = sharedClientOffset().load(std::memory_order_acquire);282 #endif283 271 if (!clientLimit && (clientOffset == ClientOffset::serverIsSleepingTag || !clientOffset)) 284 272 break; 285 273 286 #if PLATFORM(COCOA) || PLATFORM(WIN)287 274 m_buffer.clientWaitSemaphore().waitFor(timeout); 288 #else289 Thread::yield();290 #endif291 275 if (timeout.didTimeOut()) 292 276 return WTF::nullopt; 293 277 } 294 #if PLATFORM(COCOA) || PLATFORM(WIN)295 278 // In case the transaction was cancelled, undo the transaction marker. 296 279 sharedClientLimit().store(static_cast<ClientLimit>(0), std::memory_order_release); 297 #endif298 280 m_clientOffset = 0; 299 281 return alignedSpan(m_clientOffset, 0); -
trunk/Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.cpp
r275463 r275553 30 30 31 31 StreamConnectionWorkQueue::StreamConnectionWorkQueue(const char* name) 32 #if PLATFORM(COCOA) || PLATFORM(WIN)33 32 : m_name(name) 34 #endif35 33 { 36 34 } … … 64 62 ASSERT(!m_shouldQuit); // Re-entering during shutdown not supported. 65 63 } 66 #if PLATFORM(COCOA) || PLATFORM(WIN)67 64 m_wakeUpSemaphore.signal(); 68 #endif69 65 } 70 66 … … 72 68 { 73 69 m_shouldQuit = true; 74 #if PLATFORM(COCOA) || PLATFORM(WIN)75 70 if (!m_processingThread) 76 71 return; … … 78 73 m_processingThread->waitForCompletion(); 79 74 m_processingThread = nullptr; 80 #endif81 75 } 82 76 83 77 void StreamConnectionWorkQueue::wakeUp() 84 78 { 85 #if PLATFORM(COCOA) || PLATFORM(WIN)86 79 m_wakeUpSemaphore.signal(); 87 #endif88 80 } 89 81 … … 95 87 void StreamConnectionWorkQueue::wakeUpProcessingThread() 96 88 { 97 #if PLATFORM(COCOA) || PLATFORM(WIN)98 89 if (m_processingThread) { 99 90 m_wakeUpSemaphore.signal(); … … 112 103 }; 113 104 m_processingThread = Thread::create(m_name, WTFMove(task), ThreadType::Graphics, Thread::QOS::UserInteractive); 114 #endif115 105 } 116 106 -
trunk/Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h
r275463 r275553 54 54 void processStreams(); 55 55 56 #if PLATFORM(COCOA) || PLATFORM(WIN)57 56 const char* const m_name; 58 #endif59 57 60 58 Semaphore m_wakeUpSemaphore; -
trunk/Source/WebKit/Platform/IPC/StreamServerConnection.cpp
r275463 r275553 89 89 ServerOffset serverOffset = static_cast<ServerOffset>(wrapOffset(alignOffset(m_serverOffset) + readSize)); 90 90 91 #if PLATFORM(COCOA) || PLATFORM(WIN)92 91 ServerOffset oldServerOffset = sharedServerOffset().exchange(serverOffset, std::memory_order_acq_rel); 93 92 // If the client wrote over serverOffset, it means the client is waiting. … … 96 95 else 97 96 ASSERT(!(oldServerOffset & ServerOffset::clientIsWaitingTag)); 98 #else99 sharedServerOffset().store(serverOffset, std::memory_order_release);100 // IPC::Semaphore not implemented for the platform. Client will poll and yield.101 #endif102 97 103 98 m_serverOffset = serverOffset; … … 107 102 { 108 103 sharedServerLimit().store(static_cast<ServerLimit>(0), std::memory_order_release); 109 #if PLATFORM(COCOA) || PLATFORM(WIN)110 104 ServerOffset oldServerOffset = sharedServerOffset().exchange(static_cast<ServerOffset>(0), std::memory_order_acq_rel); 111 105 // If the client wrote over serverOffset, it means the client is waiting. … … 114 108 else 115 109 ASSERT(!(oldServerOffset & ServerOffset::clientIsWaitingTag)); 116 #else117 sharedServerOffset().store(static_cast<ServerOffset>(0), std::memory_order_release);118 // IPC::Semaphore not implemented for the platform. Client will poll and yield.119 #endif120 110 m_serverOffset = 0; 121 111 } -
trunk/Source/WebKit/Platform/IPC/unix/IPCSemaphoreUnix.cpp
r275552 r275553 27 27 #include "IPCSemaphore.h" 28 28 29 #if !OS(DARWIN) && !OS(WINDOWS)30 31 29 namespace IPC { 32 30 33 Semaphore::Semaphore() = default; 31 Semaphore::Semaphore() 32 { 33 ASSERT_NOT_REACHED(); 34 } 34 35 35 Semaphore::Semaphore(Semaphore&&) = default; 36 Semaphore::Semaphore(Semaphore&&) 37 { 38 ASSERT_NOT_REACHED(); 39 } 36 40 37 41 Semaphore::~Semaphore() = default; … … 39 43 Semaphore& Semaphore::operator=(Semaphore&&) = default; 40 44 41 void Semaphore::encode(Encoder&) const { } 45 void Semaphore::signal() 46 { 47 } 48 49 void Semaphore::wait() 50 { 51 } 52 53 bool Semaphore::waitFor(Timeout) 54 { 55 return false; 56 } 57 58 void Semaphore::encode(Encoder&) const 59 { 60 } 42 61 43 62 Optional<Semaphore> Semaphore::decode(Decoder&) … … 46 65 } 47 66 67 void Semaphore::destroy() 68 { 48 69 } 49 70 50 #endif 71 } // namespace IPC -
trunk/Source/WebKit/PlatformPlayStation.cmake
r271360 r275553 53 53 Platform/IPC/unix/AttachmentUnix.cpp 54 54 Platform/IPC/unix/ConnectionUnix.cpp 55 Platform/IPC/unix/IPCSemaphoreUnix.cpp 55 56 56 57 Platform/classifier/ResourceLoadStatisticsClassifier.cpp -
trunk/Source/WebKit/Sources.txt
r275537 r275553 147 147 Platform/IPC/Decoder.cpp @no-unify 148 148 Platform/IPC/Encoder.cpp @no-unify 149 Platform/IPC/IPCSemaphore.cpp @no-unify150 149 Platform/IPC/JSIPCBinding.cpp @no-unify 151 150 Platform/IPC/MessageReceiveQueueMap.cpp @no-unify -
trunk/Source/WebKit/SourcesGTK.txt
r274815 r275553 53 53 Platform/IPC/unix/AttachmentUnix.cpp 54 54 Platform/IPC/unix/ConnectionUnix.cpp 55 Platform/IPC/unix/IPCSemaphoreUnix.cpp 55 56 56 57 Platform/classifier/ResourceLoadStatisticsClassifier.cpp -
trunk/Source/WebKit/SourcesWPE.txt
r273131 r275553 53 53 Platform/IPC/unix/AttachmentUnix.cpp 54 54 Platform/IPC/unix/ConnectionUnix.cpp 55 Platform/IPC/unix/IPCSemaphoreUnix.cpp 55 56 56 57 Platform/classifier/ResourceLoadStatisticsClassifier.cpp -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r275537 r275553 1601 1601 A1FB68241F6E518200C43F9F /* WKCrashReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = A1FB68221F6E518200C43F9F /* WKCrashReporter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1602 1602 A31F60A425CC7DB900AF14F4 /* IPCSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = A31F60A225CC7DB800AF14F4 /* IPCSemaphore.h */; }; 1603 A31F60A525CC7DB900AF14F4 /* IPCSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A31F60A325CC7DB800AF14F4 /* IPCSemaphore.cpp */; };1604 1603 A513F5402154A5D700662841 /* WebPageInspectorController.h in Headers */ = {isa = PBXBuildFile; fileRef = A513F53E2154A5CC00662841 /* WebPageInspectorController.h */; }; 1605 1604 A518B5D21FE1D55B00F9FA28 /* WKInspectorWKWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = A518B5D01FE1D55B00F9FA28 /* WKInspectorWKWebView.h */; }; … … 5059 5058 A1FB68231F6E518200C43F9F /* WKCrashReporter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKCrashReporter.mm; sourceTree = "<group>"; }; 5060 5059 A31F60A225CC7DB800AF14F4 /* IPCSemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IPCSemaphore.h; sourceTree = "<group>"; }; 5061 A31F60A325CC7DB800AF14F4 /* IPCSemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IPCSemaphore.cpp; sourceTree = "<group>"; };5062 5060 A31F60A625CC7DCF00AF14F4 /* IPCSemaphoreDarwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IPCSemaphoreDarwin.cpp; sourceTree = "<group>"; }; 5063 5061 A38A12E123C93AC700FABFA9 /* TextChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextChecker.cpp; sourceTree = "<group>"; }; … … 7044 7042 4151E5C31FBB90A900E47E2D /* FormDataReference.h */, 7045 7043 C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */, 7046 A31F60A325CC7DB800AF14F4 /* IPCSemaphore.cpp */,7047 7044 A31F60A225CC7DB800AF14F4 /* IPCSemaphore.h */, 7048 7045 9BF5EC6325410E9900984E77 /* JSIPCBinding.cpp */, … … 13916 13913 2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */, 13917 13914 2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */, 13918 A31F60A525CC7DB900AF14F4 /* IPCSemaphore.cpp in Sources */,13919 13915 9BF5EC642541145600984E77 /* JSIPCBinding.cpp in Sources */, 13920 13916 2D913441212CF9F000128AFD /* JSNPMethod.cpp in Sources */, -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
r275240 r275553 181 181 { 182 182 ASSERT(m_getImageDataSemaphore); 183 #if OS(DARWIN)184 183 return m_getImageDataSemaphore->waitFor(timeout); 185 #else186 return true;187 #endif188 184 } 189 185 … … 327 323 if (m_deferredWakeupMessageArguments) { 328 324 if (sharedHandle->tryToResume({ m_deferredWakeupMessageArguments->offset, m_deferredWakeupMessageArguments->destinationImageBufferIdentifier.toUInt64() })) { 329 #if PLATFORM(COCOA)330 325 m_resumeDisplayListSemaphore.signal(); 331 #endif332 326 m_deferredWakeupMessageArguments = WTF::nullopt; 333 327 m_remainingItemsToAppendBeforeSendingWakeup = 0; … … 344 338 auto offsetToRead = sharedHandle->writableOffset() - numberOfBytes; 345 339 if (sharedHandle->tryToResume({ offsetToRead, destinationImageBuffer.toUInt64() })) { 346 #if PLATFORM(COCOA)347 340 m_resumeDisplayListSemaphore.signal(); 348 #endif349 341 return; 350 342 } -
trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp
r274459 r275553 75 75 void RemoteAudioDestinationProxy::startRenderingThread() 76 76 { 77 #if PLATFORM(COCOA)78 77 ASSERT(!m_renderThread); 79 78 … … 88 87 }; 89 88 m_renderThread = Thread::create("RemoteAudioDestinationProxy render thread", WTFMove(offThreadRendering), ThreadType::Audio, Thread::QOS::UserInteractive); 90 #endif91 89 } 92 90 93 91 void RemoteAudioDestinationProxy::stopRenderingThread() 94 92 { 95 #if PLATFORM(COCOA)96 93 if (!m_renderThread) 97 94 return; … … 101 98 m_renderThread->waitForCompletion(); 102 99 m_renderThread = nullptr; 103 #endif104 100 } 105 101
Note: See TracChangeset
for help on using the changeset viewer.