Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: afd0493af45e56cf1005c046ca57af404a96d59d
      
https://github.com/WebKit/WebKit/commit/afd0493af45e56cf1005c046ca57af404a96d59d
  Author: Alex Christensen <achristen...@apple.com>
  Date:   2025-03-08 (Sat, 08 Mar 2025)

  Changed paths:
    M Source/WebKit/Platform/CoroutineUtilities.h
    M Source/WebKit/Platform/IPC/HandleMessage.h
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/cmake/WebKitCompilerFlags.cmake
    M Tools/TestWebKitAPI/CoroutineUtilities.h

  Log Message:
  -----------
  Begin using C++ coroutines for WebFullScreenManagerProxy IPC functions
https://bugs.webkit.org/show_bug.cgi?id=288413
rdar://145511185

Reviewed by Abrar Rahman Protyasha.

I tried this in 278995@main but it got reverted because it leaked a call frame 
every time we called a coroutine.
I fixed that by making Task::final_suspend return std::suspend_never because 
when we call a coroutine
and give it a CompletionHandler, the caller has no more business suspending it. 
 The coroutine should continue
until it calls the CompletionHandler.  My technique of using a class 
CoroutineCaller to try to destroy the call
frame from the caller is also not needed.  You just call a coroutine that 
returns a Task like you do any function,
and it takes care of itself and returns at the first co_await or co_return or 
the end, whichever comes first.

I made Lazy and Awaitable [[nodiscard]] to prevent bugs where the result isn't 
co_awaited.

This makes adding async tasks simpler.  Instead of indenting everything another 
layer and explicitly copying all
the parameters needed into yet another lambda capture, we just add a co_await 
doSomethingAsync() call and it just works.
It also makes it so the code won't compile if we forget to co_return a value, 
instead of the status quo where
we can forget to call a CompletionHandler in a branch.

WebPage::createAppHighlightInSelectedRange had an unused return value, and I 
changed it to void because I now
use sfinae to detect if the return value is void when determining which version 
of callMemberFunction to call.

* Source/WebKit/Platform/CoroutineUtilities.h:
(WebKit::Task::promise_type::get_return_object):
(WebKit::Lazy::PromiseBase::initial_suspend): Deleted.
(WebKit::Lazy::PromiseBase::unhandled_exception): Deleted.
(WebKit::Lazy::PromiseBase::setHandle): Deleted.
(WebKit::Lazy::PromiseBase::handle): Deleted.
(WebKit::Lazy::Promise<U>::get_return_object): Deleted.
(WebKit::Lazy::Promise<U>::return_void): Deleted.
(WebKit::Lazy::Promise<U>::result): Deleted.
(WebKit::Lazy::Awaitable::Awaitable): Deleted.
(WebKit::Lazy::Awaitable::await_ready const): Deleted.
(WebKit::Lazy::Awaitable::await_suspend): Deleted.
(WebKit::Lazy::Awaitable::await_resume): Deleted.
(WebKit::Lazy::Lazy): Deleted.
(WebKit::Lazy::operator co_await const): Deleted.
(WebKit::CoroutineCaller::setCoroutine): Deleted.
(WebKit::callCoroutine): Deleted.
(WebKit::AwaitableTaskWithCompletionHandler::AwaitableTaskWithCompletionHandler):
 Deleted.
(WebKit::AwaitableTaskWithCompletionHandler::await_ready): Deleted.
(WebKit::AwaitableTaskWithCompletionHandler::await_suspend): Deleted.
(WebKit::AwaitableTaskWithCompletionHandler::await_resume): Deleted.
* Source/WebKit/Platform/IPC/HandleMessage.h:
* Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::prepareQuickLookImageURL const):
(WebKit::WebFullScreenManagerProxy::beganEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::beganExitFullScreen):
* Source/WebKit/UIProcess/WebFullScreenManagerProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::nextPresentationUpdate):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Tools/TestWebKitAPI/CoroutineUtilities.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to