#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/streams/miscellaneous_operations.h"
#include <math.h>
#include <optional>
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_readable_stream.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_writable_stream.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/core/streams/stream_algorithms.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/trace_wrapper_v8_reference.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
namespace {
v8::Local<v8::Promise> PromiseRejectInternal(ScriptState* script_state,
v8::Local<v8::Value> value,
int recursion_depth) { … }
class DefaultSizeAlgorithm final : public StrategySizeAlgorithm { … };
class JavaScriptSizeAlgorithm final : public StrategySizeAlgorithm { … };
class TrivialStreamAlgorithm final : public StreamAlgorithm { … };
class JavaScriptStreamAlgorithmWithoutExtraArg final : public StreamAlgorithm { … };
class JavaScriptStreamAlgorithmWithExtraArg final : public StreamAlgorithm { … };
class JavaScriptByteStreamStartAlgorithm : public StreamStartAlgorithm { … };
class JavaScriptStreamStartAlgorithm : public StreamStartAlgorithm { … };
class TrivialStartAlgorithm : public StreamStartAlgorithm { … };
}
CORE_EXPORT StreamAlgorithm* CreateAlgorithmFromUnderlyingMethod(
ScriptState* script_state,
v8::Local<v8::Object> underlying_object,
const char* method_name,
const char* method_name_for_error,
v8::MaybeLocal<v8::Value> extra_arg,
ExceptionState& exception_state) { … }
CORE_EXPORT v8::MaybeLocal<v8::Value> ResolveMethod(
ScriptState* script_state,
v8::Local<v8::Object> object,
const char* method_name,
const char* name_for_error,
ExceptionState& exception_state) { … }
CORE_EXPORT StreamAlgorithm* CreateAlgorithmFromResolvedMethod(
ScriptState* script_state,
v8::Local<v8::Object> underlying_object,
v8::Local<v8::Value> method,
v8::MaybeLocal<v8::Value> extra_arg) { … }
CORE_EXPORT StreamStartAlgorithm* CreateStartAlgorithm(
ScriptState* script_state,
v8::Local<v8::Object> underlying_object,
const char* method_name_for_error,
v8::Local<v8::Value> controller) { … }
CORE_EXPORT StreamStartAlgorithm* CreateByteStreamStartAlgorithm(
ScriptState* script_state,
v8::Local<v8::Object> underlying_object,
v8::Local<v8::Value> method,
v8::Local<v8::Value> controller) { … }
CORE_EXPORT StreamStartAlgorithm* CreateTrivialStartAlgorithm() { … }
CORE_EXPORT StreamAlgorithm* CreateTrivialStreamAlgorithm() { … }
CORE_EXPORT ScriptValue CreateTrivialQueuingStrategy(v8::Isolate* isolate,
size_t high_water_mark) { … }
CORE_EXPORT v8::MaybeLocal<v8::Value> CallOrNoop1(
ScriptState* script_state,
v8::Local<v8::Object> object,
const char* method_name,
const char* name_for_error,
v8::Local<v8::Value> arg0,
ExceptionState& exception_state) { … }
CORE_EXPORT v8::MaybeLocal<v8::Value> Call1(ScriptState* script_state,
v8::Local<v8::Function> method,
v8::Local<v8::Object> object,
v8::Local<v8::Value> arg0,
ExceptionState& exception_state) { … }
CORE_EXPORT v8::Local<v8::Promise> PromiseCall(ScriptState* script_state,
v8::Local<v8::Function> method,
v8::Local<v8::Object> recv,
int argc,
v8::Local<v8::Value> argv[]) { … }
CORE_EXPORT double ValidateAndNormalizeHighWaterMark(
double high_water_mark,
ExceptionState& exception_state) { … }
CORE_EXPORT StrategySizeAlgorithm* MakeSizeAlgorithmFromSizeFunction(
ScriptState* script_state,
v8::Local<v8::Value> size,
ExceptionState& exception_state) { … }
CORE_EXPORT StrategySizeAlgorithm* CreateDefaultSizeAlgorithm() { … }
CORE_EXPORT v8::Local<v8::Promise> PromiseResolve(ScriptState* script_state,
v8::Local<v8::Value> value) { … }
CORE_EXPORT v8::Local<v8::Promise> PromiseResolveWithUndefined(
ScriptState* script_state) { … }
CORE_EXPORT v8::Local<v8::Promise> PromiseReject(ScriptState* script_state,
v8::Local<v8::Value> value) { … }
void ScriptValueToObject(ScriptState* script_state,
ScriptValue value,
v8::Local<v8::Object>* object,
ExceptionState& exception_state) { … }
StrategyUnpacker::StrategyUnpacker(ScriptState* script_state,
ScriptValue strategy,
ExceptionState& exception_state) { … }
StrategySizeAlgorithm* StrategyUnpacker::MakeSizeAlgorithm(
ScriptState* script_state,
ExceptionState& exception_state) const { … }
double StrategyUnpacker::GetHighWaterMark(
ScriptState* script_state,
int default_value,
ExceptionState& exception_state) const { … }
bool StrategyUnpacker::IsSizeUndefined() const { … }
}