#include "third_party/blink/renderer/core/messaging/message_port.h"
#include <memory>
#include <optional>
#include "base/numerics/safe_conversions.h"
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/base/big_buffer_mojom_traits.h"
#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h"
#include "third_party/blink/public/mojom/messaging/transferable_message.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/post_message_helper.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_post_message_options.h"
#include "third_party/blink/renderer/core/event_target_names.h"
#include "third_party/blink/renderer/core/events/message_event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/user_activation.h"
#include "third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h"
#include "third_party/blink/renderer/core/workers/worker_thread.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/bindings/thread_debugger.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/scheduler/public/task_attribution_tracker.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
namespace blink {
MessagePort::MessagePort(ExecutionContext& execution_context)
: … { … }
void MessagePort::Dispose() { … }
void MessagePort::postMessage(ScriptState* script_state,
const ScriptValue& message,
HeapVector<ScriptValue>& transfer,
ExceptionState& exception_state) { … }
void MessagePort::postMessage(ScriptState* script_state,
const ScriptValue& message,
const PostMessageOptions* options,
ExceptionState& exception_state) { … }
MessagePortChannel MessagePort::Disentangle() { … }
void MessagePort::start() { … }
void MessagePort::close() { … }
void MessagePort::OnConnectionError() { … }
void MessagePort::Entangle(MessagePortDescriptor port_descriptor,
MessagePort* port) { … }
void MessagePort::Entangle(MessagePortChannel channel) { … }
const AtomicString& MessagePort::InterfaceName() const { … }
bool MessagePort::HasPendingActivity() const { … }
Vector<MessagePortChannel> MessagePort::DisentanglePorts(
ExecutionContext* context,
const MessagePortArray& ports,
ExceptionState& exception_state) { … }
MessagePortArray* MessagePort::EntanglePorts(
ExecutionContext& context,
Vector<MessagePortChannel> channels) { … }
MessagePortArray* MessagePort::EntanglePorts(
ExecutionContext& context,
WebVector<MessagePortChannel> channels) { … }
::MojoHandle MessagePort::EntangledHandleForTesting() const { … }
void MessagePort::Trace(Visitor* visitor) const { … }
bool MessagePort::Accept(mojo::Message* mojo_message) { … }
Event* MessagePort::CreateMessageEvent(BlinkTransferableMessage& message) { … }
void MessagePort::OnEntangledPortDisconnected() { … }
void MessagePort::PostMessageTaskContainer::AddPostMessageTask(
scheduler::TaskAttributionInfo* task) { … }
scheduler::TaskAttributionInfo*
MessagePort::PostMessageTaskContainer::GetAndDecrementPostMessageTask(
std::optional<scheduler::TaskAttributionId> id) { … }
}