Title: [191335] trunk/Source
Revision
191335
Author
calva...@igalia.com
Date
2015-10-20 02:51:09 -0700 (Tue, 20 Oct 2015)

Log Message

[Streams API] Rework some readable stream internals that can be common to writable streams
https://bugs.webkit.org/show_bug.cgi?id=150133

Reviewed by Darin Adler.

Source/_javascript_Core:

* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init): Added RangeError also as native functions.

Source/WebCore:

There are some things in ReadableStream internals that be be used also for Writable Streams so it was necessary
to move some functions and refactor some code that can be shared by both implementations.

Queue was written with the functions declared at the implementation and keeping the improvement of having the
total size calculated instead of having to transverse the whole array.

The strategy is kept as an object and a common method is used to validate it as per spec.

Promises are reworked to keep in an internal slot inside the promise object the resolve and reject
functions. For convinience three functions were written, one to create the promise (and keep internally the
resolve and reject functions), one to resolve and another to reject. Promises can still be created with
Promise.resolve or reject as the resolve and rejectStreamsPromise functions operate under the assumption that
the internal slots might not exist.

invokeOrNoop and promiseInvokeOrNoop were moved to the common code as they will be also used by WritableStream.

Current test set suffices.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/WebCoreJSBuiltinInternals.h:
* bindings/js/WebCoreJSBuiltins.cpp:
* bindings/js/WebCoreJSBuiltins.h: Build infrastructure.
* Modules/streams/ReadableStream.js:
(initializeReadableStream): Reworked queue and strategy.
* Modules/streams/ReadableStreamInternals.js:
(privateInitializeReadableStreamReader):
(errorReadableStream):
(getReadableStreamDesiredSize):
(cancelReadableStream):
(closeReadableStream):
(closeReadableStreamReader):
(enqueueInReadableStream):
(readFromReadableStreamReader): Reworked queue, strategy and promises.
(invokeOrNoop): Deleted.
(promiseInvokeOrNoop): Deleted.
* Modules/streams/StreamInternals.js: Added.
(invokeOrNoop):
(promiseInvokeOrNoop): Moved from ReadableStreamInternals.js.
(validateAndNormalizeQueuingStrategy):
(createNewStreamsPromise):
(resolveStreamsPromise):
(rejectStreamsPromise):
(newQueue):
(dequeueValue):
(enqueueValueWithSize): Added according to the spec.
* bindings/js/WebCoreBuiltinNames.h: Updated private names according to the new slots.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (191334 => 191335)


--- trunk/Source/_javascript_Core/ChangeLog	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-10-20 09:51:09 UTC (rev 191335)
@@ -1,3 +1,14 @@
+2015-10-20  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        [Streams API] Rework some readable stream internals that can be common to writable streams
+        https://bugs.webkit.org/show_bug.cgi?id=150133
+
+        Reviewed by Darin Adler.
+
+        * runtime/CommonIdentifiers.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init): Added RangeError also as native functions.
+
 2015-10-20  Yoav Weiss  <y...@yoav.ws>
 
         Rename the PICTURE_SIZES flag to CURRENTSRC

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (191334 => 191335)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2015-10-20 09:51:09 UTC (rev 191335)
@@ -291,6 +291,7 @@
     macro(isFinite) \
     macro(getPrototypeOf) \
     macro(getOwnPropertyNames) \
+    macro(RangeError) \
     macro(TypeError) \
     macro(typedArrayLength) \
     macro(typedArraySort) \

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (191334 => 191335)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2015-10-20 09:51:09 UTC (rev 191335)
@@ -516,6 +516,7 @@
         GlobalPropertyInfo(vm.propertyNames->ownEnumerablePropertyKeysPrivateName, JSFunction::create(vm, this, 0, String(), ownEnumerablePropertyKeys), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->getTemplateObjectPrivateName, privateFuncGetTemplateObject, DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->enqueueJobPrivateName, JSFunction::create(vm, this, 0, String(), enqueueJob), DontEnum | DontDelete | ReadOnly),
+        GlobalPropertyInfo(vm.propertyNames->RangeErrorPrivateName, m_rangeErrorConstructor.get(), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->TypeErrorPrivateName, m_typeErrorConstructor.get(), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->typedArrayLengthPrivateName, privateFuncTypedArrayLength, DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->typedArraySortPrivateName, privateFuncTypedArraySort, DontEnum | DontDelete | ReadOnly),

Modified: trunk/Source/WebCore/CMakeLists.txt (191334 => 191335)


--- trunk/Source/WebCore/CMakeLists.txt	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-10-20 09:51:09 UTC (rev 191335)
@@ -3369,6 +3369,7 @@
     ${WEBCORE_DIR}/Modules/streams/ReadableStreamController.js
     ${WEBCORE_DIR}/Modules/streams/ReadableStreamInternals.js
     ${WEBCORE_DIR}/Modules/streams/ReadableStreamReader.js
+    ${WEBCORE_DIR}/Modules/streams/StreamInternals.js
     ${WEBCORE_DIR}/Modules/streams/WritableStream.js
 )
 

Modified: trunk/Source/WebCore/ChangeLog (191334 => 191335)


--- trunk/Source/WebCore/ChangeLog	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/ChangeLog	2015-10-20 09:51:09 UTC (rev 191335)
@@ -1,3 +1,60 @@
+2015-10-20  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        [Streams API] Rework some readable stream internals that can be common to writable streams
+        https://bugs.webkit.org/show_bug.cgi?id=150133
+
+        Reviewed by Darin Adler.
+
+        There are some things in ReadableStream internals that be be used also for Writable Streams so it was necessary
+        to move some functions and refactor some code that can be shared by both implementations.
+
+        Queue was written with the functions declared at the implementation and keeping the improvement of having the
+        total size calculated instead of having to transverse the whole array.
+
+        The strategy is kept as an object and a common method is used to validate it as per spec.
+
+        Promises are reworked to keep in an internal slot inside the promise object the resolve and reject
+        functions. For convinience three functions were written, one to create the promise (and keep internally the
+        resolve and reject functions), one to resolve and another to reject. Promises can still be created with
+        Promise.resolve or reject as the resolve and rejectStreamsPromise functions operate under the assumption that
+        the internal slots might not exist.
+
+        invokeOrNoop and promiseInvokeOrNoop were moved to the common code as they will be also used by WritableStream.
+
+        Current test set suffices.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMWindowBase.cpp:
+        * bindings/js/WebCoreJSBuiltinInternals.h:
+        * bindings/js/WebCoreJSBuiltins.cpp:
+        * bindings/js/WebCoreJSBuiltins.h: Build infrastructure.
+        * Modules/streams/ReadableStream.js:
+        (initializeReadableStream): Reworked queue and strategy.
+        * Modules/streams/ReadableStreamInternals.js:
+        (privateInitializeReadableStreamReader):
+        (errorReadableStream):
+        (getReadableStreamDesiredSize):
+        (cancelReadableStream):
+        (closeReadableStream):
+        (closeReadableStreamReader):
+        (enqueueInReadableStream):
+        (readFromReadableStreamReader): Reworked queue, strategy and promises.
+        (invokeOrNoop): Deleted.
+        (promiseInvokeOrNoop): Deleted.
+        * Modules/streams/StreamInternals.js: Added.
+        (invokeOrNoop):
+        (promiseInvokeOrNoop): Moved from ReadableStreamInternals.js.
+        (validateAndNormalizeQueuingStrategy):
+        (createNewStreamsPromise):
+        (resolveStreamsPromise):
+        (rejectStreamsPromise):
+        (newQueue):
+        (dequeueValue):
+        (enqueueValueWithSize): Added according to the spec.
+        * bindings/js/WebCoreBuiltinNames.h: Updated private names according to the new slots.
+
 2015-10-20  Yoav Weiss  <y...@yoav.ws>
 
         Rename the PICTURE_SIZES flag to CURRENTSRC

Modified: trunk/Source/WebCore/DerivedSources.make (191334 => 191335)


--- trunk/Source/WebCore/DerivedSources.make	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/DerivedSources.make	2015-10-20 09:51:09 UTC (rev 191335)
@@ -1264,6 +1264,7 @@
     $(WebCore)/Modules/streams/ReadableStreamController.js \
     $(WebCore)/Modules/streams/ReadableStreamInternals.js \
     $(WebCore)/Modules/streams/ReadableStreamReader.js \
+    $(WebCore)/Modules/streams/StreamInternals.js \
     $(WebCore)/Modules/streams/WritableStream.js \
 #
 

Modified: trunk/Source/WebCore/Modules/streams/ReadableStream.js (191334 => 191335)


--- trunk/Source/WebCore/Modules/streams/ReadableStream.js	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/Modules/streams/ReadableStream.js	2015-10-20 09:51:09 UTC (rev 191335)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2015 Canon Inc.
+ * Copyright (C) 2015 Igalia.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -42,8 +43,7 @@
 
     this.@underlyingSource = underlyingSource;
 
-    this.@queue = [];
-    this.@queueSize = 0;
+    this.@queue = @newQueue();
     this.@state = @readableStreamReadable;
     this.@started = false;
     this.@closeRequested = false;
@@ -52,14 +52,8 @@
     this.@reader = undefined;
     this.@storedError = undefined;
     this.@controller = new @ReadableStreamController(this);
-    this.@strategySize = strategy.size;
-    this.@highWaterMark = Number(strategy.highWaterMark);
+    this.@strategy = @validateAndNormalizeQueuingStrategy(strategy.size, strategy.highWaterMark);
 
-    if (Number.isNaN(this.@highWaterMark))
-        throw new TypeError("highWaterMark parameter is not correct");
-    if (this.@highWaterMark < 0)
-        throw new RangeError("highWaterMark is negative");
-
     var result = @invokeOrNoop(underlyingSource, "start", [this.@controller]);
     var _this = this;
     Promise.resolve(result).then(function() {

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (191334 => 191335)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2015-10-20 09:51:09 UTC (rev 191335)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2015 Canon Inc. All rights reserved.
+ * Copyright (C) 2015 Igalia.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -41,10 +42,7 @@
         this.@ownerReadableStream = stream;
         this.@storedError = undefined;
         stream.@reader = this;
-        this.@closedPromise = new Promise(function(resolve, reject) {
-            stream.@reader.@closedPromiseResolve = resolve;
-            stream.@reader.@closedPromiseReject = reject;
-        });
+        this.@closedPromise = @createNewStreamsPromise();
         return this;
     }
     if (stream.@state === @readableStreamClosed) {
@@ -199,7 +197,7 @@
     "use strict";
 
     // TODO: ASSERT(stream.@state === @readableStreamReadable);
-    stream.@queue = [];
+    stream.@queue = @newQueue();
     stream.@storedError = error;
     stream.@state = @readableStreamErrored;
 
@@ -209,14 +207,14 @@
 
     var requests = reader.@readRequests;
     for (var index = 0, length = requests.length; index < length; ++index)
-        requests[index].reject(error);
+        @rejectStreamsPromise(requests[index], error);
     reader.@readRequests = [];
 
     @releaseReadableStreamReader(reader);
     reader.@storedError = error;
     reader.@state = @readableStreamErrored;
 
-    reader.@closedPromiseReject(error);
+    @rejectStreamsPromise(reader.@closedPromise, error);
 }
 
 function requestReadableStreamPull(stream)
@@ -262,7 +260,7 @@
 {
    "use strict";
 
-   return stream.@highWaterMark - stream.@queueSize;
+   return stream.@strategy.highWaterMark - stre...@queue.size;
 }
 
 function releaseReadableStreamReader(reader)
@@ -281,7 +279,7 @@
         return Promise.resolve();
     if (stream.@state === @readableStreamErrored)
         return Promise.reject(stream.@storedError);
-    stream.@queue = [];
+    stream.@queue = @newQueue();
     @finishClosingReadableStream(stream);
     return @promiseInvokeOrNoop(stream.@underlyingSource, "cancel", [reason]).then(function() { });
 }
@@ -306,7 +304,7 @@
     if (stream.@state === @readableStreamClosed)
         return; 
     stream.@closeRequested = true;
-    if (!stream.@queue.length)
+    if (!stream.@queue.content.length)
         @finishClosingReadableStream(stream);
 }
 
@@ -316,11 +314,11 @@
 
     var requests = reader.@readRequests;
     for (var index = 0, length = requests.length; index < length; ++index)
-        requests[index].resolve({value:undefined, done: true});
+        @resolveStreamsPromise(requests[index], {value:undefined, done: true});
     reader.@readRequests = [];
     @releaseReadableStreamReader(reader);
     reader.@state = @readableStreamClosed;
-    reader.@closedPromiseResolve();
+    @resolveStreamsPromise(reader.@closedPromise);
 }
 
 function enqueueInReadableStream(stream, chunk)
@@ -332,19 +330,18 @@
     if (stream.@state === @readableStreamClosed)
         return undefined;
     if (@isReadableStreamLocked(stream) && stream.@reader.@readRequests.length) {
-        stream.@reader.@readRequests.shift().resolve({value: chunk, done: false});
+        @resolveStreamsPromise(stream.@reader.@readRequests.shift(), {value: chunk, done: false});
         @requestReadableStreamPull(stream);
         return;
     }
     try {
         var size = 1;
-        if (stream.@strategySize) {
-            size = Number(stream.@strategySize(chunk));
+        if (stre...@strategy.size) {
+            size = Number(stre...@strategy.size(chunk));
             if (Number.isNaN(size) || size === +Infinity || size < 0)
                 throw new RangeError("Chunk size is not valid");
         }
-        stre...@queue.push({ value: chunk, size: size });
-        stream.@queueSize += size;
+        @enqueueValueWithSize(stream.@queue, chunk, size);
     }
     catch(error) {
         @errorReadableStream(stream, error);
@@ -364,47 +361,16 @@
     // TODO: ASSERT(!!reader.@ownerReadableStream);
     // TODO: ASSERT(reader.@ownerReadableStream.@state === @readableStreamReadable);
     var stream = reader.@ownerReadableStream;
-    if (stream.@queue.length) {
-        var chunk = stream.@queue.shift();
-        stream.@queueSize -= chunk.size;
+    if (stream.@queue.content.length) {
+        var chunk = @dequeueValue(stream.@queue);
         if (!stream.@closeRequested)
             @requestReadableStreamPull(stream);
-        else if (!stream.@queue.length)
+        else if (!stream.@queue.content.length)
             @finishClosingReadableStream(stream);
-        return Promise.resolve({value: chunk.value, done: false});
+        return Promise.resolve({value: chunk, done: false});
     }
-    var readRequest = {};
-    var readPromise = new Promise(function(resolve, reject) {
-        readRequest.resolve = resolve;
-        readRequest.reject = reject;
-    });
-    read...@readrequests.push(readRequest);
+    var readPromise = @createNewStreamsPromise();
+    read...@readrequests.push(readPromise);
     @requestReadableStreamPull(stream);
     return readPromise;
 }
-
-function invokeOrNoop(object, key, args)
-{
-    "use strict";
-
-    var method = object[key];
-    if (typeof method === "undefined")
-        return;
-    return method.@apply(object, args);
-}
-
-function promiseInvokeOrNoop(object, key, args)
-{
-    "use strict";
-
-    try {
-        var method = object[key];
-        if (typeof method === "undefined")
-            return Promise.resolve();
-        var result = method.@apply(object, args);
-        return Promise.resolve(result);
-    }
-    catch(error) {
-        return Promise.reject(error);
-    }
-}

Added: trunk/Source/WebCore/Modules/streams/StreamInternals.js (0 => 191335)


--- trunk/Source/WebCore/Modules/streams/StreamInternals.js	                        (rev 0)
+++ trunk/Source/WebCore/Modules/streams/StreamInternals.js	2015-10-20 09:51:09 UTC (rev 191335)
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2015 Canon Inc.
+ * Copyright (C) 2015 Igalia.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @optional=STREAMS_API
+// @internals
+
+function invokeOrNoop(object, key, args)
+{
+    "use strict";
+
+    var method = object[key];
+    if (typeof method === "undefined")
+        return;
+    return method.@apply(object, args);
+}
+
+function promiseInvokeOrNoop(object, key, args)
+{
+    "use strict";
+
+    try {
+        var method = object[key];
+        if (typeof method === "undefined")
+            return Promise.resolve();
+        var result = method.@apply(object, args);
+        return Promise.resolve(result);
+    }
+    catch(error) {
+        return Promise.reject(error);
+    }
+
+}
+
+function validateAndNormalizeQueuingStrategy(size, highWaterMark)
+{
+    "use strict";
+
+    if (size !== undefined && typeof size !== "function")
+        throw new @TypeError("size parameter must be a function");
+
+    var normalizedStrategy = { };
+
+    normalizedStrategy.size = size;
+    normalizedStrategy.highWaterMark = Number(highWaterMark);
+
+    if (Number.isNaN(normalizedStrategy.highWaterMark))
+        throw new @TypeError("highWaterMark parameter is not a number");
+    if (normalizedStrategy.highWaterMark < 0)
+        throw new @RangeError("highWaterMark is negative");
+
+    return normalizedStrategy;
+}
+
+function createNewStreamsPromise()
+{
+    "use strict";
+
+    var resolveFunction;
+    var rejectFunction;
+    var promise = new Promise(function(resolve, reject) {
+        resolveFunction = resolve;
+        rejectFunction = reject;
+    });
+    promise.@resolve = resolveFunction;
+    promise.@reject = rejectFunction;
+    return promise;
+}
+
+function resolveStreamsPromise(promise, value)
+{
+    "use strict";
+
+    if (promise && promise.@resolve) {
+        promise.@resolve(value);
+        promise.@resolve = undefined;
+        promise.@reject = undefined;
+    }
+}
+
+function rejectStreamsPromise(promise, value)
+{
+    "use strict";
+
+    if (promise && promise.@reject) {
+        promise.@reject(value);
+        promise.@resolve = undefined;
+        promise.@reject = undefined;
+    }
+}
+
+function newQueue()
+{
+    return { content: [], size: 0 };
+}
+
+function dequeueValue(queue)
+{
+    "use strict";
+
+    var record = queue.content.shift();
+    queue.size -= record.size;
+    return record.value;
+}
+
+function enqueueValueWithSize(queue, value, size)
+{
+    size = Number(size);
+    if (Number.isNaN(size) || !Number.isFinite(size) || size < 0)
+        throw new @RangeError("size has an incorrect value");
+    queue.content.push({ value: value, size: size });
+    queue.size += size;
+
+    return undefined;
+}

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (191334 => 191335)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-20 09:51:09 UTC (rev 191335)
@@ -1515,6 +1515,8 @@
 		4162A4571011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A4551011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp */; };
 		4162A4581011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A4561011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h */; };
 		416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; };
+		416E6FE81BBD12DF000A6033 /* StreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		416E6FEA1BBD1684000A6034 /* StreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764CA /* StreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		416E6FE91BBD12E5000A6043 /* ReadableStreamBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		416E6FEA1BBD1684000A6044 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764DA /* ReadableStreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11360,6 +11362,8 @@
 		9908B0EC1BCACF1F00ED0F65 /* generate-js-builtins */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-js-builtins"; sourceTree = "<group>"; };
 		9908B0ED1BCACF9100ED0F65 /* ByteLengthQueuingStrategy.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = ByteLengthQueuingStrategy.js; sourceTree = "<group>"; };
 		9908B0EE1BCACF9100ED0F65 /* CountQueuingStrategy.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = CountQueuingStrategy.js; sourceTree = "<group>"; };
+		9908B0F11BCACF9100ED0F55 /* StreamInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = StreamInternals.js; sourceTree = "<group>"; };
+		9908B0FD1BCAD07D00ED0F55 /* StreamInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamInternalsBuiltins.cpp; sourceTree = "<group>"; };
 		9908B0EF1BCACF9100ED0F65 /* ReadableStream.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = ReadableStream.js; sourceTree = "<group>"; };
 		9908B0F01BCACF9100ED0F65 /* ReadableStreamController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = ReadableStreamController.js; sourceTree = "<group>"; };
 		9908B0F11BCACF9100ED0F65 /* ReadableStreamInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = ReadableStreamInternals.js; sourceTree = "<group>"; };
@@ -11416,6 +11420,8 @@
 		9A528E8217D7F52F00AA9518 /* FloatingObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingObjects.h; sourceTree = "<group>"; };
 		9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToLengthConversionData.h; sourceTree = "<group>"; };
 		9AB1F37F18E2489A00534743 /* CSSToLengthConversionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSToLengthConversionData.cpp; sourceTree = "<group>"; };
+		9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamInternalsBuiltins.h; sourceTree = "<group>"; };
+		9B03D8071BB3110D00B764CA /* StreamInternalsBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamInternalsBuiltinsWrapper.h; sourceTree = "<group>"; };
 		9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltins.h; sourceTree = "<group>"; };
 		9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltins.h; sourceTree = "<group>"; };
 		9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltinsWrapper.h; sourceTree = "<group>"; };
@@ -16392,6 +16398,7 @@
 				4129DF821BB5B7A600322A16 /* ReadableStreamReader.h */,
 				419FAFAD1ABABCD5005B828B /* ReadableStreamReader.idl */,
 				9908B0F21BCACF9100ED0F65 /* ReadableStreamReader.js */,
+				9908B0F11BCACF9100ED0F55 /* StreamInternals.js */,
 				41A023ED1A39DB7900F722DF /* WritableStream.idl */,
 				9908B0EF1BCACF9100ED0F75 /* WritableStream.js */,
 
@@ -17231,6 +17238,9 @@
 				26AA0F9D18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp */,
 				26AA0F9F18D2A1C100419381 /* SelectorPseudoElementTypeMap.gperf */,
 				53EF766A16530A61004CBE49 /* SettingsMacros.h */,
+				9908B0FD1BCAD07D00ED0F55 /* StreamInternalsBuiltins.cpp */,
+				9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */,
+				9B03D8071BB3110D00B764CA /* StreamInternalsBuiltinsWrapper.h */,
 				8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */,
 				83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */,
 				83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */,
@@ -27300,6 +27310,8 @@
 				51E0BB380DA5ACB600A9E417 /* StorageMap.h in Headers */,
 				C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */,
 				1A37636C1A2E68BB009A7EE2 /* StorageNamespaceProvider.h in Headers */,
+				416E6FE81BBD12DF000A6033 /* StreamInternalsBuiltins.h in Headers */,
+				416E6FEA1BBD1684000A6034 /* StreamInternalsBuiltinsWrapper.h in Headers */,
 				81AC6C36131C57D30009A7E0 /* StringCallback.h in Headers */,
 				B23540F30D00782E002382FA /* StringTruncator.h in Headers */,
 				9B6C41531344949000085B62 /* StringWithDirection.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (191334 => 191335)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2015-10-20 09:51:09 UTC (rev 191335)
@@ -50,6 +50,7 @@
 #if ENABLE(STREAMS_API)
 #include "JSReadableStreamPrivateConstructors.h"
 #include "ReadableStreamInternalsBuiltins.h"
+#include "StreamInternalsBuiltins.h"
 #endif
 
 using namespace JSC;
@@ -96,6 +97,12 @@
             m_privateFunctions.readableStreamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
         WEBCOREREADABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
 #undef DECLARE_GLOBAL_STATIC
+#define DECLARE_GLOBAL_STATIC(name)\
+        GlobalPropertyInfo(\
+            static_cast<JSVMClientData*>(vm.clientData)->builtinFunctions().streamInternalsBuiltins().name##PrivateName(), \
+            m_privateFunctions.streamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
+        WEBCORESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
+#undef DECLARE_GLOBAL_STATIC
 #endif
     };
 

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (191334 => 191335)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2015-10-20 09:51:09 UTC (rev 191335)
@@ -34,17 +34,13 @@
 #define WEBCORE_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro)\
     macro(closeRequested) \
     macro(closedPromise) \
-    macro(closedPromiseResolve) \
-    macro(closedPromiseReject) \
     macro(controlledReadableStream) \
     macro(controller) \
     macro(getUserMediaFromJS) \
-    macro(highWaterMark) \
     macro(ownerReadableStream) \
     macro(pulling) \
     macro(pullAgain) \
     macro(queue) \
-    macro(queueSize) \
     macro(readableStreamClosed) \
     macro(readableStreamErrored) \
     macro(readableStreamReadable) \
@@ -53,7 +49,7 @@
     macro(state) \
     macro(started) \
     macro(storedError) \
-    macro(strategySize) \
+    macro(strategy) \
     macro(underlyingSource) \
     macro(ReadableStreamReader) \
     macro(ReadableStreamController) \

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSBuiltinInternals.h (191334 => 191335)


--- trunk/Source/WebCore/bindings/js/WebCoreJSBuiltinInternals.h	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSBuiltinInternals.h	2015-10-20 09:51:09 UTC (rev 191335)
@@ -29,6 +29,7 @@
 
 #if ENABLE(STREAMS_API)
 #include "ReadableStreamInternalsBuiltinsWrapper.h"
+#include "StreamInternalsBuiltinsWrapper.h"
 #endif
 
 namespace WebCore {
@@ -39,15 +40,18 @@
         : vm(v)
 #if ENABLE(STREAMS_API)
         , m_readableStreamInternalsFunctions(vm)
+        , m_streamInternalsFunctions(vm)
 #endif
     { }
 
 #if ENABLE(STREAMS_API)
     ReadableStreamInternalsBuiltinFunctions readableStreamInternals() { return m_readableStreamInternalsFunctions; }
+    StreamInternalsBuiltinFunctions streamInternals() { return m_streamInternalsFunctions; }
 #endif
     void visit(JSC::SlotVisitor& visitor) {
 #if ENABLE(STREAMS_API)
         m_readableStreamInternalsFunctions.visit(visitor);
+        m_streamInternalsFunctions.visit(visitor);
 #else
         UNUSED_PARAM(visitor);
 #endif
@@ -55,6 +59,7 @@
     void init(JSC::JSGlobalObject& globalObject) {
 #if ENABLE(STREAMS_API)
         m_readableStreamInternalsFunctions.init(globalObject);
+        m_streamInternalsFunctions.init(globalObject);
 #else
         UNUSED_PARAM(globalObject);
 #endif
@@ -63,7 +68,8 @@
 private:
     JSC::VM& vm;
 #if ENABLE(STREAMS_API)
-     ReadableStreamInternalsBuiltinFunctions m_readableStreamInternalsFunctions;
+    ReadableStreamInternalsBuiltinFunctions m_readableStreamInternalsFunctions;
+    StreamInternalsBuiltinFunctions m_streamInternalsFunctions;
 #endif
 
 };

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp (191334 => 191335)


--- trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp	2015-10-20 09:51:09 UTC (rev 191335)
@@ -37,5 +37,6 @@
 #include "ReadableStreamControllerBuiltins.cpp"
 #include "ReadableStreamInternalsBuiltins.cpp"
 #include "ReadableStreamReaderBuiltins.cpp"
+#include "StreamInternalsBuiltins.cpp"
 #include "WritableStreamBuiltins.cpp"
 #endif

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.h (191334 => 191335)


--- trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.h	2015-10-20 09:49:46 UTC (rev 191334)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.h	2015-10-20 09:51:09 UTC (rev 191335)
@@ -38,6 +38,7 @@
 #include "ReadableStreamControllerBuiltinsWrapper.h"
 #include "ReadableStreamInternalsBuiltinsWrapper.h"
 #include "ReadableStreamReaderBuiltinsWrapper.h"
+#include "StreamInternalsBuiltinsWrapper.h"
 #include "WritableStreamBuiltinsWrapper.h"
 #endif
 
@@ -56,6 +57,7 @@
         , m_readableStreamControllerBuiltins(&vm)
         , m_readableStreamInternalsBuiltins(&vm)
         , m_readableStreamReaderBuiltins(&vm)
+        , m_streamInternalsBuiltins(&vm)
         , m_writableStreamBuiltins(&vm)
 #endif
 #if ENABLE(MEDIA_STREAM)
@@ -64,6 +66,7 @@
     {
 #if ENABLE(STREAMS_API)
         m_readableStreamInternalsBuiltins.exportNames();
+        m_streamInternalsBuiltins.exportNames();
 #endif
     }
 #if ENABLE(STREAMS_API)
@@ -73,6 +76,7 @@
     ReadableStreamControllerBuiltinsWrapper& readableStreamControllerBuiltins() { return m_readableStreamControllerBuiltins; }
     ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins; }
     ReadableStreamReaderBuiltinsWrapper& readableStreamReaderBuiltins() { return m_readableStreamReaderBuiltins; }
+    StreamInternalsBuiltinsWrapper& streamInternalsBuiltins() { return m_streamInternalsBuiltins; }
     WritableStreamBuiltinsWrapper& writableStreamBuiltins() { return m_writableStreamBuiltins; }
 #endif
 #if ENABLE(MEDIA_STREAM)
@@ -88,6 +92,7 @@
     ReadableStreamControllerBuiltinsWrapper m_readableStreamControllerBuiltins;
     ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins;
     ReadableStreamReaderBuiltinsWrapper m_readableStreamReaderBuiltins;
+    StreamInternalsBuiltinsWrapper m_streamInternalsBuiltins;
     WritableStreamBuiltinsWrapper m_writableStreamBuiltins;
 #endif
 #if ENABLE(MEDIA_STREAM)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to