Sfoglia il codice sorgente

LibWeb: Add IDL definition for Web::Streams::QueuingStrategy

Shannon Booth 2 anni fa
parent
commit
42c102ecb6

+ 1 - 0
Userland/Libraries/LibWeb/Forward.h

@@ -550,6 +550,7 @@ class WritableStreamDefaultController;
 class WritableStreamDefaultWriter;
 
 struct PullIntoDescriptor;
+struct QueuingStrategy;
 struct QueuingStrategyInit;
 struct UnderlyingSink;
 struct UnderlyingSource;

+ 21 - 0
Userland/Libraries/LibWeb/Streams/QueuingStrategy.h

@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2023, Shannon Booth <shannon.ml.booth@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Optional.h>
+#include <LibJS/Heap/GCPtr.h>
+#include <LibWeb/WebIDL/CallbackType.h>
+
+namespace Web::Streams {
+
+// https://streams.spec.whatwg.org/#dictdef-queuingstrategy
+struct QueuingStrategy {
+    Optional<double> high_water_mark;
+    JS::GCPtr<WebIDL::CallbackType> size;
+};
+
+}

+ 7 - 0
Userland/Libraries/LibWeb/Streams/QueuingStrategy.idl

@@ -0,0 +1,7 @@
+callback QueuingStrategySize = unrestricted double (any chunk);
+
+// https://streams.spec.whatwg.org/#dictdef-queuingstrategy
+dictionary QueuingStrategy {
+    unrestricted double highWaterMark;
+    QueuingStrategySize size;
+};