[webkit-changes] [WebKit/WebKit] f3ef9e: Make SerialFunctionDispatcher thread safe ref counted

youennf noreply at github.com
Fri Oct 18 08:14:44 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3ef9e43f27eb87ffa2ad70f6ededaa2f021ddc6
      https://github.com/WebKit/WebKit/commit/f3ef9e43f27eb87ffa2ad70f6ededaa2f021ddc6
  Author: Youenn Fablet <youenn at apple.com>
  Date:   2024-10-18 (Fri, 18 Oct 2024)

  Changed paths:
    M Source/WTF/wtf/Forward.h
    M Source/WTF/wtf/FunctionDispatcher.h
    M Source/WTF/wtf/MainThreadDispatcher.cpp
    M Source/WTF/wtf/MainThreadDispatcher.h
    M Source/WTF/wtf/NativePromise.h
    M Source/WTF/wtf/RunLoop.h
    M Source/WTF/wtf/WorkQueue.cpp
    M Source/WTF/wtf/WorkQueue.h
    M Source/WebCore/dom/ScriptExecutionContext.cpp
    M Source/WebCore/dom/ScriptExecutionContext.h
    M Source/WebCore/platform/graphics/MediaSourcePrivate.cpp
    M Source/WebCore/platform/graphics/MediaSourcePrivate.h
    M Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h
    M Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
    M Source/WebCore/platform/graphics/SourceBufferPrivate.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h
    M Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm
    M Source/WebCore/platform/network/cocoa/RangeResponseGenerator.h
    M Source/WebCore/platform/network/cocoa/RangeResponseGenerator.mm
    M Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h
    M Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm
    M Source/WebCore/workers/WorkerOrWorkletThread.h
    M Source/WebKit/GPUProcess/media/RemoteMediaResourceLoader.h
    M Source/WebKit/Platform/IPC/Connection.h
    M Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
    M Source/WebKit/WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp
    M Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.h

  Log Message:
  -----------
  Make SerialFunctionDispatcher thread safe ref counted
rdar://137150912
https://bugs.webkit.org/show_bug.cgi?id=281414

Reviewed by Jean-Yves Avenard.

We make SerialFunctionDispatcher ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr.
This allows to use WeakPtr instead of raw pointers/references, for instance in RemoteRenderingBackendProxy and RemoteGPUProxy.
We remove the need for RemoteGraphicsContextGLProxy to have a SerialFunctionDispatcher reference.
We also rename RefCountedSerialFunctionDispatcher to GuaranteedSerialFunctionDispatcher, to make the intent of the class clearer.

Covered by existing tests.

* Source/WTF/wtf/Forward.h:
* Source/WTF/wtf/FunctionDispatcher.h:
* Source/WTF/wtf/MainThreadDispatcher.cpp:
(WTF::MainThreadDispatcher::ref const): Deleted.
(WTF::MainThreadDispatcher::deref const): Deleted.
* Source/WTF/wtf/MainThreadDispatcher.h:
* Source/WTF/wtf/NativePromise.h:
* Source/WTF/wtf/RunLoop.h:
* Source/WTF/wtf/WorkQueue.cpp:
(WTF::WorkQueue::ref const): Deleted.
(WTF::WorkQueue::deref const): Deleted.
* Source/WTF/wtf/WorkQueue.h:
* Source/WebCore/dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::nativePromiseDispatcher):
* Source/WebCore/dom/ScriptExecutionContext.h:
* Source/WebCore/platform/graphics/MediaSourcePrivate.cpp:
(WebCore::MediaSourcePrivate::MediaSourcePrivate):
* Source/WebCore/platform/graphics/MediaSourcePrivate.h:
* Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h:
(WebCore::PlatformMediaResourceLoader::targetDispatcher):
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::SourceBufferPrivate):
* Source/WebCore/platform/graphics/SourceBufferPrivate.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
* Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::PlatformResourceMediaLoader::stop):
(WebCore::PlatformResourceMediaLoader::responseReceived):
(WebCore::PlatformResourceMediaLoader::loadFailed):
(WebCore::PlatformResourceMediaLoader::loadFinished):
(WebCore::PlatformResourceMediaLoader::dataReceived):
(WebCore::WebCoreAVFResourceLoader::create):
(WebCore::WebCoreAVFResourceLoader::WebCoreAVFResourceLoader):
(WebCore::WebCoreAVFResourceLoader::stopLoading):
(WebCore::WebCoreAVFResourceLoader::responseReceived):
(WebCore::WebCoreAVFResourceLoader::loadFailed):
(WebCore::WebCoreAVFResourceLoader::loadFinished):
(WebCore::WebCoreAVFResourceLoader::newDataStoredInSharedBuffer):
* Source/WebCore/platform/network/cocoa/RangeResponseGenerator.h:
* Source/WebCore/platform/network/cocoa/RangeResponseGenerator.mm:
(WebCore::RangeResponseGenerator::RangeResponseGenerator):
* Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h:
* Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSessionTaskTransactionMetrics _initWithMetrics:onTarget:]):
(-[WebCoreNSURLSessionTaskMetrics _initWithMetrics:onTarget:]):
(WebCore::WebCoreNSURLSessionDataTaskClient::WebCoreNSURLSessionDataTaskClient):
(-[WebCoreNSURLSessionDataTask initWithSession:identifier:request:targetDispatcher:]):
* Source/WebCore/workers/WorkerOrWorkletThread.h:
* Source/WebKit/GPUProcess/media/RemoteMediaResourceLoader.h:
* Source/WebKit/Platform/IPC/Connection.h:
(IPC::Connection::sendWithAsyncReplyOnDispatcher):
(IPC::Connection::makeAsyncReplyHandlerWithDispatcher):
* Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::create):
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::initializeIPC):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxy::assertDispatcherIsCurrent const):
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::dispatch):
(WebKit::RemoteRenderingBackendProxy::isCurrent const):
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::dispatcher): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
(WebKit::RemoteGPUProxy::dispatch):
(WebKit::RemoteGPUProxy::isCurrent const):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.cpp:
(WebKit::GPUProcessWebWorkerClient::createNestedWorkerClient):
(WebKit::GPUProcessWebWorkerClient::ensureRenderingBackend const):
(WebKit::GPUProcessWebWorkerClient::createImageBuffer const):
(WebKit::GPUProcessWebWorkerClient::createGraphicsContextGL const):
(WebKit::GPUProcessWebWorkerClient::createGPUForWebGPU const):
(WebKit::WebWorkerClient::createNestedWorkerClient):
(WebKit::WebWorkerClient::displayID const):
(WebKit::WebWorkerClient::sinkIntoImageBuffer):
(WebKit::WebWorkerClient::createImageBuffer const):
(WebKit::WebWorkerClient::createGraphicsContextGL const):
* Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list