#include "third_party/blink/renderer/core/streams/transferable_streams.h"
#include "third_party/blink/renderer/bindings/core/v8/script_function.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_exception.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_post_message_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_readable_stream_default_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/events/message_event.h"
#include "third_party/blink/renderer/core/messaging/message_port.h"
#include "third_party/blink/renderer/core/streams/miscellaneous_operations.h"
#include "third_party/blink/renderer/core/streams/promise_handler.h"
#include "third_party/blink/renderer/core/streams/read_request.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/core/streams/readable_stream_default_controller.h"
#include "third_party/blink/renderer/core/streams/readable_stream_default_controller_with_script_scope.h"
#include "third_party/blink/renderer/core/streams/readable_stream_transferring_optimizer.h"
#include "third_party/blink/renderer/core/streams/stream_algorithms.h"
#include "third_party/blink/renderer/core/streams/stream_promise_resolver.h"
#include "third_party/blink/renderer/core/streams/underlying_source_base.h"
#include "third_party/blink/renderer/core/streams/writable_stream.h"
#include "third_party/blink/renderer/core/streams/writable_stream_default_controller.h"
#include "third_party/blink/renderer/core/streams/writable_stream_transferring_optimizer.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/v8_binding.h"
#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
template <typename T, typename... Args>
ScriptFunction* CreateFunction(ScriptState* script_state, Args&&... args) { … }
enum class MessageType { … };
v8::Local<v8::Object> CreateKeyValueObject(v8::Isolate* isolate,
const char* key1,
v8::Local<v8::Value> value1,
const char* key2,
v8::Local<v8::Value> value2) { … }
bool UnpackKeyValueObject(ScriptState* script_state,
v8::Local<v8::Object> object,
const char* key1,
v8::Local<v8::Value>* value1,
const char* key2,
v8::Local<v8::Value>* value2) { … }
void PackAndPostMessage(ScriptState* script_state,
MessagePort* port,
MessageType type,
v8::Local<v8::Value> value,
AllowPerChunkTransferring allow_per_chunk_transferring,
ExceptionState& exception_state) { … }
void CrossRealmTransformSendError(ScriptState* script_state,
MessagePort* port,
v8::Local<v8::Value> error) { … }
bool PackAndPostMessageHandlingError(
ScriptState* script_state,
MessagePort* port,
MessageType type,
v8::Local<v8::Value> value,
AllowPerChunkTransferring allow_per_chunk_transferring,
v8::Local<v8::Value>* error) { … }
bool PackAndPostMessageHandlingError(ScriptState* script_state,
MessagePort* port,
MessageType type,
v8::Local<v8::Value> value,
v8::Local<v8::Value>* error) { … }
class CrossRealmTransformStream
: public GarbageCollected<CrossRealmTransformStream> { … };
class CrossRealmTransformMessageListener final : public NativeEventListener { … };
class CrossRealmTransformErrorListener final : public NativeEventListener { … };
class CrossRealmTransformWritable final : public CrossRealmTransformStream { … };
class CrossRealmTransformWritable::WriteAlgorithm final
: public StreamAlgorithm { … };
class CrossRealmTransformWritable::CloseAlgorithm final
: public StreamAlgorithm { … };
class CrossRealmTransformWritable::AbortAlgorithm final
: public StreamAlgorithm { … };
WritableStream* CrossRealmTransformWritable::CreateWritableStream(
ExceptionState& exception_state) { … }
void CrossRealmTransformWritable::HandleMessage(MessageType type,
v8::Local<v8::Value> value) { … }
void CrossRealmTransformWritable::HandleError(v8::Local<v8::Value> error) { … }
class CrossRealmTransformReadable final : public CrossRealmTransformStream { … };
class CrossRealmTransformReadable::PullAlgorithm final
: public StreamAlgorithm { … };
class CrossRealmTransformReadable::CancelAlgorithm final
: public StreamAlgorithm { … };
class ConcatenatingUnderlyingSource final : public UnderlyingSourceBase { … };
ReadableStream* CrossRealmTransformReadable::CreateReadableStream(
ExceptionState& exception_state) { … }
void CrossRealmTransformReadable::HandleMessage(MessageType type,
v8::Local<v8::Value> value) { … }
void CrossRealmTransformReadable::HandleError(v8::Local<v8::Value> error) { … }
}
CORE_EXPORT WritableStream* CreateCrossRealmTransformWritable(
ScriptState* script_state,
MessagePort* port,
AllowPerChunkTransferring allow_per_chunk_transferring,
std::unique_ptr<WritableStreamTransferringOptimizer> optimizer,
ExceptionState& exception_state) { … }
CORE_EXPORT ReadableStream* CreateCrossRealmTransformReadable(
ScriptState* script_state,
MessagePort* port,
std::unique_ptr<ReadableStreamTransferringOptimizer> optimizer,
ExceptionState& exception_state) { … }
ReadableStream* CreateConcatenatedReadableStream(
ScriptState* script_state,
UnderlyingSourceBase* source1,
UnderlyingSourceBase* source2) { … }
}