mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibWeb: Implement CountQueuingStrategy highWaterMark property
This commit is contained in:
parent
0d714ad165
commit
c9941ba95b
6 changed files with 95 additions and 0 deletions
38
Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp
Normal file
38
Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Shannon Booth <shannon.ml.booth@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/CountQueuingStrategyPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Streams/CountQueuingStrategy.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::Streams {
|
||||
|
||||
// https://streams.spec.whatwg.org/#blqs-constructor
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<CountQueuingStrategy>> CountQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init)
|
||||
{
|
||||
// The new CountQueuingStrategy(init) constructor steps are:
|
||||
// 1. Set this.[[highWaterMark]] to init["highWaterMark"].
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<CountQueuingStrategy>(realm, realm, init.high_water_mark));
|
||||
}
|
||||
|
||||
CountQueuingStrategy::CountQueuingStrategy(JS::Realm& realm, double high_water_mark)
|
||||
: PlatformObject(realm)
|
||||
, m_high_water_mark(high_water_mark)
|
||||
{
|
||||
}
|
||||
|
||||
CountQueuingStrategy::~CountQueuingStrategy() = default;
|
||||
|
||||
JS::ThrowCompletionOr<void> CountQueuingStrategy::initialize(JS::Realm& realm)
|
||||
{
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CountQueuingStrategyPrototype>(realm, "CountQueuingStrategy"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue