Files
ladybird/Userland/Services/WebWorker/ConnectionFromClient.h
Shannon Booth e800605ad3 AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of
the system, as LibCore depends on LibURL.

This change has two main benefits:
 * Moving AK back more towards being an agnostic library that can
   be used between the kernel and userspace. URL has never really fit
   that description - and is not used in the kernel.
 * URL _should_ depend on LibUnicode, as it needs punnycode support.
   However, it's not really possible to do this inside of AK as it can't
   depend on any external library. This change brings us a little closer
   to being able to do that, but unfortunately we aren't there quite
   yet, as the code generators depend on LibCore.
2024-03-18 14:06:28 -04:00

56 lines
1.6 KiB
C++

/*
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/HashMap.h>
#include <LibIPC/ConnectionFromClient.h>
#include <LibJS/Forward.h>
#include <LibJS/Heap/Handle.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Loader/FileRequest.h>
#include <LibWeb/Worker/WebWorkerClientEndpoint.h>
#include <LibWeb/Worker/WebWorkerServerEndpoint.h>
#include <WebWorker/Forward.h>
#include <WebWorker/PageHost.h>
namespace WebWorker {
class ConnectionFromClient final
: public IPC::ConnectionFromClient<WebWorkerClientEndpoint, WebWorkerServerEndpoint> {
C_OBJECT(ConnectionFromClient);
public:
virtual ~ConnectionFromClient() override;
virtual void die() override;
void request_file(Web::FileRequest);
PageHost& page_host() { return *m_page_host; }
PageHost const& page_host() const { return *m_page_host; }
private:
explicit ConnectionFromClient(NonnullOwnPtr<Core::LocalSocket>);
Web::Page& page();
Web::Page const& page() const;
virtual void start_dedicated_worker(URL::URL const& url, String const&, String const&, String const&, Web::HTML::TransferDataHolder const&, Web::HTML::SerializedEnvironmentSettingsObject const&) override;
virtual void handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id) override;
JS::Handle<PageHost> m_page_host;
// FIXME: Route console messages to the Browser UI using a ConsoleClient
HashMap<int, Web::FileRequest> m_requested_files {};
int last_id { 0 };
RefPtr<DedicatedWorkerHost> m_worker_host;
};
}