Title: [206814] trunk/Source/WebCore
Revision
206814
Author
commit-qu...@webkit.org
Date
2016-10-05 09:46:19 -0700 (Wed, 05 Oct 2016)

Log Message

[Readable Streams API] Align function names with spec
https://bugs.webkit.org/show_bug.cgi?id=162967

Patch by Romain Bellessort <romain.belless...@crf.canon.fr> on 2016-10-05
Reviewed by Darin Adler.

Align function names with spec. Behaviour was already in line with spec, but previous function names had
sometimes been preserved to track the changes more easily. This led to some inconsistencies (for instance,
enqueueInReadableStream was still used even though it works on a controller instead of a stream) and it
also made it more difficult to compare spec and implementation.

No change in behaviour.

* Modules/fetch/FetchInternals.js:
(consumeStream): Updated with new function names.
* Modules/fetch/FetchResponse.js:
(clone): Updated with new function names.
* Modules/streams/ReadableStream.js:
(tee): Updated with new function names.
* Modules/streams/ReadableStreamDefaultController.js:
(enqueue): Updated with new function names.
(error): Updated with new function names.
* Modules/streams/ReadableStreamDefaultReader.js:
(read): Updated with new function names.
* Modules/streams/ReadableStreamInternals.js:
(privateInitializeReadableStreamDefaultController): Updated with new function names.
(readableStreamDefaultControllerError): Updated with new function names.
(readableStreamTee): Updated with new function names.
(readableStreamTeePullFunction): Updated with new function names.
(readableStreamTeeBranch2CancelFunction): Updated with new function names.
(readableStreamError): Updated with new function names.
(readableStreamCancel): Updated with new function names.
(readableStreamDefaultControllerPull): Updated with new function names.
(readableStreamDefaultControllerClose): Updated with new function names.
(readableStreamClose): Updated with new function names.
(readableStreamDefaultControllerEnqueue): Updated with new function names.
(readableStreamDefaultReaderRead): Updated with new function names.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206813 => 206814)


--- trunk/Source/WebCore/ChangeLog	2016-10-05 16:29:37 UTC (rev 206813)
+++ trunk/Source/WebCore/ChangeLog	2016-10-05 16:46:19 UTC (rev 206814)
@@ -1,3 +1,42 @@
+2016-10-05  Romain Bellessort  <romain.belless...@crf.canon.fr>
+
+        [Readable Streams API] Align function names with spec
+        https://bugs.webkit.org/show_bug.cgi?id=162967
+
+        Reviewed by Darin Adler.
+
+        Align function names with spec. Behaviour was already in line with spec, but previous function names had
+        sometimes been preserved to track the changes more easily. This led to some inconsistencies (for instance,
+        enqueueInReadableStream was still used even though it works on a controller instead of a stream) and it
+        also made it more difficult to compare spec and implementation.
+
+        No change in behaviour.
+
+        * Modules/fetch/FetchInternals.js:
+        (consumeStream): Updated with new function names.
+        * Modules/fetch/FetchResponse.js:
+        (clone): Updated with new function names.
+        * Modules/streams/ReadableStream.js:
+        (tee): Updated with new function names.
+        * Modules/streams/ReadableStreamDefaultController.js:
+        (enqueue): Updated with new function names.
+        (error): Updated with new function names.
+        * Modules/streams/ReadableStreamDefaultReader.js:
+        (read): Updated with new function names.
+        * Modules/streams/ReadableStreamInternals.js:
+        (privateInitializeReadableStreamDefaultController): Updated with new function names.
+        (readableStreamDefaultControllerError): Updated with new function names.
+        (readableStreamTee): Updated with new function names.
+        (readableStreamTeePullFunction): Updated with new function names.
+        (readableStreamTeeBranch2CancelFunction): Updated with new function names.
+        (readableStreamError): Updated with new function names.
+        (readableStreamCancel): Updated with new function names.
+        (readableStreamDefaultControllerPull): Updated with new function names.
+        (readableStreamDefaultControllerClose): Updated with new function names.
+        (readableStreamClose): Updated with new function names.
+        (readableStreamDefaultControllerEnqueue): Updated with new function names.
+        (readableStreamDefaultReaderRead): Updated with new function names.
+
 2016-10-05  Chris Dumez  <cdu...@apple.com>
 
         [Bindings] Declare dictionary / enumeration template specializations in the header

Modified: trunk/Source/WebCore/Modules/fetch/FetchInternals.js (206813 => 206814)


--- trunk/Source/WebCore/Modules/fetch/FetchInternals.js	2016-10-05 16:29:37 UTC (rev 206813)
+++ trunk/Source/WebCore/Modules/fetch/FetchInternals.js	2016-10-05 16:46:19 UTC (rev 206814)
@@ -68,9 +68,9 @@
             if (result.done)
                 return @Response.prototype.@finishConsumingStream.@call(response);
             @Response.prototype.@consumeChunk.@call(response, result.value);
-            return @Promise.prototype.@then.@call(@readFromReadableStreamDefaultReader(reader), pull);
+            return @Promise.prototype.@then.@call(@readableStreamDefaultReaderRead(reader), pull);
         }
-        return @Promise.prototype.@then.@call(@readFromReadableStreamDefaultReader(reader), pull);
+        return @Promise.prototype.@then.@call(@readableStreamDefaultReaderRead(reader), pull);
     } catch(e) {
         return @Promise.@reject(e);
     }

Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.js (206813 => 206814)


--- trunk/Source/WebCore/Modules/fetch/FetchResponse.js	2016-10-05 16:29:37 UTC (rev 206813)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.js	2016-10-05 16:46:19 UTC (rev 206814)
@@ -107,7 +107,7 @@
     }
 
     if (this.@body) {
-        var teedReadableStreams = @teeReadableStream(this.@body, true);
+        var teedReadableStreams = @readableStreamTee(this.@body, true);
         this.@body = teedReadableStreams[0];
         cloned.@body = teedReadableStreams[1];
     }

Modified: trunk/Source/WebCore/Modules/streams/ReadableStream.js (206813 => 206814)


--- trunk/Source/WebCore/Modules/streams/ReadableStream.js	2016-10-05 16:29:37 UTC (rev 206813)
+++ trunk/Source/WebCore/Modules/streams/ReadableStream.js	2016-10-05 16:46:19 UTC (rev 206814)
@@ -206,7 +206,7 @@
     if (!@isReadableStream(this))
         throw @makeThisTypeError("ReadableStream", "tee");
 
-    return @teeReadableStream(this, false);
+    return @readableStreamTee(this, false);
 }
 
 function locked()

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultController.js (206813 => 206814)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultController.js	2016-10-05 16:29:37 UTC (rev 206813)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultController.js	2016-10-05 16:46:19 UTC (rev 206814)
@@ -38,7 +38,7 @@
     if (this.@controlledReadableStream.@state !== @streamReadable)
         throw new @TypeError("ReadableStream is not readable");
 
-    return @enqueueInReadableStream(this, chunk);
+    return @readableStreamDefaultControllerEnqueue(this, chunk);
 }
 
 function error(error)
@@ -52,7 +52,7 @@
     if (stream.@state !== @streamReadable)
         throw new @TypeError("ReadableStream is not readable");
 
-    @errorReadableStream(stream, error);
+    @readableStreamError(stream, error);
 }
 
 function close()

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js (206813 => 206814)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js	2016-10-05 16:29:37 UTC (rev 206813)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js	2016-10-05 16:46:19 UTC (rev 206814)
@@ -47,7 +47,7 @@
     if (!this.@ownerReadableStream)
         return @Promise.@reject(new @TypeError("read() called on a reader owned by no readable stream"));
 
-    return @readFromReadableStreamDefaultReader(this);
+    return @readableStreamDefaultReaderRead(this);
 }
 
 function releaseLock()

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (206813 => 206814)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2016-10-05 16:29:37 UTC (rev 206813)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2016-10-05 16:46:19 UTC (rev 206814)
@@ -76,7 +76,7 @@
     const controller = this;
     const startResult = @promiseInvokeOrNoopNoCatch(underlyingSource, "start", [this]).@then(() => {
         controller.@started = true;
-        @requestReadableStreamPull(controller);
+        @readableStreamDefaultControllerCallPullIfNeeded(controller);
     }, (error) => {
         if (stream.@state === @streamReadable)
             @readableStreamDefaultControllerError(controller, error);
@@ -96,10 +96,10 @@
     const stream = controller.@controlledReadableStream;
     @assert(stream.@state === @streamReadable);
     controller.@queue = @newQueue();
-    @errorReadableStream(stream, error);
+    @readableStreamError(stream, error);
 }
 
-function teeReadableStream(stream, shouldClone)
+function readableStreamTee(stream, shouldClone)
 {
     "use strict";
 
@@ -118,15 +118,15 @@
 
     teeState.cancelPromiseCapability = @newPromiseCapability(@InternalPromise);
 
-    const pullFunction = @teeReadableStreamPullFunction(teeState, reader, shouldClone);
+    const pullFunction = @readableStreamTeePullFunction(teeState, reader, shouldClone);
 
     const branch1 = new @ReadableStream({
         "pull": pullFunction,
-        "cancel": @teeReadableStreamBranch1CancelFunction(teeState, stream)
+        "cancel": @readableStreamTeeBranch1CancelFunction(teeState, stream)
     });
     const branch2 = new @ReadableStream({
         "pull": pullFunction,
-        "cancel": @teeReadableStreamBranch2CancelFunction(teeState, stream)
+        "cancel": @readableStreamTeeBranch2CancelFunction(teeState, stream)
     });
 
     reader.@closedPromiseCapability.@promise.@then(@undefined, function(e) {
@@ -160,12 +160,12 @@
     throw new @TypeError("structuredClone not implemented for: " + object);
 }
 
-function teeReadableStreamPullFunction(teeState, reader, shouldClone)
+function readableStreamTeePullFunction(teeState, reader, shouldClone)
 {
     "use strict";
 
     return function() {
-        @Promise.prototype.@then.@call(@readFromReadableStreamDefaultReader(reader), function(result) {
+        @Promise.prototype.@then.@call(@readableStreamDefaultReaderRead(reader), function(result) {
             @assert(@isObject(result));
             @assert(typeof result.done === "boolean");
             if (result.done && !teeState.closedOrErrored) {
@@ -178,14 +178,14 @@
             if (teeState.closedOrErrored)
                 return;
             if (!teeState.canceled1)
-                @enqueueInReadableStream(teeState.branch1.@readableStreamController, shouldClone ? @doStructuredClone(result.value) : result.value);
+                @readableStreamDefaultControllerEnqueue(teeState.branch1.@readableStreamController, shouldClone ? @doStructuredClone(result.value) : result.value);
             if (!teeState.canceled2)
-                @enqueueInReadableStream(teeState.branch2.@readableStreamController, shouldClone ? @doStructuredClone(result.value) : result.value);
+                @readableStreamDefaultControllerEnqueue(teeState.branch2.@readableStreamController, shouldClone ? @doStructuredClone(result.value) : result.value);
         });
     }
 }
 
-function teeReadableStreamBranch1CancelFunction(teeState, stream)
+function readableStreamTeeBranch1CancelFunction(teeState, stream)
 {
     "use strict";
 
@@ -201,7 +201,7 @@
     }
 }
 
-function teeReadableStreamBranch2CancelFunction(teeState, stream)
+function readableStreamTeeBranch2CancelFunction(teeState, stream)
 {
     "use strict";
 
@@ -248,7 +248,7 @@
     return @isObject(controller) && !!controller.@underlyingSource;
 }
 
-function errorReadableStream(stream, error)
+function readableStreamError(stream, error)
 {
     "use strict";
 
@@ -274,7 +274,7 @@
     reader.@closedPromiseCapability.@reject.@call(@undefined, error);
 }
 
-function requestReadableStreamPull(controller)
+function readableStreamDefaultControllerCallPullIfNeeded(controller)
 {
     "use strict";
 
@@ -300,7 +300,7 @@
         controller.@pulling = false;
         if (controller.@pullAgain) {
             controller.@pullAgain = false;
-            @requestReadableStreamPull(controller);
+            @readableStreamDefaultControllerCallPullIfNeeded(controller);
         }
     }, function(error) {
         if (stream.@state === @streamReadable)
@@ -332,7 +332,7 @@
         return @Promise.@resolve();
     if (stream.@state === @streamErrored)
         return @Promise.@reject(stream.@storedError);
-    @closeReadableStream(stream);
+    @readableStreamClose(stream);
     return stream.@readableStreamController.@cancel(stream.@readableStreamController, reason).@then(function() {  });
 }
 
@@ -352,13 +352,13 @@
     if (controller.@queue.content.length) {
         const chunk = @dequeueValue(controller.@queue);
         if (controller.@closeRequested && controller.@queue.content.length === 0)
-            @closeReadableStream(stream);
+            @readableStreamClose(stream);
         else
-            @requestReadableStreamPull(controller);
+            @readableStreamDefaultControllerCallPullIfNeeded(controller);
         return @Promise.@resolve({value: chunk, done: false});
     }
     const pendingPromise = @readableStreamAddReadRequest(stream);
-    @requestReadableStreamPull(controller);
+    @readableStreamDefaultControllerCallPullIfNeeded(controller);
     return pendingPromise;
 }
 
@@ -371,10 +371,10 @@
     @assert(stream.@state === @streamReadable);
     controller.@closeRequested = true;
     if (controller.@queue.content.length === 0)
-        @closeReadableStream(stream);
+        @readableStreamClose(stream);
 }
 
-function closeReadableStream(stream)
+function readableStreamClose(stream)
 {
     "use strict";
 
@@ -395,7 +395,7 @@
     reader.@closedPromiseCapability.@resolve.@call();
 }
 
-function enqueueInReadableStream(controller, chunk)
+function readableStreamDefaultControllerEnqueue(controller, chunk)
 {
     "use strict";
 
@@ -405,7 +405,7 @@
 
     if (@isReadableStreamLocked(stream) && stream.@reader.@readRequests.length) {
         stream.@reader.@readRequests.@shift().@resolve.@call(@undefined, {value: chunk, done: false});
-        @requestReadableStreamPull(controller);
+        @readableStreamDefaultControllerCallPullIfNeeded(controller);
         return;
     }
 
@@ -420,10 +420,10 @@
             @readableStreamDefaultControllerError(controller, error);
         throw error;
     }
-    @requestReadableStreamPull(controller);
+    @readableStreamDefaultControllerCallPullIfNeeded(controller);
 }
 
-function readFromReadableStreamDefaultReader(reader)
+function readableStreamDefaultReaderRead(reader)
 {
     "use strict";
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to