Skip to content

Commit

Permalink
Use structured serialize/deserialize to clone chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Mar 24, 2021
1 parent 9644208 commit e3c2532
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2341,8 +2341,7 @@ create them does not matter.
1. Set |reading| to false.
1. Let |chunk1| and |chunk2| be |chunk|.
1. If |canceled1| is false and |canceled2| is false, set |chunk2| to !
[$Construct$](|chunk|.constructor, « |chunk| »).
<!-- TODO: Create abstract op for cloning a TypedArray or DataView -->
[$StructuredDeserialize$](? [$StructuredSerialize$](|chunk|), [=the current Realm=]).
1. If |canceled1| is false, perform !
[$ReadableByteStreamControllerEnqueue$](|branch1|.[=ReadableStream/[[controller]]=],
|chunk1|).
Expand Down Expand Up @@ -2387,8 +2386,8 @@ create them does not matter.
1. Set |reading| to false.
1. If |forBranch2| is true,
1. If |canceled1| is false,
1. Let |clonedChunk| be ! [$Construct$](|chunk|.constructor, « |chunk| »).
<!-- TODO: Create abstract op for cloning a TypedArray or DataView -->
1. Let |clonedChunk| be ! [$StructuredDeserialize$](? [$StructuredSerialize$](|chunk|),
[=the current Realm=]).
1. Perform ! [$ReadableByteStreamControllerEnqueue$](|branch1|.[=ReadableStream/[[controller]]=],
|clonedChunk|).
1. If |canceled2| is true,
Expand All @@ -2401,8 +2400,8 @@ create them does not matter.
|chunk|.\[[ByteLength]]).
1. Otherwise,
1. If |canceled2| is false,
1. Let |clonedChunk| be ! [$Construct$](|chunk|.constructor, « |chunk| »).
<!-- TODO: Create abstract op for cloning a TypedArray or DataView -->
1. Let |clonedChunk| be ! [$StructuredDeserialize$](? [$StructuredSerialize$](|chunk|),
[=the current Realm=]).
1. Perform ! [$ReadableByteStreamControllerEnqueue$](|branch2|.[=ReadableStream/[[controller]]=],
|clonedChunk|).
1. If |canceled1| is true,
Expand Down

0 comments on commit e3c2532

Please sign in to comment.