mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb+WebWorker: Add IPC messages to request and communicate shutdown
This commit is contained in:
parent
5d8784318d
commit
27ef9ffa8f
Notes:
sideshowbarker
2024-07-17 04:01:41 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/27ef9ffa8f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/543
6 changed files with 25 additions and 0 deletions
|
@ -14,6 +14,12 @@ void WebWorkerClient::die()
|
|||
// FIXME: Notify WorkerAgent that the worker is ded
|
||||
}
|
||||
|
||||
void WebWorkerClient::did_close_worker()
|
||||
{
|
||||
if (on_worker_close)
|
||||
on_worker_close();
|
||||
}
|
||||
|
||||
WebWorkerClient::WebWorkerClient(NonnullOwnPtr<Core::LocalSocket> socket)
|
||||
: IPC::ConnectionToServer<WebWorkerClientEndpoint, WebWorkerServerEndpoint>(*this, move(socket))
|
||||
{
|
||||
|
|
|
@ -21,6 +21,10 @@ class WebWorkerClient final
|
|||
public:
|
||||
explicit WebWorkerClient(NonnullOwnPtr<Core::LocalSocket>);
|
||||
|
||||
virtual void did_close_worker() override;
|
||||
|
||||
Function<void()> on_worker_close;
|
||||
|
||||
IPC::File dup_socket();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
endpoint WebWorkerClient {
|
||||
did_close_worker() =|
|
||||
}
|
||||
|
|
|
@ -7,5 +7,7 @@ endpoint WebWorkerServer {
|
|||
|
||||
start_dedicated_worker(URL::URL url, String type, String credentials, String name, Web::HTML::TransferDataHolder message_port, Web::HTML::SerializedEnvironmentSettingsObject outside_settings) =|
|
||||
|
||||
close_worker() =|
|
||||
|
||||
handle_file_return(i32 error, Optional<IPC::File> file, i32 request_id) =|
|
||||
}
|
||||
|
|
|
@ -11,6 +11,16 @@
|
|||
|
||||
namespace WebWorker {
|
||||
|
||||
void ConnectionFromClient::close_worker()
|
||||
{
|
||||
async_did_close_worker();
|
||||
|
||||
// FIXME: Invoke a worker shutdown operation that implements the spec
|
||||
m_worker_host = nullptr;
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
void ConnectionFromClient::die()
|
||||
{
|
||||
// FIXME: When handling multiple workers in the same process,
|
||||
|
|
|
@ -28,6 +28,8 @@ public:
|
|||
|
||||
virtual void die() override;
|
||||
|
||||
virtual void close_worker() override;
|
||||
|
||||
void request_file(Web::FileRequest);
|
||||
|
||||
PageHost& page_host() { return *m_page_host; }
|
||||
|
|
Loading…
Add table
Reference in a new issue