1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 07:04:58 +00:00
serenity/Userland/Services/WebWorker/DedicatedWorkerHost.h
Andrew Kaster b10fee00eb LibWeb+WebWorker: Convert Workers to use MessagePorts for postMessage
This aligns Workers and Window and MessagePorts to all use the same
mechanism for transferring serialized messages across realms.

It also allows transferring more message ports into a worker.

Re-enable the Worker-echo test, as none of the MessagePort tests have
themselves been flaky, and those are now using the same underlying
implementation.
2023-12-25 12:09:11 +01:00

31 lines
686 B
C++

/*
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <AK/URL.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/StructuredSerialize.h>
namespace WebWorker {
class DedicatedWorkerHost : public RefCounted<DedicatedWorkerHost> {
public:
explicit DedicatedWorkerHost(AK::URL url, String type);
~DedicatedWorkerHost();
void run(JS::NonnullGCPtr<Web::Page>, Web::HTML::TransferDataHolder message_port_data);
private:
RefPtr<Web::HTML::WorkerDebugConsoleClient> m_console;
AK::URL m_url;
String m_type;
};
}