[webkit-changes] [WebKit/WebKit] f69deb: NativePromise should be chainable so long that the...
Jean-Yves Avenard
noreply at github.com
Mon Nov 20 16:26:33 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f69deb1f63af3a56d308fbfa58a8065ac27ee3f4
https://github.com/WebKit/WebKit/commit/f69deb1f63af3a56d308fbfa58a8065ac27ee3f4
Author: Jean-Yves Avenard <jya at apple.com>
Date: 2023-11-20 (Mon, 20 Nov 2023)
Changed paths:
M Source/WTF/wtf/NativePromise.h
M Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
M Source/WebCore/platform/graphics/SourceBufferPrivate.h
M Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
M Tools/TestWebKitAPI/Tests/WTF/NativePromise.cpp
Log Message:
-----------
NativePromise should be chainable so long that their resolve/reject type are convertible
https://bugs.webkit.org/show_bug.cgi?id=264028
rdar://117782213
Reviewed by Youenn Fablet.
Make chainTo usable with different type of NativePromise producer.
This is achieved by creating a producer for the target promise and chaining
it to the current promise.
As the target producer is only ever moved, we can guarantee that it won't be
accessed on different thread concurrently and as such remove the need to
dispatch a new task.
We add a new whenSettled method that will immediately invoke the callback
when the source promise is settled.
For template argument type deduction to work properly, the Producer class
had to be moved outside the NativePromise class.
Update SourceBufferPrivate to use new conversion functionality.
Fly-by: replace all static_cast<Ref<NativePromise>> in NativePromise.h
with a private method to improve code readability.
* Source/WTF/wtf/NativePromise.h:
(WTF::invokeAsync):
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::removeCodedFrames):
(WebCore::SourceBufferPrivate::append):
(WebCore::SourceBufferPrivate::resetParserState):
(WebCore::SourceBufferPrivate::memoryPressure):
* Source/WebCore/platform/graphics/SourceBufferPrivate.h:
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::applyConstraints):
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::takePhoto): Simplify,
remove unnecessary use of Producer.
* Tools/TestWebKitAPI/Tests/WTF/NativePromise.cpp:
(TestWebKitAPI::runInCurrentRunLoopUntilDone):
(TestWebKitAPI::TEST):
(TestWebKitAPI::makeMoveableFunction): Use std::invoke as it's more modern.
Canonical link: https://commits.webkit.org/270990@main
More information about the webkit-changes
mailing list