mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Implement TransformStream transfer
This commit is contained in:
parent
cca08ad833
commit
95fc0a8070
Notes:
github-actions[bot]
2025-05-21 10:55:48 +00:00
Author: https://github.com/trflynn89
Commit: 95fc0a8070
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4828
Reviewed-by: https://github.com/shannonbooth ✅
6 changed files with 231 additions and 18 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Bindings/Transferable.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Streams/Algorithms.h>
|
||||
#include <LibWeb/Streams/QueuingStrategy.h>
|
||||
|
@ -15,7 +16,9 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
class TransformStream final : public Bindings::PlatformObject {
|
||||
class TransformStream final
|
||||
: public Bindings::PlatformObject
|
||||
, public Bindings::Transferable {
|
||||
WEB_PLATFORM_OBJECT(TransformStream, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(TransformStream);
|
||||
|
||||
|
@ -44,6 +47,11 @@ public:
|
|||
void set_up(GC::Ref<TransformAlgorithm>, GC::Ptr<FlushAlgorithm> = {}, GC::Ptr<CancelAlgorithm> = {});
|
||||
void enqueue(JS::Value chunk);
|
||||
|
||||
// ^Transferable
|
||||
virtual WebIDL::ExceptionOr<void> transfer_steps(HTML::TransferDataHolder&) override;
|
||||
virtual WebIDL::ExceptionOr<void> transfer_receiving_steps(HTML::TransferDataHolder&) override;
|
||||
virtual HTML::TransferType primary_interface() const override { return HTML::TransferType::TransformStream; }
|
||||
|
||||
private:
|
||||
explicit TransformStream(JS::Realm& realm);
|
||||
|
||||
|
@ -63,10 +71,6 @@ private:
|
|||
// A TransformStreamDefaultController created with the ability to control [[readable]] and [[writable]]
|
||||
GC::Ptr<TransformStreamDefaultController> m_controller;
|
||||
|
||||
// https://streams.spec.whatwg.org/#transformstream-detached
|
||||
// A boolean flag set to true when the stream is transferred
|
||||
bool m_detached { false };
|
||||
|
||||
// https://streams.spec.whatwg.org/#transformstream-readable
|
||||
// The ReadableStream instance controlled by this object
|
||||
GC::Ptr<ReadableStream> m_readable;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue