mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 01:24:57 +00:00

Use a LocalSocket to represent the connection between two message ports. The concept of the port message queue is still missing, however. When that concept is implemented, the "steps" in step 7 of the message port transfer steps will need to send the serialized data over the connected socketpair and run in the event loop of the process that holds onto the other side of the message port. Doing this should allow centralizing the behavior of postMessage for Window, MessagePorts and Workers.
37 lines
1 KiB
C++
37 lines
1 KiB
C++
/*
|
|
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Vector.h>
|
|
#include <LibIPC/Forward.h>
|
|
#include <LibWeb/HTML/StructuredSerialize.h>
|
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
|
|
|
namespace Web::Bindings {
|
|
|
|
// https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects
|
|
class Transferable {
|
|
public:
|
|
virtual ~Transferable() = default;
|
|
|
|
// NOTE: It is an error to call Base::transfer_steps in your impl
|
|
virtual WebIDL::ExceptionOr<void> transfer_steps(HTML::TransferDataHolder&) = 0;
|
|
|
|
// NOTE: It is an error to call Base::transfer_receiving_steps in your impl
|
|
virtual WebIDL::ExceptionOr<void> transfer_receiving_steps(HTML::TransferDataHolder&) = 0;
|
|
|
|
virtual HTML::TransferType primary_interface() const = 0;
|
|
|
|
bool is_detached() const { return m_detached; }
|
|
void set_detached(bool b) { m_detached = b; }
|
|
|
|
private:
|
|
// https://html.spec.whatwg.org/multipage/structured-data.html#detached
|
|
bool m_detached = false;
|
|
};
|
|
|
|
}
|