Bug 261720 - Give ability for IPC calls to work with NativePromise
Summary: Give ability for IPC calls to work with NativePromise
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Process Model (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-09-18 21:10 PDT by Jean-Yves Avenard [:jya]
Modified: 2023-09-21 00:53 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2023-09-18 21:10:10 PDT
Would give the ability to instead of doing:

```
    m_connectionToWebProcess->connection().sendWithAsyncReply(Messages::MediaSourcePrivateRemote::WaitForTarget(target), WTFMove(completionHandler), m_identifier);
```

you could instead do:
```
    m_connectionToWebProcess->connection().sendWithPromisedReply(Messages::MediaSourcePrivateRemote::WaitForTarget(target), m_identifier)
    ->whenSettled(runLoop, __func__, [] (MediaSourcePrivateRemote::WaitForTarget::Promise::Result&& result) {
        if (result)
            // do something with result.value()
        else
            // do something with result.error()
    });
```

this would also gives the ability to propagate the IPC error, see bug 257934

It also allows to guarantee on which thread the completionHandler will run once the IPC operation has returned its value.
Comment 1 Radar WebKit Bug Importer 2023-09-18 21:12:48 PDT
<rdar://problem/115704438>
Comment 2 Jean-Yves Avenard [:jya] 2023-09-20 00:45:36 PDT
Pull request: https://github.com/WebKit/WebKit/pull/17965
Comment 3 EWS 2023-09-21 00:53:26 PDT
Committed 268240@main (f997a9edb80c): <https://commits.webkit.org/268240@main>

Reviewed commits have been landed. Closing PR #17965 and removing active labels.