Title: [190401] trunk
Revision
190401
Author
youenn.fab...@crf.canon.fr
Date
2015-10-01 05:30:43 -0700 (Thu, 01 Oct 2015)

Log Message

[Streams API] Add support for private WebCore JS builtins functions
https://bugs.webkit.org/show_bug.cgi?id=149518

Reviewed by Darin Adler.

Source/_javascript_Core:

Adding API to add private identifiers on the fly.
This is used to support private JS Builtin functions/private JS Builtin names in WebCore.

* builtins/BuiltinNames.h:
(JSC::BuiltinNames::appendExternalName):
* runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::appendExternalName):
* runtime/CommonIdentifiers.h:

Source/WebCore:

Using ReadableStream tee method as a testbed to add support for private WebCore JS builtins functions.
Private functions are hooked to JSDOMWindowBase, as it is the one connected to WebCoreClientData.
WebCoreClientData is responsible to export the private function symbols to the VM.

Updated generate-js-builtins script to generate a class that can create and own all JS functions.
This class is used by JSDOMWindowBase to create the JS builtin functions.
It is also used to manage the GC of these objects.

Covered by rebased tests.

* CMakeLists.txt: Adding ReadableStreamInternals builtin files.
* DerivedSources.cpp: Ditto.
* DerivedSources.make: Ditto.
* Modules/streams/ReadableStream.idl: Adding tee declaration as builtin
* Modules/streams/ReadableStream.js:
(tee): Calling @teeReadableStream
* Modules/streams/ReadableStreamInternals.js: Barebone @teeReadableStream implementation.
(teeReadableStream):
* WebCore.vcxproj/WebCore.vcxproj: Adding ReadableStreamInternals builtin files.
* WebCore.xcodeproj/project.pbxproj: Adding ReadableStreamInternals builtin files.
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::JSDOMWindowBase): Creating ReadableStreamInternalsBuiltinFunctions object.
(WebCore::JSDOMWindowBase::finishCreation): Creating builtin functions through ReadableStreamInternalsBuiltinFunctions and registering them to the JS engine.
(WebCore::JSDOMWindowBase::visitChildren): Ensuring GC does not collect private builtin functions through ReadableStreamInternalsBuiltinFunctions object
* bindings/js/JSDOMWindowBase.h:
* bindings/js/WebCoreJSClientData.h:
(WebCore::WebCoreJSClientData::WebCoreJSClientData): Exporting private names of ReadableStreamInternalsBuiltins
(WebCore::WebCoreJSClientData::readableStreamBuiltins):
(WebCore::WebCoreJSClientData::readableStreamInternalsBuiltins):
* generate-js-builtins: Adding support for ReadableStreamInternalsBuiltinFunctions and exportNames.

LayoutTests:

Rebasing tests now that tee is appearing in the IDL, although not yet conformant in its implementation.

* streams/reference-implementation/readable-stream-expected.txt:
* streams/reference-implementation/readable-stream-tee-expected.txt:
* streams/reference-implementation/readable-stream-templated-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (190400 => 190401)


--- trunk/LayoutTests/ChangeLog	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/LayoutTests/ChangeLog	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1,3 +1,16 @@
+2015-10-01  Youenn Fablet  <youenn.fab...@crf.canon.fr>
+
+        [Streams API] Add support for private WebCore JS builtins functions
+        https://bugs.webkit.org/show_bug.cgi?id=149518
+
+        Reviewed by Darin Adler.
+
+        Rebasing tests now that tee is appearing in the IDL, although not yet conformant in its implementation.
+
+        * streams/reference-implementation/readable-stream-expected.txt:
+        * streams/reference-implementation/readable-stream-tee-expected.txt:
+        * streams/reference-implementation/readable-stream-templated-expected.txt:
+
 2015-10-01  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [Streams API] Update readable-stream tests against latest reference

Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt (190400 => 190401)


--- trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1,7 +1,7 @@
 
 PASS ReadableStream can be constructed with no errors 
 PASS ReadableStream can't be constructed with garbage 
-FAIL ReadableStream instances should have the correct list of properties assert_array_equals: should have all the correct methods lengths differ, expected 7 got 6
+FAIL ReadableStream instances should have the correct list of properties assert_false: method should be non-enumerable expected false got true
 PASS ReadableStream constructor should throw for non-function start arguments 
 PASS ReadableStream constructor can get initial garbage as cancel argument 
 PASS ReadableStream constructor can get initial garbage as pull argument 

Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-tee-expected.txt (190400 => 190401)


--- trunk/LayoutTests/streams/reference-implementation/readable-stream-tee-expected.txt	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-tee-expected.txt	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1,12 +1,12 @@
 
-FAIL ReadableStream teeing: rs.tee() returns an array of two ReadableStreams rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: should be able to read one branch to the end without affecting the other rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: values should be equal across each branch rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: errors in the source should propagate to both branches rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: canceling branch1 should not impact branch2 rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: canceling branch2 should not impact branch1 rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: closing the original should immediately close the branches rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
-FAIL ReadableStream teeing: erroring the original should immediately error the branches rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
+FAIL ReadableStream teeing: rs.tee() returns an array of two ReadableStreams tee is not implemented
+FAIL ReadableStream teeing: should be able to read one branch to the end without affecting the other tee is not implemented
+FAIL ReadableStream teeing: values should be equal across each branch tee is not implemented
+FAIL ReadableStream teeing: errors in the source should propagate to both branches tee is not implemented
+FAIL ReadableStream teeing: canceling branch1 should not impact branch2 tee is not implemented
+FAIL ReadableStream teeing: canceling branch2 should not impact branch1 tee is not implemented
+FAIL ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array tee is not implemented
+FAIL ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches tee is not implemented
+FAIL ReadableStream teeing: closing the original should immediately close the branches tee is not implemented
+FAIL ReadableStream teeing: erroring the original should immediately error the branches tee is not implemented
 

Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt (190400 => 190401)


--- trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1,6 +1,6 @@
 
 PASS Running templatedRSEmpty with ReadableStream (empty) 
-FAIL instances have the correct methods and properties assert_equals: has a tee method expected "function" but got "undefined"
+PASS instances have the correct methods and properties 
 PASS Running templatedRSEmptyReader with ReadableStream (empty) reader 
 PASS instances have the correct methods and properties 
 PASS locked should be true 

Modified: trunk/Source/_javascript_Core/ChangeLog (190400 => 190401)


--- trunk/Source/_javascript_Core/ChangeLog	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1,3 +1,19 @@
+2015-10-01  Youenn Fablet  <youenn.fab...@crf.canon.fr>
+
+        [Streams API] Add support for private WebCore JS builtins functions
+        https://bugs.webkit.org/show_bug.cgi?id=149518
+
+        Reviewed by Darin Adler.
+
+        Adding API to add private identifiers on the fly.
+        This is used to support private JS Builtin functions/private JS Builtin names in WebCore.
+
+        * builtins/BuiltinNames.h:
+        (JSC::BuiltinNames::appendExternalName):
+        * runtime/CommonIdentifiers.cpp:
+        (JSC::CommonIdentifiers::appendExternalName):
+        * runtime/CommonIdentifiers.h:
+
 2015-09-30  Jaehun Lim  <ljaehun....@samsung.com>
 
         Unreviewed, cleanup after r190385

Modified: trunk/Source/_javascript_Core/builtins/BuiltinNames.h (190400 => 190401)


--- trunk/Source/_javascript_Core/builtins/BuiltinNames.h	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/_javascript_Core/builtins/BuiltinNames.h	2015-10-01 12:30:43 UTC (rev 190401)
@@ -59,6 +59,8 @@
     const Identifier* lookUpPrivateName(const Identifier&) const;
     const Identifier& lookUpPublicName(const Identifier&) const;
     
+    void appendExternalName(const Identifier& publicName, const Identifier& privateName);
+
     JSC_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
     JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
     JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(DECLARE_BUILTIN_SYMBOL_ACCESSOR)
@@ -108,7 +110,17 @@
     return m_emptyIdentifier;
 }
 
+inline void BuiltinNames::appendExternalName(const Identifier& publicName, const Identifier& privateName)
+{
+#ifndef NDEBUG
+    for (const auto& key : m_publicToPrivateMap.keys())
+        ASSERT(publicName.string() != *key);
+#endif
 
+    m_privateToPublicMap.add(privateName.impl(), &publicName);
+    m_publicToPrivateMap.add(publicName.impl(), &privateName);
 }
 
+}
+
 #endif

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.cpp (190400 => 190401)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.cpp	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.cpp	2015-10-01 12:30:43 UTC (rev 190401)
@@ -78,5 +78,9 @@
     return m_builtinNames->lookUpPublicName(ident);
 }
 
+void CommonIdentifiers::appendExternalName(const Identifier& publicName, const Identifier& privateName)
+{
+    m_builtinNames->appendExternalName(publicName, privateName);
+}
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (190400 => 190401)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2015-10-01 12:30:43 UTC (rev 190401)
@@ -359,6 +359,10 @@
 
         const BytecodeIntrinsicRegistry& bytecodeIntrinsicRegistry() const { return m_bytecodeIntrinsicRegistry; }
 
+        // Callers of this method should make sure that identifiers given to this method 
+        // survive the lifetime of CommonIdentifiers and related VM.
+        JS_EXPORT_PRIVATE void appendExternalName(const Identifier& publicName, const Identifier& privateName);
+
     private:
         BytecodeIntrinsicRegistry m_bytecodeIntrinsicRegistry;
     };

Modified: trunk/Source/WebCore/CMakeLists.txt (190400 => 190401)


--- trunk/Source/WebCore/CMakeLists.txt	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-10-01 12:30:43 UTC (rev 190401)
@@ -3355,6 +3355,7 @@
     ${WEBCORE_DIR}/Modules/streams/ByteLengthQueuingStrategy.js
     ${WEBCORE_DIR}/Modules/streams/CountQueuingStrategy.js
     ${WEBCORE_DIR}/Modules/streams/ReadableStream.js
+    ${WEBCORE_DIR}/Modules/streams/ReadableStreamInternals.js
 )
 
 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()

Modified: trunk/Source/WebCore/ChangeLog (190400 => 190401)


--- trunk/Source/WebCore/ChangeLog	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/ChangeLog	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1,5 +1,43 @@
 2015-10-01  Youenn Fablet  <youenn.fab...@crf.canon.fr>
 
+        [Streams API] Add support for private WebCore JS builtins functions
+        https://bugs.webkit.org/show_bug.cgi?id=149518
+
+        Reviewed by Darin Adler.
+
+        Using ReadableStream tee method as a testbed to add support for private WebCore JS builtins functions.
+        Private functions are hooked to JSDOMWindowBase, as it is the one connected to WebCoreClientData.
+        WebCoreClientData is responsible to export the private function symbols to the VM.
+
+        Updated generate-js-builtins script to generate a class that can create and own all JS functions.
+        This class is used by JSDOMWindowBase to create the JS builtin functions.
+        It is also used to manage the GC of these objects.
+
+        Covered by rebased tests.
+
+        * CMakeLists.txt: Adding ReadableStreamInternals builtin files.
+        * DerivedSources.cpp: Ditto.
+        * DerivedSources.make: Ditto.
+        * Modules/streams/ReadableStream.idl: Adding tee declaration as builtin
+        * Modules/streams/ReadableStream.js:
+        (tee): Calling @teeReadableStream
+        * Modules/streams/ReadableStreamInternals.js: Barebone @teeReadableStream implementation.
+        (teeReadableStream):
+        * WebCore.vcxproj/WebCore.vcxproj: Adding ReadableStreamInternals builtin files.
+        * WebCore.xcodeproj/project.pbxproj: Adding ReadableStreamInternals builtin files.
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::JSDOMWindowBase): Creating ReadableStreamInternalsBuiltinFunctions object.
+        (WebCore::JSDOMWindowBase::finishCreation): Creating builtin functions through ReadableStreamInternalsBuiltinFunctions and registering them to the JS engine.
+        (WebCore::JSDOMWindowBase::visitChildren): Ensuring GC does not collect private builtin functions through ReadableStreamInternalsBuiltinFunctions object
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/js/WebCoreJSClientData.h:
+        (WebCore::WebCoreJSClientData::WebCoreJSClientData): Exporting private names of ReadableStreamInternalsBuiltins
+        (WebCore::WebCoreJSClientData::readableStreamBuiltins):
+        (WebCore::WebCoreJSClientData::readableStreamInternalsBuiltins):
+        * generate-js-builtins: Adding support for ReadableStreamInternalsBuiltinFunctions and exportNames.
+
+2015-10-01  Youenn Fablet  <youenn.fab...@crf.canon.fr>
+
         Binding generator should make mutable CachedAttribute member fields
         https://bugs.webkit.org/show_bug.cgi?id=148056
 

Modified: trunk/Source/WebCore/DerivedSources.make (190400 => 190401)


--- trunk/Source/WebCore/DerivedSources.make	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/DerivedSources.make	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1253,6 +1253,7 @@
     $(WebCore)/Modules/streams/ByteLengthQueuingStrategy.js \
     $(WebCore)/Modules/streams/CountQueuingStrategy.js \
     $(WebCore)/Modules/streams/ReadableStream.js \
+    $(WebCore)/Modules/streams/ReadableStreamInternals.js \
 #
 
 all : $(WEBCORE_JS_BUILTINS:%.js=%Builtins.cpp)

Modified: trunk/Source/WebCore/Modules/streams/ReadableStream.idl (190400 => 190401)


--- trunk/Source/WebCore/Modules/streams/ReadableStream.idl	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/Modules/streams/ReadableStream.idl	2015-10-01 12:30:43 UTC (rev 190401)
@@ -37,6 +37,7 @@
     [RaisesException] ReadableStreamReader getReader();
     [Custom] Promise pipeTo(any streams, any options);
     [JSBuiltin] Object pipeThrough(any dest, any options);
+    [JSBuiltin] Object tee();
 
     readonly attribute boolean locked;
 };

Modified: trunk/Source/WebCore/Modules/streams/ReadableStream.js (190400 => 190401)


--- trunk/Source/WebCore/Modules/streams/ReadableStream.js	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/Modules/streams/ReadableStream.js	2015-10-01 12:30:43 UTC (rev 190401)
@@ -30,3 +30,11 @@
     this.pipeTo(streams.writable, options);
     return streams.readable;
 }
+
+function tee()
+{
+    "use strict";
+
+    // TODO: check this is a ReadableStream
+    return @teeReadableStream(this, false)
+}

Copied: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (from rev 190400, trunk/Source/WebCore/Modules/streams/ReadableStream.js) (0 => 190401)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	                        (rev 0)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2015-10-01 12:30:43 UTC (rev 190401)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * 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.
+ */
+
+function teeReadableStream(stream, shouldClone)
+{
+    "use strict";
+
+    throw new @TypeError("tee is not implemented");
+}

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (190400 => 190401)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-10-01 12:30:43 UTC (rev 190401)
@@ -3946,6 +3946,20 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ReadableStreamInternalsBuiltins.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamController.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (190400 => 190401)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-01 12:30:43 UTC (rev 190401)
@@ -1504,6 +1504,9 @@
 		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 */; };
+		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, ); }; };
+		416E6FEA1BBD1684000A6043 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		417253AA1354BBBC00360F2A /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417253A81354BBBC00360F2A /* MediaControlElements.cpp */; };
 		417253AB1354BBBC00360F2A /* MediaControlElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 417253A91354BBBC00360F2A /* MediaControlElements.h */; };
 		417DA6D913734E6E007C57FB /* Internals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417DA4CF13734326007C57FB /* Internals.cpp */; };
@@ -11327,7 +11330,9 @@
 		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>"; };
 		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>"; };
+		9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltinsWrapper.h; sourceTree = "<group>"; };
 		9B19B67E1B964E5200348745 /* ShadowRoot.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRoot.idl; sourceTree = "<group>"; };
 		9B1AB0791648C69D0051F3F2 /* HTMLFormControlsCollection.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLFormControlsCollection.idl; sourceTree = "<group>"; };
 		9B1AB07B1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollectionCustom.cpp; sourceTree = "<group>"; };
@@ -17077,7 +17082,9 @@
 				71E2183817359FB8006E6E4D /* PlugInsResources.h */,
 				71E2183917359FB8006E6E4D /* PlugInsResourcesData.cpp */,
 				9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */,
+				9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */,
 				9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */,
+				9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */,
 				43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */,
 				43B85ED318CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.gperf */,
 				26AA0F9D18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp */,
@@ -25084,6 +25091,7 @@
 				BC1A37BE097C715F0019F3D8 /* DOMTraversal.h in Headers */,
 				85526CD20AB0B7D9000302EA /* DOMTreeWalker.h in Headers */,
 				850B41C30AD9E7E700A6ED4F /* DOMTreeWalkerInternal.h in Headers */,
+				416E6FE91BBD12E5000A6043 /* ReadableStreamBuiltins.h in Headers */,
 				85C7F4910AAF79DC004014DD /* DOMUIEvent.h in Headers */,
 				85989DD00ACC8BBD00A0BC51 /* DOMUIEventInternal.h in Headers */,
 				FED13D2A0CEA91DF00D89466 /* DOMUIKitExtensions.h in Headers */,
@@ -25264,6 +25272,7 @@
 				B2AFFC7E0D00A5C10030074D /* FontCustomPlatformData.h in Headers */,
 				B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */,
 				4A6E9FC813C17D570046A7F8 /* FontFeatureSettings.h in Headers */,
+				416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */,
 				409EBDB616B7EEA300CBA3FC /* FontLoader.h in Headers */,
 				0845680812B90DA600960A9F /* FontMetrics.h in Headers */,
 				B5320D6B122A24E9002D1440 /* FontPlatformData.h in Headers */,
@@ -25729,6 +25738,7 @@
 				FC9E0E4D16419C1E00392BE3 /* JSDOMWindowCSS.h in Headers */,
 				652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */,
 				BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
+				416E6FEA1BBD1684000A6043 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */,
 				65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
 				FD7868BA136B999200D403DF /* JSDynamicsCompressorNode.h in Headers */,
 				65DF31FA09D1CC60000BE325 /* JSElement.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (190400 => 190401)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2015-10-01 12:30:43 UTC (rev 190401)
@@ -47,6 +47,10 @@
 #include "WebSafeIncrementalSweeperIOS.h"
 #endif
 
+#if ENABLE(STREAMS_API)
+#include "ReadableStreamInternalsBuiltins.h"
+#endif
+
 using namespace JSC;
 
 namespace WebCore {
@@ -65,6 +69,9 @@
     , m_windowCloseWatchpoints((window && window->frame()) ? IsWatched : IsInvalidated)
     , m_impl(window)
     , m_shell(shell)
+#if ENABLE(STREAMS_API)
+    , m_readableStreamFunctions(vm)
+#endif
 {
 }
 
@@ -73,14 +80,36 @@
     Base::finishCreation(vm, shell);
     ASSERT(inherits(info()));
 
+#if ENABLE(STREAMS_API)
+    m_readableStreamFunctions.init(*this);
+#endif
+
     GlobalPropertyInfo staticGlobals[] = {
         GlobalPropertyInfo(vm.propertyNames->document, jsNull(), DontDelete | ReadOnly),
-        GlobalPropertyInfo(vm.propertyNames->window, m_shell, DontDelete | ReadOnly)
+        GlobalPropertyInfo(vm.propertyNames->window, m_shell, DontDelete | ReadOnly),
+#if ENABLE(STREAMS_API)
+#define DECLARE_GLOBAL_STATIC(name)\
+        GlobalPropertyInfo(\
+            static_cast<WebCoreJSClientData*>(vm.clientData)->readableStreamInternalsBuiltins().name##PrivateName(),\
+            m_readableStreamFunctions.m_##name##Function.get() , DontDelete | ReadOnly),
+        WEBCOREREADABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
+#undef EXPORT_FUNCTION
+#endif
     };
-    
+
     addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
 }
 
+void JSDOMWindowBase::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+    JSDOMWindowBase* thisObject = jsCast<JSDOMWindowBase*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    Base::visitChildren(thisObject, visitor);
+#if ENABLE(STREAMS_API)
+    thisObject->m_readableStreamFunctions.visit(visitor);
+#endif
+}
+
 void JSDOMWindowBase::destroy(JSCell* cell)
 {
     static_cast<JSDOMWindowBase*>(cell)->JSDOMWindowBase::~JSDOMWindowBase();

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h (190400 => 190401)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h	2015-10-01 12:30:43 UTC (rev 190401)
@@ -22,6 +22,7 @@
 
 #include "JSDOMBinding.h"
 #include "JSDOMGlobalObject.h"
+#include "ReadableStreamInternalsBuiltinsWrapper.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -73,6 +74,7 @@
 
         static JSC::VM& commonVM();
         static void fireFrameClearedWatchpointsForWindow(DOMWindow*);
+        static void visitChildren(JSC::JSCell*, JSC::SlotVisitor&);
 
     protected:
         JSC::WatchpointSet m_windowCloseWatchpoints;
@@ -84,6 +86,10 @@
 
         RefPtr<DOMWindow> m_impl;
         JSDOMWindowShell* m_shell;
+
+#if ENABLE(STREAMS_API)
+        ReadableStreamInternalsBuiltinFunctions m_readableStreamFunctions;
+#endif
     };
 
     // Returns a JSDOMWindow or jsNull()

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp (190400 => 190401)


--- trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp	2015-10-01 12:30:43 UTC (rev 190401)
@@ -29,4 +29,5 @@
 #include "ByteLengthQueuingStrategyBuiltins.cpp"
 #include "CountQueuingStrategyBuiltins.cpp"
 #include "ReadableStreamBuiltins.cpp"
+#include "ReadableStreamInternalsBuiltins.cpp"
 #endif

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h (190400 => 190401)


--- trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h	2015-10-01 12:30:43 UTC (rev 190401)
@@ -31,6 +31,7 @@
 #include "ByteLengthQueuingStrategyBuiltinsWrapper.h"
 #include "CountQueuingStrategyBuiltinsWrapper.h"
 #include "ReadableStreamBuiltinsWrapper.h"
+#include "ReadableStreamInternalsBuiltinsWrapper.h"
 #endif
 
 namespace WebCore {
@@ -44,12 +45,16 @@
 #if ENABLE(STREAMS_API)
     explicit WebCoreJSClientData(JSC::VM& vm)
         : m_readableStreamBuiltins(&vm)
+        , m_readableStreamInternalsBuiltins(&vm)
         , m_byteLengthQueuingStrategyBuiltins(&vm)
         , m_countQueuingStrategyBuiltins(&vm)
 #else
     WebCoreJSClientData(JSC::VM&)
 #endif
     {
+#if ENABLE(STREAMS_API)
+        m_readableStreamInternalsBuiltins.exportNames();
+#endif
     }
 
     virtual ~WebCoreJSClientData()
@@ -86,6 +91,7 @@
 
 #if ENABLE(STREAMS_API)
     ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins; }
+    ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins; }
     ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; }
     CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; }
 #endif
@@ -96,6 +102,7 @@
 
 #if ENABLE(STREAMS_API)
     ReadableStreamBuiltinsWrapper m_readableStreamBuiltins;
+    ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins;
     ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins;
     CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins;
 #endif

Modified: trunk/Source/WebCore/generate-js-builtins (190400 => 190401)


--- trunk/Source/WebCore/generate-js-builtins	2015-10-01 10:52:37 UTC (rev 190400)
+++ trunk/Source/WebCore/generate-js-builtins	2015-10-01 12:30:43 UTC (rev 190401)
@@ -80,11 +80,11 @@
 #include <bytecode/UnlinkedFunctionExecutable.h>
 #include <builtins/BuiltinUtils.h>
 #include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
 
 namespace WebCore {
 
-class ${Filename}BuiltinsWrapper : private JSC::WeakHandleOwner
-{
+class ${Filename}BuiltinsWrapper : private JSC::WeakHandleOwner {
 public:
     explicit ${Filename}BuiltinsWrapper(JSC::VM* vm)
         : m_vm(*vm)
@@ -103,6 +103,8 @@
 
     ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
 
+    void exportNames();
+
 private:
     JSC::VM& m_vm;
 
@@ -126,6 +128,44 @@
 ${Prefix}_FOREACH_BUILTIN(DEFINE_BUILTIN_EXECUTABLES)
 #undef DEFINE_BUILTIN_EXECUTABLES
 
+inline void ${Filename}BuiltinsWrapper::exportNames()
+{
+#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
+    ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
+#undef EXPORT_FUNCTION_NAME
+}
+
+class ${Filename}BuiltinFunctions {
+public:
+    explicit ${Filename}BuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
+
+    void init(JSC::JSGlobalObject&);
+    void visit(JSC::SlotVisitor&);
+
+public:
+    JSC::VM& m_vm;
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \\
+    JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
+    ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+};
+
+inline void ${Filename}BuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
+{
+#define EXPORT_FUNCTION(codeName, functionName, length)\\
+    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
+    ${Prefix}_FOREACH_BUILTIN(EXPORT_FUNCTION)
+#undef EXPORT_FUNCTION
+}
+
+inline void ${Filename}BuiltinFunctions::visit(JSC::SlotVisitor& visitor)
+{
+#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
+    ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
+#undef VISIT_FUNCTION
+}
+
 } // namespace WebCore
 
 #endif // ${Filename}BuiltinsWrapper_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to