mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibWeb: Add the IDL for the GenericTransformStream mixin
This commit is contained in:
parent
5a2260a0bc
commit
35ba7c7e00
Notes:
github-actions[bot]
2024-11-17 22:22:14 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/35ba7c7e005 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2370
4 changed files with 78 additions and 0 deletions
|
@ -664,6 +664,7 @@ set(SOURCES
|
|||
Streams/AbstractOperations.cpp
|
||||
Streams/ByteLengthQueuingStrategy.cpp
|
||||
Streams/CountQueuingStrategy.cpp
|
||||
Streams/GenericTransformStream.cpp
|
||||
Streams/ReadableByteStreamController.cpp
|
||||
Streams/ReadableStream.cpp
|
||||
Streams/ReadableStreamBYOBReader.cpp
|
||||
|
|
40
Libraries/LibWeb/Streams/GenericTransformStream.cpp
Normal file
40
Libraries/LibWeb/Streams/GenericTransformStream.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Streams/GenericTransformStream.h>
|
||||
#include <LibWeb/Streams/ReadableStream.h>
|
||||
#include <LibWeb/Streams/TransformStream.h>
|
||||
#include <LibWeb/Streams/WritableStream.h>
|
||||
|
||||
namespace Web::Streams {
|
||||
|
||||
GenericTransformStreamMixin::GenericTransformStreamMixin(GC::Ref<TransformStream> transform)
|
||||
: m_transform(transform)
|
||||
{
|
||||
}
|
||||
|
||||
GenericTransformStreamMixin::~GenericTransformStreamMixin() = default;
|
||||
|
||||
void GenericTransformStreamMixin::visit_edges(GC::Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(m_transform);
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#dom-generictransformstream-readable
|
||||
GC::Ref<ReadableStream> GenericTransformStreamMixin::readable()
|
||||
{
|
||||
// The readable getter steps are to return this's transform.[[readable]].
|
||||
return m_transform->readable();
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#dom-generictransformstream-writable
|
||||
GC::Ref<WritableStream> GenericTransformStreamMixin::writable()
|
||||
{
|
||||
// The writable getter steps are to return this's transform.[[writable]].
|
||||
return m_transform->writable();
|
||||
}
|
||||
|
||||
}
|
30
Libraries/LibWeb/Streams/GenericTransformStream.h
Normal file
30
Libraries/LibWeb/Streams/GenericTransformStream.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGC/Cell.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::Streams {
|
||||
|
||||
class GenericTransformStreamMixin {
|
||||
public:
|
||||
virtual ~GenericTransformStreamMixin();
|
||||
|
||||
GC::Ref<ReadableStream> readable();
|
||||
GC::Ref<WritableStream> writable();
|
||||
|
||||
protected:
|
||||
explicit GenericTransformStreamMixin(GC::Ref<TransformStream>);
|
||||
void visit_edges(GC::Cell::Visitor&);
|
||||
|
||||
// https://streams.spec.whatwg.org/#generictransformstream-transform
|
||||
GC::Ref<TransformStream> m_transform;
|
||||
};
|
||||
|
||||
}
|
7
Libraries/LibWeb/Streams/GenericTransformStream.idl
Normal file
7
Libraries/LibWeb/Streams/GenericTransformStream.idl
Normal file
|
@ -0,0 +1,7 @@
|
|||
#import <Streams/ReadableStream.idl>
|
||||
#import <Streams/WritableStream.idl>
|
||||
|
||||
interface mixin GenericTransformStream {
|
||||
readonly attribute ReadableStream readable;
|
||||
readonly attribute WritableStream writable;
|
||||
};
|
Loading…
Reference in a new issue