mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Implement ReadableStream transfer
This commit is contained in:
parent
7e225b496d
commit
312db85a84
Notes:
github-actions[bot]
2025-05-21 10:56:01 +00:00
Author: https://github.com/trflynn89
Commit: 312db85a84
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4828
Reviewed-by: https://github.com/shannonbooth ✅
9 changed files with 511 additions and 28 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Bindings/ReadableStreamPrototype.h>
|
||||
#include <LibWeb/Bindings/Transferable.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Streams/Algorithms.h>
|
||||
#include <LibWeb/Streams/QueuingStrategy.h>
|
||||
|
@ -58,7 +59,9 @@ struct ReadableStreamPair {
|
|||
};
|
||||
|
||||
// https://streams.spec.whatwg.org/#readablestream
|
||||
class ReadableStream final : public Bindings::PlatformObject {
|
||||
class ReadableStream final
|
||||
: public Bindings::PlatformObject
|
||||
, public Bindings::Transferable {
|
||||
WEB_PLATFORM_OBJECT(ReadableStream, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(ReadableStream);
|
||||
|
||||
|
@ -113,6 +116,11 @@ public:
|
|||
|
||||
GC::Ptr<WebIDL::ArrayBufferView> current_byob_request_view();
|
||||
|
||||
// ^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::ReadableStream; }
|
||||
|
||||
private:
|
||||
explicit ReadableStream(JS::Realm&);
|
||||
|
||||
|
@ -123,10 +131,6 @@ private:
|
|||
// A ReadableStreamDefaultController or ReadableByteStreamController created with the ability to control the state and queue of this stream
|
||||
Optional<ReadableStreamController> m_controller;
|
||||
|
||||
// https://streams.spec.whatwg.org/#readablestream-detached
|
||||
// A boolean flag set to true when the stream is transferred
|
||||
bool m_detached { false };
|
||||
|
||||
// https://streams.spec.whatwg.org/#readablestream-disturbed
|
||||
// A boolean flag set to true when the stream has been read from or canceled
|
||||
bool m_disturbed { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue