1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:57:44 +00:00

LibWeb: Port Stream algorithms from JS::SafeFunction to JS::HeapFunction

This commit is contained in:
Shannon Booth 2024-01-26 18:54:24 +13:00 committed by Tim Flynn
parent e118430648
commit 5f484d200a
14 changed files with 211 additions and 189 deletions

View file

@ -32,8 +32,8 @@ public:
WebIDL::ExceptionOr<void> enqueue(JS::Value chunk);
void error(JS::Value error);
auto& cancel_algorithm() { return m_cancel_algorithm; }
void set_cancel_algorithm(Optional<CancelAlgorithm> value) { m_cancel_algorithm = move(value); }
JS::GCPtr<CancelAlgorithm> cancel_algorithm() { return m_cancel_algorithm; }
void set_cancel_algorithm(JS::GCPtr<CancelAlgorithm> value) { m_cancel_algorithm = value; }
bool close_requested() const { return m_close_requested; }
void set_close_requested(bool value) { m_close_requested = value; }
@ -41,8 +41,8 @@ public:
bool pull_again() const { return m_pull_again; }
void set_pull_again(bool value) { m_pull_again = value; }
auto& pull_algorithm() { return m_pull_algorithm; }
void set_pull_algorithm(Optional<PullAlgorithm> value) { m_pull_algorithm = move(value); }
JS::GCPtr<PullAlgorithm> pull_algorithm() { return m_pull_algorithm; }
void set_pull_algorithm(JS::GCPtr<PullAlgorithm> value) { m_pull_algorithm = value; }
bool pulling() const { return m_pulling; }
void set_pulling(bool value) { m_pulling = value; }
@ -58,8 +58,8 @@ public:
double strategy_hwm() const { return m_strategy_hwm; }
void set_strategy_hwm(double value) { m_strategy_hwm = value; }
auto& strategy_size_algorithm() { return m_strategy_size_algorithm; }
void set_strategy_size_algorithm(Optional<SizeAlgorithm> value) { m_strategy_size_algorithm = move(value); }
JS::GCPtr<SizeAlgorithm> strategy_size_algorithm() { return m_strategy_size_algorithm; }
void set_strategy_size_algorithm(JS::GCPtr<SizeAlgorithm> value) { m_strategy_size_algorithm = value; }
JS::GCPtr<ReadableStream> stream() { return m_stream; }
void set_stream(JS::GCPtr<ReadableStream> value) { m_stream = value; }
@ -75,7 +75,7 @@ private:
// https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-cancelalgorithm
// A promise-returning algorithm, taking one argument (the cancel reason), which communicates a requested cancelation to the underlying source
Optional<CancelAlgorithm> m_cancel_algorithm;
JS::GCPtr<CancelAlgorithm> m_cancel_algorithm;
// https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-closerequested
// A boolean flag indicating whether the stream has been closed by its underlying source, but still has chunks in its internal queue that have not yet been read
@ -87,7 +87,7 @@ private:
// https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-pullalgorithm
// A promise-returning algorithm that pulls data from the underlying source
Optional<PullAlgorithm> m_pull_algorithm;
JS::GCPtr<PullAlgorithm> m_pull_algorithm;
// https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-pulling
// A boolean flag set to true while the underlying source's pull algorithm is executing and the returned promise has not yet fulfilled, used to prevent reentrant calls
@ -111,7 +111,7 @@ private:
// https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-strategysizealgorithm
// An algorithm to calculate the size of enqueued chunks, as part of the streams queuing strategy
Optional<SizeAlgorithm> m_strategy_size_algorithm;
JS::GCPtr<SizeAlgorithm> m_strategy_size_algorithm;
// https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-stream
// The ReadableStream instance controlled