haikuwebkit/Source/WTF/wtf/ParallelJobsGeneric.h

94 lines
2.8 KiB
C
Raw Permalink Normal View History

2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
/*
* Copyright (C) 2011 University of Szeged
* Copyright (C) 2011 Gabor Loki <loki@webkit.org>
* 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED OR
* 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.
*/
#ifndef ParallelJobsGeneric_h
#define ParallelJobsGeneric_h
#if ENABLE(THREADING_GENERIC)
Drop CheckedLock / CheckedCondition aliases https://bugs.webkit.org/show_bug.cgi?id=226176 Reviewed by Kate Cheney. Drop CheckedLock / CheckedCondition aliases now that they are the default. Source/JavaScriptCore: * API/JSVirtualMachine.mm: * API/glib/JSCVirtualMachine.cpp: * assembler/PerfLog.h: * assembler/testmasm.cpp: * bytecode/StructureStubInfo.h: * bytecode/SuperSampler.cpp: * dfg/DFGCommon.cpp: * dfg/DFGCommonData.cpp: * dfg/DFGPlan.h: * dfg/DFGThreadData.h: * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::Worklist): * dfg/DFGWorklist.h: * disassembler/Disassembler.cpp: * dynbench.cpp: * heap/BlockDirectory.cpp: (JSC::BlockDirectory::parallelNotEmptyBlockSource): * heap/BlockDirectory.h: (JSC::BlockDirectory::bitvectorLock): * heap/CodeBlockSet.h: (JSC::CodeBlockSet::getLock): * heap/Heap.cpp: (JSC::Heap::Heap): * heap/Heap.h: * heap/IsoSubspacePerVM.h: * heap/MarkedSpace.h: (JSC::MarkedSpace::directoryLock): * heap/MarkingConstraintSolver.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::donateKnownParallel): * heap/SlotVisitor.h: * inspector/remote/socket/RemoteInspectorConnectionClient.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::getLock const): (JSC::dumpJITMemory): * jit/ExecutableAllocator.h: (JSC::ExecutableAllocatorBase::getLock const): * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): * jit/JITWorklist.h: * jsc.cpp: * profiler/ProfilerDatabase.h: * runtime/ConcurrentJSLock.h: * runtime/DeferredWorkTimer.h: * runtime/JSLock.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::CFrameWalker::CFrameWalker): (JSC::SamplingProfiler::takeSample): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::getLock): * runtime/VM.h: * runtime/VMTraps.cpp: (JSC::VMTraps::invalidateCodeBlocksOnStack): (JSC::VMTraps::VMTraps): * runtime/VMTraps.h: * tools/FunctionOverrides.h: * tools/VMInspector.cpp: (JSC::ensureIsSafeToLock): * tools/VMInspector.h: (JSC::VMInspector::getLock): * wasm/WasmCalleeRegistry.h: (JSC::Wasm::CalleeRegistry::getLock): * wasm/WasmPlan.h: * wasm/WasmStreamingCompiler.h: * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::Worklist): * wasm/WasmWorklist.h: Source/WebCore: * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/server/IDBSerializationContext.cpp: * Modules/indexeddb/server/IDBServer.cpp: * Modules/mediastream/RTCDataChannel.cpp: * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * Modules/speech/SpeechRecognitionCaptureSourceImpl.h: * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/MediaElementAudioSourceNode.h: * Modules/webdatabase/Database.cpp: * Modules/webdatabase/Database.h: * Modules/webdatabase/DatabaseManager.h: * Modules/webdatabase/DatabaseTask.h: * Modules/webdatabase/DatabaseThread.h: * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::openDatabaseMutex): * Modules/webdatabase/DatabaseTracker.h: * Modules/webdatabase/OriginLock.cpp: * Modules/webdatabase/SQLCallbackWrapper.h: * Modules/webdatabase/SQLTransaction.h: * Modules/webgpu/WebGPUDevice.cpp: (WebCore::WebGPUDevice::instancesLock): * Modules/webgpu/WebGPUDevice.h: * Modules/webgpu/WebGPUPipeline.cpp: (WebCore::WebGPUPipeline::instancesLock): * Modules/webgpu/WebGPUPipeline.h: * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::allActiveWebSocketsLock): * Modules/websockets/WebSocket.h: * accessibility/isolatedtree/AXIsolatedTree.cpp: * accessibility/isolatedtree/AXIsolatedTree.h: * bindings/js/JSDOMGlobalObject.h: * bridge/objc/WebScriptObject.mm: * crypto/CryptoAlgorithmRegistry.h: * dom/MessagePort.cpp: * dom/Node.cpp: * dom/ScriptExecutionContext.cpp: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::createMediaPlayer): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::instancesLock): * html/canvas/CanvasRenderingContext.h: * html/canvas/WebGLContextGroup.cpp: (WebCore::WebGLContextGroup::objectGraphLockForAContext): * html/canvas/WebGLContextGroup.h: * html/canvas/WebGLContextObject.cpp: (WebCore::WebGLContextObject::objectGraphLockForContext): * html/canvas/WebGLContextObject.h: * html/canvas/WebGLObject.h: * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::instancesLock): * html/canvas/WebGLProgram.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::objectGraphLock): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLSharedObject.cpp: (WebCore::WebGLSharedObject::objectGraphLockForContext): * html/canvas/WebGLSharedObject.h: * inspector/agents/WebHeapAgent.cpp: * page/ResourceUsageThread.h: * page/SecurityPolicy.cpp: * page/WheelEventTestMonitor.h: * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::WTF_RETURNS_LOCK): * page/scrolling/ScrollingTreeLatchingController.h: * page/scrolling/ThreadedScrollingTree.h: (WebCore::ThreadedScrollingTree::WTF_RETURNS_LOCK): * page/scrolling/mac/ScrollingTreeMac.h: * platform/AbortableTaskQueue.h: * platform/GenericTaskQueue.cpp: * platform/GenericTaskQueue.h: * platform/LegacySchemeRegistry.cpp: * platform/audio/AudioDestination.h: * platform/audio/HRTFDatabaseLoader.h: * platform/audio/ReverbConvolver.cpp: (WebCore::ReverbConvolver::backgroundThreadEntry): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/audio/gstreamer/AudioSourceProviderGStreamer.h: * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: * platform/audio/mac/FFTFrameMac.cpp: * platform/encryptedmedia/CDMProxy.h: * platform/graphics/MediaPlayer.cpp: * platform/graphics/ShadowBlur.cpp: (WebCore::ScratchBuffer::lock): (WebCore::ShadowBlur::drawRectShadowWithTiling): (WebCore::ShadowBlur::drawInsetShadowWithTiling): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: * platform/graphics/cg/IOSurfacePool.h: * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: * platform/graphics/gstreamer/ImageDecoderGStreamer.h: * platform/graphics/gstreamer/MainThreadNotifier.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: (WebCore::TextureMapperPlatformLayerProxy::WTF_RETURNS_LOCK): * platform/image-decoders/ScalableImageDecoder.h: * platform/ios/QuickLook.mm: * platform/ios/WebSQLiteDatabaseTrackerClient.mm: * platform/ios/wak/WebCoreThreadRun.cpp: * platform/mediarecorder/MediaRecorderPrivateMock.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h: * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: * platform/network/cf/LoaderRunLoopCF.cpp: (WebCore::loaderRunLoop): * platform/network/cocoa/WebCoreNSURLSession.mm: * platform/network/mac/UTIUtilities.mm: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/sql/SQLiteDatabase.cpp: * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteDatabaseTracker.cpp: * platform/text/TextEncodingRegistry.cpp: * storage/StorageQuotaManager.h: * workers/WorkerGlobalScope.cpp: * workers/WorkerOrWorkletScriptController.h: * workers/WorkerOrWorkletThread.cpp: (WebCore::WorkerOrWorkletThread::workerOrWorkletThreadsLock): * workers/WorkerOrWorkletThread.h: * worklets/PaintWorkletGlobalScope.h: Source/WebKit: * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer): * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: * NetworkProcess/NetworkProcess.h: * NetworkProcess/WebStorage/StorageManagerSet.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: * NetworkProcess/glib/DNSCache.h: * Platform/IPC/Connection.cpp: * Platform/IPC/Connection.h: * Platform/IPC/StreamConnectionWorkQueue.h: * Platform/IPC/StreamServerConnection.h: * Shared/BlockingResponseMap.h: * Shared/Cocoa/XPCEndpointClient.h: * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h: * Shared/mac/MediaFormatReader/MediaFormatReader.h: * Shared/mac/MediaFormatReader/MediaSampleCursor.h: * Shared/mac/MediaFormatReader/MediaTrackReader.h: * UIProcess/API/glib/IconDatabase.h: * UIProcess/WebURLSchemeTask.h: * UIProcess/mac/DisplayLink.h: * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView knowsPageRange:]): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/Network/WebSocketStream.cpp: * WebProcess/Plugins/PluginProcessConnectionManager.h: * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/ViewUpdateDispatcher.h: Source/WebKitLegacy: * Storage/StorageAreaSync.h: Source/WebKitLegacy/mac: * DOM/DOMInternal.mm: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/Assertions.cpp: * wtf/AutomaticThread.cpp: (WTF::AutomaticThreadCondition::wait): (WTF::AutomaticThreadCondition::waitFor): (WTF::AutomaticThread::AutomaticThread): * wtf/AutomaticThread.h: * wtf/CMakeLists.txt: * wtf/CheckedCondition.h: Removed. * wtf/CheckedLock.h: Removed. * wtf/Condition.h: * wtf/CrossThreadQueue.h: * wtf/CrossThreadTaskHandler.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: * wtf/Forward.h: * wtf/Language.cpp: * wtf/Lock.cpp: (WTF::UncheckedLock::lockSlow): (WTF::UncheckedLock::unlockSlow): (WTF::UncheckedLock::unlockFairlySlow): (WTF::UncheckedLock::safepointSlow): * wtf/Lock.h: (WTF::WTF_ASSERTS_ACQUIRED_LOCK): * wtf/Logger.cpp: * wtf/Logger.h: (WTF::Logger::WTF_RETURNS_LOCK): * wtf/MessageQueue.h: * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::release): (WTF::MetaAllocator::MetaAllocator): (WTF::MetaAllocator::allocate): (WTF::MetaAllocator::currentStatistics): * wtf/MetaAllocator.h: * wtf/OSLogPrintStream.h: * wtf/ParallelHelperPool.cpp: (WTF::ParallelHelperPool::ParallelHelperPool): * wtf/ParallelHelperPool.h: * wtf/ParallelJobsGeneric.h: * wtf/ParallelVectorIterator.h: * wtf/ReadWriteLock.h: * wtf/RecursiveLockAdapter.h: * wtf/RunLoop.h: * wtf/SynchronizedFixedQueue.h: * wtf/Threading.cpp: (WTF::Thread::allThreadsLock): * wtf/Threading.h: * wtf/TimingScope.cpp: * wtf/URL.cpp: * wtf/WTFSemaphore.h: * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): * wtf/WorkerPool.cpp: (WTF::WorkerPool::WorkerPool): * wtf/WorkerPool.h: * wtf/cf/LanguageCF.cpp: * wtf/text/AtomStringImpl.cpp: (WTF::AtomStringTableLocker::AtomStringTableLocker): * wtf/text/StringView.cpp: * wtf/threads/BinarySemaphore.h: * wtf/unicode/icu/CollatorICU.cpp: Tools: * TestWebKitAPI/CMakeLists.txt: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp: Removed. * TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp: Removed. * TestWebKitAPI/Tests/WTF/Condition.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WTF/Lock.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WTF/MetaAllocator.cpp: * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AXThread::createThreadIfNeeded): Canonical link: https://commits.webkit.org/238085@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-24 18:29:01 +00:00
#include <wtf/Condition.h>
#include <wtf/Lock.h>
2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
#include <wtf/RefCounted.h>
#include <wtf/Threading.h>
namespace WTF {
class ParallelEnvironment {
WTF_MAKE_FAST_ALLOCATED;
public:
typedef void (*ThreadFunction)(void*);
WTF_EXPORT_PRIVATE ParallelEnvironment(ThreadFunction, size_t sizeOfParameter, int requestedJobNumber);
2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
int numberOfJobs()
{
return m_numberOfJobs;
}
WTF_EXPORT_PRIVATE void execute(void* parameters);
2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
class ThreadPrivate : public RefCounted<ThreadPrivate> {
public:
bool tryLockFor(ParallelEnvironment*);
void execute(ThreadFunction, void*);
void waitForFinish();
Remove all uses of PassRefPtr in WTF https://bugs.webkit.org/show_bug.cgi?id=157596 <rdar://problem/26234391> Reviewed by Chris Dumez. Source/JavaScriptCore: Update calls to interfaces that no longer take or return PassRefPtrs. * runtime/JSString.cpp: (JSC::JSRopeString::resolveRope): * runtime/JSString.h: (JSC::JSString::JSString): (JSC::jsSubstring): * runtime/PrivateName.h: (JSC::PrivateName::PrivateName): * runtime/SmallStrings.cpp: (JSC::SmallStringsStorage::SmallStringsStorage): * runtime/StringConstructor.cpp: (JSC::stringFromCharCodeSlowCase): * runtime/StringPrototype.cpp: (JSC::jsSpliceSubstrings): (JSC::jsSpliceSubstringsWithSeparators): (JSC::replaceUsingStringSearch): (JSC::repeatCharacter): (JSC::stringProtoFuncFontsize): (JSC::stringProtoFuncLink): (JSC::normalize): Source/WebCore: Update calls to interfaces that no longer take or return PassRefPtrs. No new tests: no new functionality so changes are covered by existing tests. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::formatNumberValue): * dom/Document.cpp: (WebCore::Document::displayStringModifiedByEncoding): * xml/XPathGrammar.y: Source/WTF: Remove/update most interfaces that take or return PassRefPtrs. Remaining references include those in non-Cocoa implementations and those required for continued compatibility with modules that still use PassRefPtrs (specifically: Forward.h, RefPtr interoperability, SizeLimits.h, WorkQueue (Windows) DispatchQueueEfl, DispatchWorkItemEfl, and PassRefPtr itself). Update calls to interfaces that no longer take or return PassRefPtrs. Update adoptRef(T*) to return a RefPtr instead of a PassRefPtr and move it to RefPtr.h from PassRefPtr.h. * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocate): * wtf/MetaAllocator.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/text/AtomicStringImpl.cpp: (WTF::HashAndUTF8CharactersTranslator::translate): (WTF::SubstringTranslator::translate): * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString): (WTF::StringBuilder::resize): (WTF::StringBuilder::reallocateBuffer<LChar>): (WTF::StringBuilder::reallocateBuffer<UChar>): * wtf/text/StringImpl.cpp: (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::reallocate): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSymbol): (WTF::StringImpl::createNullSymbol): (WTF::StringImpl::convertToLowercaseWithoutLocale): (WTF::StringImpl::convertToUppercaseWithoutLocale): (WTF::StringImpl::convertToLowercaseWithLocale): (WTF::StringImpl::convertToUppercaseWithLocale): (WTF::StringImpl::convertASCIICase): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::extractFoldedStringInSymbol): * wtf/text/SymbolRegistry.cpp: (WTF::SymbolRegistry::symbolForKey): * wtf/text/WTFString.cpp: (WTF::String::substringSharingImpl): * wtf/text/WTFString.h: (WTF::String::String): Deleted. * wtf/text/cf/StringImplCF.cpp: Tools: Update calls to interfaces that no longer take or return PassRefPtrs. * TestWebKitAPI/Tests/WTF/StringImpl.cpp: (TestWebKitAPI::stringFromUTF8): (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/176568@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-08 01:31:17 +00:00
static Ref<ThreadPrivate> create()
2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
{
Remove all uses of PassRefPtr in WTF https://bugs.webkit.org/show_bug.cgi?id=157596 <rdar://problem/26234391> Reviewed by Chris Dumez. Source/JavaScriptCore: Update calls to interfaces that no longer take or return PassRefPtrs. * runtime/JSString.cpp: (JSC::JSRopeString::resolveRope): * runtime/JSString.h: (JSC::JSString::JSString): (JSC::jsSubstring): * runtime/PrivateName.h: (JSC::PrivateName::PrivateName): * runtime/SmallStrings.cpp: (JSC::SmallStringsStorage::SmallStringsStorage): * runtime/StringConstructor.cpp: (JSC::stringFromCharCodeSlowCase): * runtime/StringPrototype.cpp: (JSC::jsSpliceSubstrings): (JSC::jsSpliceSubstringsWithSeparators): (JSC::replaceUsingStringSearch): (JSC::repeatCharacter): (JSC::stringProtoFuncFontsize): (JSC::stringProtoFuncLink): (JSC::normalize): Source/WebCore: Update calls to interfaces that no longer take or return PassRefPtrs. No new tests: no new functionality so changes are covered by existing tests. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::formatNumberValue): * dom/Document.cpp: (WebCore::Document::displayStringModifiedByEncoding): * xml/XPathGrammar.y: Source/WTF: Remove/update most interfaces that take or return PassRefPtrs. Remaining references include those in non-Cocoa implementations and those required for continued compatibility with modules that still use PassRefPtrs (specifically: Forward.h, RefPtr interoperability, SizeLimits.h, WorkQueue (Windows) DispatchQueueEfl, DispatchWorkItemEfl, and PassRefPtr itself). Update calls to interfaces that no longer take or return PassRefPtrs. Update adoptRef(T*) to return a RefPtr instead of a PassRefPtr and move it to RefPtr.h from PassRefPtr.h. * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocate): * wtf/MetaAllocator.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/text/AtomicStringImpl.cpp: (WTF::HashAndUTF8CharactersTranslator::translate): (WTF::SubstringTranslator::translate): * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString): (WTF::StringBuilder::resize): (WTF::StringBuilder::reallocateBuffer<LChar>): (WTF::StringBuilder::reallocateBuffer<UChar>): * wtf/text/StringImpl.cpp: (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::reallocate): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSymbol): (WTF::StringImpl::createNullSymbol): (WTF::StringImpl::convertToLowercaseWithoutLocale): (WTF::StringImpl::convertToUppercaseWithoutLocale): (WTF::StringImpl::convertToLowercaseWithLocale): (WTF::StringImpl::convertToUppercaseWithLocale): (WTF::StringImpl::convertASCIICase): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::extractFoldedStringInSymbol): * wtf/text/SymbolRegistry.cpp: (WTF::SymbolRegistry::symbolForKey): * wtf/text/WTFString.cpp: (WTF::String::substringSharingImpl): * wtf/text/WTFString.h: (WTF::String::String): Deleted. * wtf/text/cf/StringImplCF.cpp: Tools: Update calls to interfaces that no longer take or return PassRefPtrs. * TestWebKitAPI/Tests/WTF/StringImpl.cpp: (TestWebKitAPI::stringFromUTF8): (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/176568@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-08 01:31:17 +00:00
return adoptRef(*new ThreadPrivate());
2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
}
private:
Drop CheckedLock / CheckedCondition aliases https://bugs.webkit.org/show_bug.cgi?id=226176 Reviewed by Kate Cheney. Drop CheckedLock / CheckedCondition aliases now that they are the default. Source/JavaScriptCore: * API/JSVirtualMachine.mm: * API/glib/JSCVirtualMachine.cpp: * assembler/PerfLog.h: * assembler/testmasm.cpp: * bytecode/StructureStubInfo.h: * bytecode/SuperSampler.cpp: * dfg/DFGCommon.cpp: * dfg/DFGCommonData.cpp: * dfg/DFGPlan.h: * dfg/DFGThreadData.h: * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::Worklist): * dfg/DFGWorklist.h: * disassembler/Disassembler.cpp: * dynbench.cpp: * heap/BlockDirectory.cpp: (JSC::BlockDirectory::parallelNotEmptyBlockSource): * heap/BlockDirectory.h: (JSC::BlockDirectory::bitvectorLock): * heap/CodeBlockSet.h: (JSC::CodeBlockSet::getLock): * heap/Heap.cpp: (JSC::Heap::Heap): * heap/Heap.h: * heap/IsoSubspacePerVM.h: * heap/MarkedSpace.h: (JSC::MarkedSpace::directoryLock): * heap/MarkingConstraintSolver.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::donateKnownParallel): * heap/SlotVisitor.h: * inspector/remote/socket/RemoteInspectorConnectionClient.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::getLock const): (JSC::dumpJITMemory): * jit/ExecutableAllocator.h: (JSC::ExecutableAllocatorBase::getLock const): * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): * jit/JITWorklist.h: * jsc.cpp: * profiler/ProfilerDatabase.h: * runtime/ConcurrentJSLock.h: * runtime/DeferredWorkTimer.h: * runtime/JSLock.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::CFrameWalker::CFrameWalker): (JSC::SamplingProfiler::takeSample): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::getLock): * runtime/VM.h: * runtime/VMTraps.cpp: (JSC::VMTraps::invalidateCodeBlocksOnStack): (JSC::VMTraps::VMTraps): * runtime/VMTraps.h: * tools/FunctionOverrides.h: * tools/VMInspector.cpp: (JSC::ensureIsSafeToLock): * tools/VMInspector.h: (JSC::VMInspector::getLock): * wasm/WasmCalleeRegistry.h: (JSC::Wasm::CalleeRegistry::getLock): * wasm/WasmPlan.h: * wasm/WasmStreamingCompiler.h: * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::Worklist): * wasm/WasmWorklist.h: Source/WebCore: * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/server/IDBSerializationContext.cpp: * Modules/indexeddb/server/IDBServer.cpp: * Modules/mediastream/RTCDataChannel.cpp: * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * Modules/speech/SpeechRecognitionCaptureSourceImpl.h: * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/MediaElementAudioSourceNode.h: * Modules/webdatabase/Database.cpp: * Modules/webdatabase/Database.h: * Modules/webdatabase/DatabaseManager.h: * Modules/webdatabase/DatabaseTask.h: * Modules/webdatabase/DatabaseThread.h: * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::openDatabaseMutex): * Modules/webdatabase/DatabaseTracker.h: * Modules/webdatabase/OriginLock.cpp: * Modules/webdatabase/SQLCallbackWrapper.h: * Modules/webdatabase/SQLTransaction.h: * Modules/webgpu/WebGPUDevice.cpp: (WebCore::WebGPUDevice::instancesLock): * Modules/webgpu/WebGPUDevice.h: * Modules/webgpu/WebGPUPipeline.cpp: (WebCore::WebGPUPipeline::instancesLock): * Modules/webgpu/WebGPUPipeline.h: * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::allActiveWebSocketsLock): * Modules/websockets/WebSocket.h: * accessibility/isolatedtree/AXIsolatedTree.cpp: * accessibility/isolatedtree/AXIsolatedTree.h: * bindings/js/JSDOMGlobalObject.h: * bridge/objc/WebScriptObject.mm: * crypto/CryptoAlgorithmRegistry.h: * dom/MessagePort.cpp: * dom/Node.cpp: * dom/ScriptExecutionContext.cpp: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::createMediaPlayer): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::instancesLock): * html/canvas/CanvasRenderingContext.h: * html/canvas/WebGLContextGroup.cpp: (WebCore::WebGLContextGroup::objectGraphLockForAContext): * html/canvas/WebGLContextGroup.h: * html/canvas/WebGLContextObject.cpp: (WebCore::WebGLContextObject::objectGraphLockForContext): * html/canvas/WebGLContextObject.h: * html/canvas/WebGLObject.h: * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::instancesLock): * html/canvas/WebGLProgram.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::objectGraphLock): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLSharedObject.cpp: (WebCore::WebGLSharedObject::objectGraphLockForContext): * html/canvas/WebGLSharedObject.h: * inspector/agents/WebHeapAgent.cpp: * page/ResourceUsageThread.h: * page/SecurityPolicy.cpp: * page/WheelEventTestMonitor.h: * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::WTF_RETURNS_LOCK): * page/scrolling/ScrollingTreeLatchingController.h: * page/scrolling/ThreadedScrollingTree.h: (WebCore::ThreadedScrollingTree::WTF_RETURNS_LOCK): * page/scrolling/mac/ScrollingTreeMac.h: * platform/AbortableTaskQueue.h: * platform/GenericTaskQueue.cpp: * platform/GenericTaskQueue.h: * platform/LegacySchemeRegistry.cpp: * platform/audio/AudioDestination.h: * platform/audio/HRTFDatabaseLoader.h: * platform/audio/ReverbConvolver.cpp: (WebCore::ReverbConvolver::backgroundThreadEntry): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/audio/gstreamer/AudioSourceProviderGStreamer.h: * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: * platform/audio/mac/FFTFrameMac.cpp: * platform/encryptedmedia/CDMProxy.h: * platform/graphics/MediaPlayer.cpp: * platform/graphics/ShadowBlur.cpp: (WebCore::ScratchBuffer::lock): (WebCore::ShadowBlur::drawRectShadowWithTiling): (WebCore::ShadowBlur::drawInsetShadowWithTiling): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: * platform/graphics/cg/IOSurfacePool.h: * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: * platform/graphics/gstreamer/ImageDecoderGStreamer.h: * platform/graphics/gstreamer/MainThreadNotifier.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: (WebCore::TextureMapperPlatformLayerProxy::WTF_RETURNS_LOCK): * platform/image-decoders/ScalableImageDecoder.h: * platform/ios/QuickLook.mm: * platform/ios/WebSQLiteDatabaseTrackerClient.mm: * platform/ios/wak/WebCoreThreadRun.cpp: * platform/mediarecorder/MediaRecorderPrivateMock.h: * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h: * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: * platform/network/cf/LoaderRunLoopCF.cpp: (WebCore::loaderRunLoop): * platform/network/cocoa/WebCoreNSURLSession.mm: * platform/network/mac/UTIUtilities.mm: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/sql/SQLiteDatabase.cpp: * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteDatabaseTracker.cpp: * platform/text/TextEncodingRegistry.cpp: * storage/StorageQuotaManager.h: * workers/WorkerGlobalScope.cpp: * workers/WorkerOrWorkletScriptController.h: * workers/WorkerOrWorkletThread.cpp: (WebCore::WorkerOrWorkletThread::workerOrWorkletThreadsLock): * workers/WorkerOrWorkletThread.h: * worklets/PaintWorkletGlobalScope.h: Source/WebKit: * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer): * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: * NetworkProcess/NetworkProcess.h: * NetworkProcess/WebStorage/StorageManagerSet.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: * NetworkProcess/glib/DNSCache.h: * Platform/IPC/Connection.cpp: * Platform/IPC/Connection.h: * Platform/IPC/StreamConnectionWorkQueue.h: * Platform/IPC/StreamServerConnection.h: * Shared/BlockingResponseMap.h: * Shared/Cocoa/XPCEndpointClient.h: * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h: * Shared/mac/MediaFormatReader/MediaFormatReader.h: * Shared/mac/MediaFormatReader/MediaSampleCursor.h: * Shared/mac/MediaFormatReader/MediaTrackReader.h: * UIProcess/API/glib/IconDatabase.h: * UIProcess/WebURLSchemeTask.h: * UIProcess/mac/DisplayLink.h: * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView knowsPageRange:]): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/Network/WebSocketStream.cpp: * WebProcess/Plugins/PluginProcessConnectionManager.h: * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/ViewUpdateDispatcher.h: Source/WebKitLegacy: * Storage/StorageAreaSync.h: Source/WebKitLegacy/mac: * DOM/DOMInternal.mm: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/Assertions.cpp: * wtf/AutomaticThread.cpp: (WTF::AutomaticThreadCondition::wait): (WTF::AutomaticThreadCondition::waitFor): (WTF::AutomaticThread::AutomaticThread): * wtf/AutomaticThread.h: * wtf/CMakeLists.txt: * wtf/CheckedCondition.h: Removed. * wtf/CheckedLock.h: Removed. * wtf/Condition.h: * wtf/CrossThreadQueue.h: * wtf/CrossThreadTaskHandler.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: * wtf/Forward.h: * wtf/Language.cpp: * wtf/Lock.cpp: (WTF::UncheckedLock::lockSlow): (WTF::UncheckedLock::unlockSlow): (WTF::UncheckedLock::unlockFairlySlow): (WTF::UncheckedLock::safepointSlow): * wtf/Lock.h: (WTF::WTF_ASSERTS_ACQUIRED_LOCK): * wtf/Logger.cpp: * wtf/Logger.h: (WTF::Logger::WTF_RETURNS_LOCK): * wtf/MessageQueue.h: * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::release): (WTF::MetaAllocator::MetaAllocator): (WTF::MetaAllocator::allocate): (WTF::MetaAllocator::currentStatistics): * wtf/MetaAllocator.h: * wtf/OSLogPrintStream.h: * wtf/ParallelHelperPool.cpp: (WTF::ParallelHelperPool::ParallelHelperPool): * wtf/ParallelHelperPool.h: * wtf/ParallelJobsGeneric.h: * wtf/ParallelVectorIterator.h: * wtf/ReadWriteLock.h: * wtf/RecursiveLockAdapter.h: * wtf/RunLoop.h: * wtf/SynchronizedFixedQueue.h: * wtf/Threading.cpp: (WTF::Thread::allThreadsLock): * wtf/Threading.h: * wtf/TimingScope.cpp: * wtf/URL.cpp: * wtf/WTFSemaphore.h: * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): * wtf/WorkerPool.cpp: (WTF::WorkerPool::WorkerPool): * wtf/WorkerPool.h: * wtf/cf/LanguageCF.cpp: * wtf/text/AtomStringImpl.cpp: (WTF::AtomStringTableLocker::AtomStringTableLocker): * wtf/text/StringView.cpp: * wtf/threads/BinarySemaphore.h: * wtf/unicode/icu/CollatorICU.cpp: Tools: * TestWebKitAPI/CMakeLists.txt: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp: Removed. * TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp: Removed. * TestWebKitAPI/Tests/WTF/Condition.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WTF/Lock.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WTF/MetaAllocator.cpp: * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AXThread::createThreadIfNeeded): Canonical link: https://commits.webkit.org/238085@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-24 18:29:01 +00:00
mutable Lock m_lock;
Condition m_threadCondition;
Use CheckedLock more in WTF https://bugs.webkit.org/show_bug.cgi?id=226045 Reviewed by Darin Adler. Use CheckedLock more in WTF to benefit from Clang Thread Safety Analysis. * wtf/CrossThreadQueue.h: (WTF::CrossThreadQueue<DataType>::append): (WTF::CrossThreadQueue<DataType>::waitForMessage): (WTF::CrossThreadQueue<DataType>::tryGetMessage): (WTF::CrossThreadQueue<DataType>::kill): (WTF::CrossThreadQueue<DataType>::isKilled const): (WTF::CrossThreadQueue<DataType>::isEmpty const): * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::postTaskReply): (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread): * wtf/CrossThreadTaskHandler.h: (WTF::CrossThreadTaskHandler::WTF_GUARDED_BY_LOCK): * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/MessageQueue.h: (WTF::MessageQueue<DataType>::append): (WTF::MessageQueue<DataType>::appendAndKill): (WTF::MessageQueue<DataType>::appendAndCheckEmpty): (WTF::MessageQueue<DataType>::prepend): (WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout): (WTF::MessageQueue<DataType>::tryGetMessage): (WTF::MessageQueue<DataType>::takeAllMessages): (WTF::MessageQueue<DataType>::tryGetMessageIgnoringKilled): (WTF::MessageQueue<DataType>::removeIf): (WTF::MessageQueue<DataType>::isEmpty): (WTF::MessageQueue<DataType>::kill): (WTF::MessageQueue<DataType>::killed const): * wtf/OSLogPrintStream.cpp: (WTF::OSLogPrintStream::vprintf): * wtf/OSLogPrintStream.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::WTF_GUARDED_BY_LOCK): * wtf/ParallelVectorIterator.h: (WTF::ParallelVectorIterator::iterate): (WTF::ParallelVectorIterator::WTF_GUARDED_BY_LOCK): * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-21 02:43:18 +00:00
[WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one https://bugs.webkit.org/show_bug.cgi?id=170502 Reviewed by Mark Lam. Source/JavaScriptCore: * API/tests/CompareAndSwapTest.cpp: (testCompareAndSwap): * JavaScriptCore.xcodeproj/project.pbxproj: * b3/air/testair.cpp: * b3/testb3.cpp: (JSC::B3::run): * bytecode/SuperSampler.cpp: (JSC::initializeSuperSampler): * dfg/DFGWorklist.cpp: * disassembler/Disassembler.cpp: * heap/Heap.cpp: (JSC::Heap::lastChanceToFinalize): (JSC::Heap::notifyIsSafeToCollect): * heap/Heap.h: * heap/MachineStackMarker.cpp: (JSC::MachineThreads::~MachineThreads): (JSC::MachineThreads::addCurrentThread): (JSC::MachineThreads::removeThread): (JSC::MachineThreads::removeThreadIfFound): (JSC::MachineThreads::MachineThread::MachineThread): (JSC::MachineThreads::MachineThread::getRegisters): (JSC::MachineThreads::MachineThread::Registers::stackPointer): (JSC::MachineThreads::MachineThread::Registers::framePointer): (JSC::MachineThreads::MachineThread::Registers::instructionPointer): (JSC::MachineThreads::MachineThread::Registers::llintPC): (JSC::MachineThreads::MachineThread::captureStack): (JSC::MachineThreads::tryCopyOtherThreadStack): (JSC::MachineThreads::tryCopyOtherThreadStacks): (pthreadSignalHandlerSuspendResume): Deleted. (JSC::threadData): Deleted. (JSC::MachineThreads::Thread::Thread): Deleted. (JSC::MachineThreads::Thread::createForCurrentThread): Deleted. (JSC::MachineThreads::Thread::operator==): Deleted. (JSC::MachineThreads::machineThreadForCurrentThread): Deleted. (JSC::MachineThreads::ThreadData::ThreadData): Deleted. (JSC::MachineThreads::ThreadData::~ThreadData): Deleted. (JSC::MachineThreads::ThreadData::suspend): Deleted. (JSC::MachineThreads::ThreadData::resume): Deleted. (JSC::MachineThreads::ThreadData::getRegisters): Deleted. (JSC::MachineThreads::ThreadData::Registers::stackPointer): Deleted. (JSC::MachineThreads::ThreadData::Registers::framePointer): Deleted. (JSC::MachineThreads::ThreadData::Registers::instructionPointer): Deleted. (JSC::MachineThreads::ThreadData::Registers::llintPC): Deleted. (JSC::MachineThreads::ThreadData::freeRegisters): Deleted. (JSC::MachineThreads::ThreadData::captureStack): Deleted. * heap/MachineStackMarker.h: (JSC::MachineThreads::MachineThread::suspend): (JSC::MachineThreads::MachineThread::resume): (JSC::MachineThreads::MachineThread::threadID): (JSC::MachineThreads::MachineThread::stackBase): (JSC::MachineThreads::MachineThread::stackEnd): (JSC::MachineThreads::threadsListHead): (JSC::MachineThreads::Thread::operator!=): Deleted. (JSC::MachineThreads::Thread::suspend): Deleted. (JSC::MachineThreads::Thread::resume): Deleted. (JSC::MachineThreads::Thread::getRegisters): Deleted. (JSC::MachineThreads::Thread::freeRegisters): Deleted. (JSC::MachineThreads::Thread::captureStack): Deleted. (JSC::MachineThreads::Thread::platformThread): Deleted. (JSC::MachineThreads::Thread::stackBase): Deleted. (JSC::MachineThreads::Thread::stackEnd): Deleted. * jit/ICStats.cpp: (JSC::ICStats::ICStats): (JSC::ICStats::~ICStats): * jit/ICStats.h: * jsc.cpp: (functionDollarAgentStart): (startTimeoutThreadIfNeeded): * runtime/JSLock.cpp: (JSC::JSLock::lock): * runtime/JSLock.h: (JSC::JSLock::ownerThread): (JSC::JSLock::currentThreadIsHoldingLock): * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::isValidFramePointer): (JSC::SamplingProfiler::SamplingProfiler): (JSC::SamplingProfiler::createThreadIfNecessary): (JSC::SamplingProfiler::takeSample): * runtime/SamplingProfiler.h: * runtime/VM.h: (JSC::VM::ownerThread): * runtime/VMTraps.cpp: (JSC::findActiveVMAndStackBounds): (JSC::VMTraps::SignalSender::send): (JSC::VMTraps::fireTrap): Source/WebCore: Mechanical change. Use Thread:: APIs. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::IDBServer): * Modules/indexeddb/server/IDBServer.h: * Modules/webaudio/AsyncAudioDecoder.cpp: (WebCore::AsyncAudioDecoder::AsyncAudioDecoder): (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder): (WebCore::AsyncAudioDecoder::runLoop): * Modules/webaudio/AsyncAudioDecoder.h: * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode): (WebCore::OfflineAudioDestinationNode::uninitialize): (WebCore::OfflineAudioDestinationNode::startRendering): * Modules/webaudio/OfflineAudioDestinationNode.h: * Modules/webdatabase/Database.cpp: (WebCore::Database::securityOrigin): * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::start): (WebCore::DatabaseThread::databaseThread): (WebCore::DatabaseThread::recordDatabaseOpen): (WebCore::DatabaseThread::recordDatabaseClosed): * Modules/webdatabase/DatabaseThread.h: (WebCore::DatabaseThread::getThreadID): * bindings/js/GCController.cpp: (WebCore::GCController::garbageCollectOnAlternateThreadForDebugging): * fileapi/AsyncFileStream.cpp: (WebCore::callOnFileThread): * loader/icon/IconDatabase.cpp: (WebCore::IconDatabase::open): (WebCore::IconDatabase::close): * loader/icon/IconDatabase.h: * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::createThreadIfNeeded): * page/ResourceUsageThread.h: * page/scrolling/ScrollingThread.cpp: (WebCore::ScrollingThread::ScrollingThread): (WebCore::ScrollingThread::isCurrentThread): (WebCore::ScrollingThread::createThreadIfNeeded): (WebCore::ScrollingThread::threadCallback): * page/scrolling/ScrollingThread.h: * platform/audio/HRTFDatabaseLoader.cpp: (WebCore::HRTFDatabaseLoader::HRTFDatabaseLoader): (WebCore::HRTFDatabaseLoader::loadAsynchronously): (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): * platform/audio/HRTFDatabaseLoader.h: * platform/audio/ReverbConvolver.cpp: (WebCore::ReverbConvolver::ReverbConvolver): (WebCore::ReverbConvolver::~ReverbConvolver): * platform/audio/ReverbConvolver.h: * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp: (WebCore::createBusFromAudioFile): (WebCore::createBusFromInMemoryAudioFile): * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (ResourceHandleStreamingClient::ResourceHandleStreamingClient): (ResourceHandleStreamingClient::~ResourceHandleStreamingClient): * platform/network/cf/LoaderRunLoopCF.cpp: (WebCore::loaderRunLoop): * platform/network/curl/CurlDownload.cpp: (WebCore::CurlDownloadManager::startThreadIfNeeded): (WebCore::CurlDownloadManager::stopThread): * platform/network/curl/CurlDownload.h: * platform/network/curl/SocketStreamHandleImpl.h: * platform/network/curl/SocketStreamHandleImplCurl.cpp: (WebCore::SocketStreamHandleImpl::startThread): (WebCore::SocketStreamHandleImpl::stopThread): * workers/WorkerThread.cpp: (WebCore::WorkerThread::WorkerThread): (WebCore::WorkerThread::start): (WebCore::WorkerThread::workerThread): * workers/WorkerThread.h: (WebCore::WorkerThread::threadID): Source/WebKit: Mechanical change. Use Thread:: APIs. * Storage/StorageThread.cpp: (WebCore::StorageThread::StorageThread): (WebCore::StorageThread::~StorageThread): (WebCore::StorageThread::start): (WebCore::StorageThread::dispatch): (WebCore::StorageThread::terminate): * Storage/StorageThread.h: Source/WebKit2: Mechanical change. Use Thread:: APIs. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp: (WebKit::NetworkCache::IOChannel::readSyncInThread): * Platform/IPC/Connection.cpp: (IPC::Connection::processIncomingMessage): * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::MemoryPressureMonitor::MemoryPressureMonitor): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): Source/WTF: This patch is refactoring of WTF Threading mechanism to merge JavaScriptCore's threading extension to WTF Threading. Previously, JavaScriptCore requires richer threading features (such as suspending and resuming threads), and they are implemented for PlatformThread in JavaScriptCore. But these features should be implemented in WTF Threading side instead of maintaining JSC's own threading features too. This patch removes these features from JSC and move it to WTF Threading. However, current WTF Threading has one problem: Windows version of WTF Threading has different semantics from Pthreads one. In Windows WTF Threading, we cannot perform any operation after the target thread is detached: WTF Threading stop tracking the state of the thread once the thread is detached. But this is not the same to Pthreads one. In Pthreads, pthread_detach just means that the resource of the thread will be destroyed automatically. While some operations like pthread_join will be rejected, some operations like pthread_kill will be accepted. The problem is that detached thread can be suspended and resumed in JSC. For example, in jsc.cpp, we start the worker thread and detach it immediately. In worker thread, we will create VM and thus concurrent GC will suspend and resume the detached thread. However, in Windows WTF Threading, we have no reference to the detached thread. Thus we cannot perform suspend and resume operations onto the detached thread. To solve the problem, we change Windows Threading mechanism drastically to align it to the Pthread semantics. In the new Threading, we have RefPtr<Thread> class. It holds a handle to a platform thread. We can perform threading operations with this class. For example, Thread::suspend is offered. And we use destructor of the thread local variable to release the resources held by RefPtr<Thread>. In Windows, Thread::detach does nothing because the resource will be destroyed automatically by RefPtr<Thread>. To do so, we introduce ThreadHolder for Windows. This is similar to the previous ThreadIdentifierData for Pthreads. It holds RefPtr<Thread> in the thread local storage (technically, it is Fiber Local Storage in Windows). Thread::current() will return this reference. The problematic situation is that the order of the deallocation of the thread local storage is not defined. So we should not touch thread local storage in the destructor of the thread local storage. To avoid such edge cases, we have currentThread() / Thread::currentID() APIs. They are safe to be called even in the destructor of the other thread local storage. And in Windows, in the FLS destructor, we will create the thread_local variable to defer the destruction of the ThreadHolder. We ensure that this destructor is called after the other FLS destructors are called in Windows 10. This patch is performance neutral. * WTF.xcodeproj/project.pbxproj: * benchmarks/ConditionSpeedTest.cpp: * benchmarks/LockFairnessTest.cpp: * benchmarks/LockSpeedTest.cpp: * wtf/AutomaticThread.cpp: (WTF::AutomaticThread::start): * wtf/CMakeLists.txt: * wtf/MainThread.h: * wtf/MemoryPressureHandler.h: * wtf/ParallelJobsGeneric.cpp: (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): Deleted. * wtf/ParkingLot.cpp: (WTF::ParkingLot::forEachImpl): * wtf/ParkingLot.h: (WTF::ParkingLot::forEach): * wtf/PlatformRegisters.h: Renamed from Source/JavaScriptCore/runtime/PlatformThread.h. * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): * wtf/ThreadFunctionInvocation.h: (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation): * wtf/ThreadHolder.cpp: Added. (WTF::ThreadHolder::~ThreadHolder): (WTF::ThreadHolder::initialize): * wtf/ThreadHolder.h: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.h. (WTF::ThreadHolder::thread): (WTF::ThreadHolder::ThreadHolder): * wtf/ThreadHolderPthreads.cpp: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp. (WTF::ThreadHolder::initializeOnce): (WTF::ThreadHolder::current): (WTF::ThreadHolder::destruct): * wtf/ThreadHolderWin.cpp: Added. (WTF::threadMapMutex): (WTF::threadMap): (WTF::ThreadHolder::initializeOnce): (WTF::ThreadHolder::current): (WTF::ThreadHolder::destruct): * wtf/ThreadSpecific.h: * wtf/Threading.cpp: (WTF::Thread::normalizeThreadName): (WTF::threadEntryPoint): (WTF::Thread::create): (WTF::Thread::setCurrentThreadIsUserInteractive): (WTF::Thread::setCurrentThreadIsUserInitiated): (WTF::Thread::setGlobalMaxQOSClass): (WTF::Thread::adjustedQOSClass): (WTF::Thread::dump): (WTF::initializeThreading): (WTF::normalizeThreadName): Deleted. (WTF::createThread): Deleted. (WTF::setCurrentThreadIsUserInteractive): Deleted. (WTF::setCurrentThreadIsUserInitiated): Deleted. (WTF::setGlobalMaxQOSClass): Deleted. (WTF::adjustedQOSClass): Deleted. * wtf/Threading.h: (WTF::Thread::id): (WTF::Thread::operator==): (WTF::Thread::operator!=): (WTF::Thread::joinableState): (WTF::Thread::didBecomeDetached): (WTF::Thread::didJoin): (WTF::Thread::hasExited): (WTF::currentThread): * wtf/ThreadingPthreads.cpp: (WTF::Thread::Thread): (WTF::Thread::~Thread): (WTF::Thread::signalHandlerSuspendResume): (WTF::Thread::initializePlatformThreading): (WTF::initializeCurrentThreadEvenIfNonWTFCreated): (WTF::wtfThreadEntryPoint): (WTF::Thread::createInternal): (WTF::Thread::initializeCurrentThreadInternal): (WTF::Thread::changePriority): (WTF::Thread::waitForCompletion): (WTF::Thread::detach): (WTF::Thread::current): (WTF::Thread::currentID): (WTF::Thread::signal): (WTF::Thread::resume): (WTF::Thread::getRegisters): (WTF::Thread::didExit): (WTF::Thread::establish): (WTF::PthreadState::PthreadState): Deleted. (WTF::PthreadState::joinableState): Deleted. (WTF::PthreadState::pthreadHandle): Deleted. (WTF::PthreadState::didBecomeDetached): Deleted. (WTF::PthreadState::didExit): Deleted. (WTF::PthreadState::didJoin): Deleted. (WTF::PthreadState::hasExited): Deleted. (WTF::threadMapMutex): Deleted. (WTF::initializeThreading): Deleted. (WTF::threadMap): Deleted. (WTF::identifierByPthreadHandle): Deleted. (WTF::establishIdentifierForPthreadHandle): Deleted. (WTF::pthreadHandleForIdentifierWithLockAlreadyHeld): Deleted. (WTF::createThreadInternal): Deleted. (WTF::initializeCurrentThreadInternal): Deleted. (WTF::changeThreadPriority): Deleted. (WTF::waitForThreadCompletion): Deleted. (WTF::detachThread): Deleted. (WTF::threadDidExit): Deleted. (WTF::currentThread): Deleted. (WTF::signalThread): Deleted. * wtf/ThreadingWin.cpp: (WTF::Thread::Thread): (WTF::Thread::~Thread): (WTF::Thread::initializeCurrentThreadInternal): (WTF::Thread::initializePlatformThreading): (WTF::wtfThreadEntryPoint): (WTF::Thread::createInternal): (WTF::Thread::changePriority): (WTF::Thread::waitForCompletion): (WTF::Thread::detach): (WTF::Thread::resume): (WTF::Thread::getRegisters): (WTF::Thread::current): (WTF::Thread::currentID): (WTF::Thread::didExit): (WTF::Thread::establish): (WTF::initializeCurrentThreadInternal): Deleted. (WTF::threadMapMutex): Deleted. (WTF::initializeThreading): Deleted. (WTF::threadMap): Deleted. (WTF::storeThreadHandleByIdentifier): Deleted. (WTF::threadHandleForIdentifier): Deleted. (WTF::clearThreadHandleForIdentifier): Deleted. (WTF::createThreadInternal): Deleted. (WTF::changeThreadPriority): Deleted. (WTF::waitForThreadCompletion): Deleted. (WTF::detachThread): Deleted. (WTF::currentThread): Deleted. * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): * wtf/WorkQueue.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::dispatchQOSClass): * wtf/generic/WorkQueueGeneric.cpp: (WorkQueue::platformInitialize): (WorkQueue::platformInvalidate): * wtf/linux/MemoryPressureHandlerLinux.cpp: (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller): (WTF::MemoryPressureHandler::EventFDPoller::~EventFDPoller): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): Tools: Mechanical change. Use Thread:: APIs. * DumpRenderTree/JavaScriptThreading.cpp: (runJavaScriptThread): (startJavaScriptThreads): (stopJavaScriptThreads): * DumpRenderTree/mac/DumpRenderTree.mm: (testThreadIdentifierMap): * TestWebKitAPI/Tests/WTF/Condition.cpp: * TestWebKitAPI/Tests/WTF/Lock.cpp: (TestWebKitAPI::runLockTest): * TestWebKitAPI/Tests/WTF/ParkingLot.cpp: Canonical link: https://commits.webkit.org/187690@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-12 12:08:29 +00:00
RefPtr<Thread> m_thread;
bool m_running { false };
Use CheckedLock more in WTF https://bugs.webkit.org/show_bug.cgi?id=226045 Reviewed by Darin Adler. Use CheckedLock more in WTF to benefit from Clang Thread Safety Analysis. * wtf/CrossThreadQueue.h: (WTF::CrossThreadQueue<DataType>::append): (WTF::CrossThreadQueue<DataType>::waitForMessage): (WTF::CrossThreadQueue<DataType>::tryGetMessage): (WTF::CrossThreadQueue<DataType>::kill): (WTF::CrossThreadQueue<DataType>::isKilled const): (WTF::CrossThreadQueue<DataType>::isEmpty const): * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::postTaskReply): (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread): * wtf/CrossThreadTaskHandler.h: (WTF::CrossThreadTaskHandler::WTF_GUARDED_BY_LOCK): * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.cpp: (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/MessageQueue.h: (WTF::MessageQueue<DataType>::append): (WTF::MessageQueue<DataType>::appendAndKill): (WTF::MessageQueue<DataType>::appendAndCheckEmpty): (WTF::MessageQueue<DataType>::prepend): (WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout): (WTF::MessageQueue<DataType>::tryGetMessage): (WTF::MessageQueue<DataType>::takeAllMessages): (WTF::MessageQueue<DataType>::tryGetMessageIgnoringKilled): (WTF::MessageQueue<DataType>::removeIf): (WTF::MessageQueue<DataType>::isEmpty): (WTF::MessageQueue<DataType>::kill): (WTF::MessageQueue<DataType>::killed const): * wtf/OSLogPrintStream.cpp: (WTF::OSLogPrintStream::vprintf): * wtf/OSLogPrintStream.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::WTF_GUARDED_BY_LOCK): * wtf/ParallelVectorIterator.h: (WTF::ParallelVectorIterator::iterate): (WTF::ParallelVectorIterator::WTF_GUARDED_BY_LOCK): * wtf/ReadWriteLock.cpp: (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::readUnlock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::writeUnlock): * wtf/ReadWriteLock.h: (WTF::ReadWriteLock::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-21 02:43:18 +00:00
ParallelEnvironment* m_parent WTF_GUARDED_BY_LOCK(m_lock) { nullptr };
2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
ThreadFunction m_threadFunction { nullptr };
void* m_parameters { nullptr };
2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * GNUmakefile.list.am: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelJobs.h: Added. (WTF::ParallelJobs::ParallelJobs): (WTF::ParallelJobs::numberOfJobs): (WTF::ParallelJobs::parameterForJob): (WTF::ParallelJobs::executeJobs): * wtf/ParallelJobsGeneric.cpp: Added. (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): (WTF::ParallelEnvironment::ThreadPrivate::executeJob): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/ParallelJobsLibdispatch.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/ParallelJobsOpenMP.h: Added. (WTF::ParallelEnvironment::ParallelEnvironment): (WTF::ParallelEnvironment::numberOfJobs): (WTF::ParallelEnvironment::parameterForJob): (WTF::ParallelEnvironment::executeJobs): * wtf/Platform.h: * wtf/wtf.pri: 2011-04-26 Gabor Loki <loki@webkit.org> Reviewed by Csaba Osztrogonác. Speeding up SVG filters with multicore (SMP) support https://bugs.webkit.org/show_bug.cgi?id=43903 Some SVG filters execute a huge number of pixel manipulations, which cannot be sped up by graphics accelerators, since their algorithm is too complex. Using the power of Symmetric Multi Processing (SMP) we can split up a task to smaller (data independent) tasks, which can be executed independently. The ParallelJobs framework provides a simple way for distributed programming. The framework is based on WebKit's threading infrastructure, Open Multi-Processing's (OpenMP) API, and libdispatch API. * ForwardingHeaders/wtf/ParallelJobs.h: Added. * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::PaintingData::PaintingData): (WebCore::FETurbulence::noise2D): (WebCore::FETurbulence::calculateTurbulenceValueForPoint): (WebCore::FETurbulence::fillRegion): (WebCore::FETurbulence::fillRegionWorker): (WebCore::FETurbulence::apply): * platform/graphics/filters/FETurbulence.h: Canonical link: https://commits.webkit.org/74633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 14:40:47 +00:00
};
private:
ThreadFunction m_threadFunction;
size_t m_sizeOfParameter;
int m_numberOfJobs;
Vector< RefPtr<ThreadPrivate> > m_threads;
static Vector< RefPtr<ThreadPrivate> >* s_threadPool;
};
} // namespace WTF
#endif // ENABLE(THREADING_GENERIC)
#endif // ParallelJobsGeneric_h