Skip to content

Commit 5f2455a

Browse files
committed
switch to owning
1 parent 86ff876 commit 5f2455a

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

index.bs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ callback UnderlyingSourceStartCallback = any (ReadableStreamController controlle
572572
callback UnderlyingSourcePullCallback = Promise<undefined> (ReadableStreamController controller);
573573
callback UnderlyingSourceCancelCallback = Promise<undefined> (optional any reason);
574574

575-
enum ReadableStreamType { "bytes", "transfer" };
575+
enum ReadableStreamType { "bytes", "owning" };
576576
</xmp>
577577

578578
<dl>
@@ -652,7 +652,7 @@ enum ReadableStreamType { "bytes", "transfer" };
652652
controller interface, see [[#example-rbs-push]].
653653

654654
<p>Can be set to "<dfn enum-value for="ReadableStreamType">transfer</dfn>" to signal that the
655-
constructed {{ReadableStream}} will transfer or serialize chunks before enqueuing them.
655+
constructed {{ReadableStream}} will own chunks (via transfer or serialization) before enqueuing them.
656656
This ensures that enqueued chunks are not mutable by the source.
657657
Transferred or serialized chunks may have <dfn>closing steps</dfn> which are executed if
658658
enqueued chunks are dequeued without being provided to the application, for instance when
@@ -810,7 +810,7 @@ option. If {{UnderlyingSource/type}} is set to undefined (including via omission
810810
|underlyingSource|, |underlyingSourceDict|, |highWaterMark|).
811811
1. Otherwise,
812812
1. Assert: |underlyingSourceDict|["{{UnderlyingSource/type}}"] does not [=map/exist=] or
813-
is "{{ReadableStreamType/transfer}}".
813+
is "{{ReadableStreamType/owning}}".
814814
1. Let |sizeAlgorithm| be ! [$ExtractSizeAlgorithm$](|strategy|).
815815
1. Let |highWaterMark| be ? [$ExtractHighWaterMark$](|strategy|, 1).
816816
1. Perform ? [$SetUpReadableStreamDefaultControllerFromUnderlyingSource$]([=this=],
@@ -1533,8 +1533,9 @@ the following table:
15331533
<td><dfn>\[[stream]]</dfn>
15341534
<td class="non-normative">The {{ReadableStream}} instance controlled
15351535
<tr>
1536-
<td><dfn>\[[isTransferring]]</dfn>
1537-
<td class="non-normative">A boolean flag indicating whether to transfer enqueued chunks
1536+
<td><dfn>\[[isOwning]]</dfn>
1537+
<td class="non-normative">A boolean flag indicating whether to take ownership of enqueued chunks
1538+
via transfer or serialization.
15381539
</table>
15391540

15401541
<h4 id="rs-default-controller-prototype">Methods and properties</h4>
@@ -1583,10 +1584,10 @@ the following table:
15831584
The <dfn id="ref-for-rs-default-controller-enqueue" method
15841585
for="ReadableStreamDefaultController">enqueue(|chunk|, |options|)</dfn> method steps are:
15851586

1586-
1. Let |transfer| be |options|["transfer"].
1587+
1. Let |transferList| be |options|["transfer"].
15871588
1. If ! [$ReadableStreamDefaultControllerCanCloseOrEnqueue$]([=this=]) is false, throw a
15881589
{{TypeError}} exception.
1589-
1. Perform ? [$ReadableStreamDefaultControllerEnqueue$]([=this=], |chunk|, |transfer|).
1590+
1. Perform ? [$ReadableStreamDefaultControllerEnqueue$]([=this=], |chunk|, |transferList|).
15901591
</div>
15911592

15921593
<div algorithm>
@@ -2248,7 +2249,7 @@ create them does not matter.
22482249
objects|transferring=] their [=chunks=]. However, it does introduce a noticeable asymmetry between
22492250
the two branches, and limits the possible [=chunks=] to serializable ones. [[!HTML]]
22502251

2251-
If |stream| is a [=readable byte stream=], or if |stream| type is "{{ReadableStreamType/transfer}}",
2252+
If |stream| is a [=readable byte stream=], or if |stream| type is "{{ReadableStreamType/owning}}",
22522253
then |cloneForBranch2| is ignored and chunks are cloned unconditionally.
22532254

22542255
<p class="note">In this standard ReadableStreamTee is always called with |cloneForBranch2| set to
@@ -2260,7 +2261,7 @@ create them does not matter.
22602261
1. Assert: |cloneForBranch2| is a boolean.
22612262
1. If |stream|.[=ReadableStream/[[controller]]=] [=implements=] {{ReadableByteStreamController}},
22622263
return ? [$ReadableByteStreamTee$](|stream|).
2263-
1. If |stream|.[=ReadableStream/[[controller]]=].[=ReadableStreamDefaultController/[[isTransferring]]=]
2264+
1. If |stream|.[=ReadableStream/[[controller]]=].[=ReadableStreamDefaultController/[[isOwning]]=]
22642265
is true, return ? [$ReadableStreamDefaultTee$](|stream|, true).
22652266
1. Return ? [$ReadableStreamDefaultTee$](|stream|, |cloneForBranch2|).
22662267
</div>
@@ -2972,7 +2973,7 @@ The following abstract operations support the implementation of the
29722973
1. If ! [$IsReadableStreamLocked$](|stream|) is true and !
29732974
[$ReadableStreamGetNumReadRequests$](|stream|) > 0, perform the following steps:
29742975
1. Let |internalChunk| be |chunk|.
2975-
1. If |controller|.[=ReadableStreamDefaultController/[[isTransferring]]=] is true, perform the following steps:
2976+
1. If |controller|.[=ReadableStreamDefaultController/[[isOwning]]=] is true, perform the following steps:
29762977
1. Set |internalChunk| to [$StructuredTransferOrClone$](|chunk|, |transferList|).
29772978
1. If |internalChunk| is an abrupt completion,
29782979
1. Perform ! [$ReadableStreamDefaultControllerError$](|controller|, |internalChunk|.\[[Value]]).
@@ -3050,7 +3051,7 @@ The following abstract operations support the implementation of the
30503051
<dfn abstract-op lt="SetUpReadableStreamDefaultController"
30513052
id="set-up-readable-stream-default-controller">SetUpReadableStreamDefaultController(|stream|,
30523053
|controller|, |startAlgorithm|, |pullAlgorithm|, |cancelAlgorithm|, |highWaterMark|,
3053-
|sizeAlgorithm|, |isTransferring|)</dfn> performs the following steps:
3054+
|sizeAlgorithm|, |isOwning|)</dfn> performs the following steps:
30543055

30553056
1. Assert: |stream|.[=ReadableStream/[[controller]]=] is undefined.
30563057
1. Set |controller|.[=ReadableStreamDefaultController/[[stream]]=] to |stream|.
@@ -3061,8 +3062,8 @@ The following abstract operations support the implementation of the
30613062
|controller|.[=ReadableStreamDefaultController/[[pulling]]=] to false.
30623063
1. Set |controller|.[=ReadableStreamDefaultController/[[strategySizeAlgorithm]]=] to
30633064
|sizeAlgorithm|, |controller|.[=ReadableStreamDefaultController/[[strategyHWM]]=] to
3064-
|highWaterMark| and |controller|.[=ReadableStreamDefaultController/[[isTransferring]]=] to
3065-
|isTransferring|.
3065+
|highWaterMark| and |controller|.[=ReadableStreamDefaultController/[[isOwning]]=] to
3066+
|isOwning|.
30663067
1. Set |controller|.[=ReadableStreamDefaultController/[[pullAlgorithm]]=] to |pullAlgorithm|.
30673068
1. Set |controller|.[=ReadableStreamDefaultController/[[cancelAlgorithm]]=] to |cancelAlgorithm|.
30683069
1. Set |stream|.[=ReadableStream/[[controller]]=] to |controller|.
@@ -3087,8 +3088,8 @@ The following abstract operations support the implementation of the
30873088
1. Let |startAlgorithm| be an algorithm that returns undefined.
30883089
1. Let |pullAlgorithm| be an algorithm that returns [=a promise resolved with=] undefined.
30893090
1. Let |cancelAlgorithm| be an algorithm that returns [=a promise resolved with=] undefined.
3090-
1. Let |isTransferring| be true if |underlyingSourceDict|["{{UnderlyingSource/type}}"] is
3091-
"{{ReadableStreamType/transfer}}" and false otherwise.
3091+
1. Let |isOwning| be true if |underlyingSourceDict|["{{UnderlyingSource/type}}"] is
3092+
"{{ReadableStreamType/owning}}" and false otherwise.
30923093
1. If |underlyingSourceDict|["{{UnderlyingSource/start}}"] [=map/exists=], then set
30933094
|startAlgorithm| to an algorithm which returns the result of [=invoking=]
30943095
|underlyingSourceDict|["{{UnderlyingSource/start}}"] with argument list
@@ -3102,7 +3103,7 @@ The following abstract operations support the implementation of the
31023103
[=invoking=] |underlyingSourceDict|["{{UnderlyingSource/cancel}}"] with argument list
31033104
«&nbsp;|reason|&nbsp;» and [=callback this value=] |underlyingSource|.
31043105
1. Perform ? [$SetUpReadableStreamDefaultController$](|stream|, |controller|, |startAlgorithm|,
3105-
|pullAlgorithm|, |cancelAlgorithm|, |highWaterMark|, |sizeAlgorithm|, |isTransferring|).
3106+
|pullAlgorithm|, |cancelAlgorithm|, |highWaterMark|, |sizeAlgorithm|, |isOwning|).
31063107
</div>
31073108

31083109
<h4 id="rbs-controller-abstract-ops">Byte stream controllers</h4>
@@ -6393,7 +6394,7 @@ for="value-with-size">value</dfn> and <dfn for="value-with-size">size</dfn>.
63936394
1. If ! [$IsNonNegativeNumber$](|size|) is false, throw a {{RangeError}} exception.
63946395
1. If |size| is +∞, throw a {{RangeError}} exception.
63956396
1. Let |enqueuedValue| be |value|.
6396-
1. If |container| has a \[[isTransferring]] internal slot whose value is true, perform the following steps:
6397+
1. If |container| has a \[[isOwning]] internal slot whose value is true, perform the following steps:
63976398
1. Set |enqueuedValue| to [$StructuredTransferOrClone$](|value|, |transferList|).
63986399
1. If |enqueuedValue| is an abrupt completion, return |enqueuedValue|.
63996400
1. [=list/Append=] a new [=value-with-size=] with [=value-with-size/value=] |enqueuedValue| and
@@ -6416,7 +6417,7 @@ for="value-with-size">value</dfn> and <dfn for="value-with-size">size</dfn>.
64166417
performs the following steps:
64176418

64186419
1. Assert: |container| has \[[queue]] and \[[queueTotalSize]] internal slots.
6419-
1. If |container| has a \[[isTransferring]] internal slot whose value is true, perform the following steps until |container|.\[[queue]]
6420+
1. If |container| has a \[[isOwning]] internal slot whose value is true, perform the following steps until |container|.\[[queue]]
64206421
is [=list/is empty|empty=]:
64216422
1. Let |chunk| be ! [$DequeueValue$]([=this=]).
64226423
1. If |chunk| has [=closing steps=], perform the [=closing steps=] given |chunk|.
@@ -6631,8 +6632,7 @@ The following abstract operations are a grab-bag of utilities.
66316632
<div algorithm>
66326633
<dfn abstract-op lt="StructuredTransferOrClone">StructuredTransferOrClone(|value|, |transferList|)</dfn>
66336634
performs the following steps:
6634-
1. If |value| has either an \[[ArrayBufferData]] internal slot or a \[[Detached]] internal slot, perform the following steps:
6635-
1. If |transferList| is undefined or [=list/is empty|is an empty list=], set |transferList| to « |value| ».
6635+
// FIXME: we might want to set |transferList| to « |value| » in case of transferable or ArrayBuffer objects.
66366636
1. Let |serialized| be ! [$StructuredSerializeWithTransfer$](|value|, |transferList|).
66376637
1. Let |deserialized| be ! [$StructuredDeserializeWithTransfer$](|serialized|, [=the current Realm=]).
66386638
1. return |deserialized|.\[[Deserialized]].

0 commit comments

Comments
 (0)