Source/JavaScriptCore:
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 14:21:58 +0000 (14:21 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 14:21:58 +0000 (14:21 +0000)
Automate WebCore JS builtins generation and build system
https://bugs.webkit.org/show_bug.cgi?id=149751

Reviewed by Darin Adler.

* generate-js-builtins: updating the part related to WebCore JS binding.

Source/WebCore:
Refactor WebCore JS builtins to prepare for automatic generation
https://bugs.webkit.org/show_bug.cgi?id=149751

Reviewed by Darin Adler.

Adding annotations to JS files to know whether they should be under a compilation flag and
whether they are JS internals or JS tied to WebIDL.
If a file is said as JS internals, all function names should be exported automatically.
Added WebCoreJSBuiltins.h to simplify handling of builtins in JSVMClientData.
Added WebCoreJSInternals.h to simplify handling of builtin private function in JSDOMWindowBase.
Renamed WebCoreJSClientData to JSVMClientData.

Covered by existing tests.

* CMakeLists.txt:
* Modules/streams/ByteLengthQueuingStrategy.js:
* Modules/streams/CountQueuingStrategy.js:
* Modules/streams/ReadableStream.js:
* Modules/streams/ReadableStreamController.js:
* Modules/streams/ReadableStreamInternals.js:
* Modules/streams/ReadableStreamReader.js:
* WebCore.order:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/DOMWrapperWorld.cpp:
(WebCore::DOMWrapperWorld::DOMWrapperWorld):
(WebCore::DOMWrapperWorld::~DOMWrapperWorld):
(WebCore::normalWorld):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::JSDOMWindowBase):
(WebCore::JSDOMWindowBase::finishCreation):
(WebCore::JSDOMWindowBase::visitChildren):
(WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):
(WebCore::JSDOMWindowBase::destroy): Deleted.
* bindings/js/JSDOMWindowBase.h:
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::getAllWorlds):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::transferArrayBuffers):
* bindings/js/WebCoreJSBuiltinInternals.h: Added.
(WebCore::JSBuiltinInternalFunctions::JSBuiltinInternalFunctions):
(WebCore::JSBuiltinInternalFunctions::readableStreamInternals):
(WebCore::JSBuiltinInternalFunctions::visit):
(WebCore::JSBuiltinInternalFunctions::init):
* bindings/js/WebCoreJSBuiltins.cpp:
* bindings/js/WebCoreJSBuiltins.h: Added.
(WebCore::JSBuiltinFunctions::JSBuiltinFunctions):
(WebCore::JSBuiltinFunctions::byteLengthQueuingStrategyBuiltins):
(WebCore::JSBuiltinFunctions::countQueuingStrategyBuiltins):
(WebCore::JSBuiltinFunctions::readableStreamBuiltins):
(WebCore::JSBuiltinFunctions::readableStreamControllerBuiltins):
(WebCore::JSBuiltinFunctions::readableStreamInternalsBuiltins):
(WebCore::JSBuiltinFunctions::readableStreamReaderBuiltins):
* bindings/js/WebCoreJSClientData.h:
(WebCore::JSVMClientData::JSVMClientData):
(WebCore::JSVMClientData::~JSVMClientData):
(WebCore::JSVMClientData::builtinFunctions):
(WebCore::initNormalWorldClientData):
(WebCore::JSVMClientData::normalWorld): Deleted.
(WebCore::JSVMClientData::getAllWorlds): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190794 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/generate-js-builtins
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ByteLengthQueuingStrategy.js
Source/WebCore/Modules/streams/CountQueuingStrategy.js
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamController.js
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/Modules/streams/ReadableStreamReader.js
Source/WebCore/WebCore.order
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/DOMWrapperWorld.cpp
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/bindings/js/JSDOMWindowBase.h
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/bindings/js/WebCoreJSBuiltinInternals.h [new file with mode: 0644]
Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp
Source/WebCore/bindings/js/WebCoreJSBuiltins.h [new file with mode: 0644]
Source/WebCore/bindings/js/WebCoreJSClientData.h

index abca182..2529ec3 100644 (file)
@@ -1,3 +1,12 @@
+2015-10-09  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        Automate WebCore JS builtins generation and build system
+        https://bugs.webkit.org/show_bug.cgi?id=149751
+
+        Reviewed by Darin Adler.
+
+        * generate-js-builtins: updating the part related to WebCore JS binding.
+
 2015-10-08  Filip Pizlo  <fpizlo@apple.com>
 
         DFG SSA should remove unreachable code
index b2841f4..dff4187 100644 (file)
@@ -314,8 +314,8 @@ if (namespace == "JSC"):
 else:
     builtinName = scopeName[0].lower() + scopeName[1:]
     builtinsImplementation.write("""{\\
-    WebCoreJSClientData* clientData = static_cast<WebCoreJSClientData*>(vm.clientData); \\
-    return clientData->%s().codeName##Executable()->link(vm, clientData->%s().codeName##Source()); \\
+    JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\
+    return clientData->builtinFunctions().%s().codeName##Executable()->link(vm, clientData->builtinFunctions().%s().codeName##Source()); \\
 """% (builtinName, builtinName))
 
 builtinsImplementation.write("""}
index b455bc8..36fd64e 100644 (file)
@@ -3582,7 +3582,7 @@ foreach (_builtinjs ${WEBCORE_JS_BUILTINS})
     get_filename_component(_name ${_builtinjs} NAME_WE)
     add_custom_command(
         OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}BuiltinsWrapper.h ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}Builtins.h ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}Builtins.cpp
-        MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/generate-js-builtins
+        MAIN_DEPENDENCY ${WEBCORE_DIR}/generate-js-builtins
         DEPENDS ${WebCore_GENERATE_JS_BUILTINS_SCRIPTS_DIR}/generate-js-builtins
         DEPENDS ${_builtinjs}
         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate-js-builtins --input ${_builtinjs} --output_dir ${DERIVED_SOURCES_WEBCORE_DIR} --generate_js_builtins_path ${WebCore_GENERATE_JS_BUILTINS_SCRIPTS_DIR}
index 8ab468b..5c172bd 100644 (file)
@@ -1,3 +1,65 @@
+2015-10-09  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        Refactor WebCore JS builtins to prepare for automatic generation
+        https://bugs.webkit.org/show_bug.cgi?id=149751
+
+        Reviewed by Darin Adler.
+
+        Adding annotations to JS files to know whether they should be under a compilation flag and
+        whether they are JS internals or JS tied to WebIDL.
+        If a file is said as JS internals, all function names should be exported automatically.
+        Added WebCoreJSBuiltins.h to simplify handling of builtins in JSVMClientData.
+        Added WebCoreJSInternals.h to simplify handling of builtin private function in JSDOMWindowBase.
+        Renamed WebCoreJSClientData to JSVMClientData.
+
+        Covered by existing tests.
+
+        * CMakeLists.txt:
+        * Modules/streams/ByteLengthQueuingStrategy.js:
+        * Modules/streams/CountQueuingStrategy.js:
+        * Modules/streams/ReadableStream.js:
+        * Modules/streams/ReadableStreamController.js:
+        * Modules/streams/ReadableStreamInternals.js:
+        * Modules/streams/ReadableStreamReader.js:
+        * WebCore.order:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/DOMWrapperWorld.cpp:
+        (WebCore::DOMWrapperWorld::DOMWrapperWorld):
+        (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
+        (WebCore::normalWorld):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::JSDOMWindowBase):
+        (WebCore::JSDOMWindowBase::finishCreation):
+        (WebCore::JSDOMWindowBase::visitChildren):
+        (WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):
+        (WebCore::JSDOMWindowBase::destroy): Deleted.
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::getAllWorlds):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::SerializedScriptValue::transferArrayBuffers):
+        * bindings/js/WebCoreJSBuiltinInternals.h: Added.
+        (WebCore::JSBuiltinInternalFunctions::JSBuiltinInternalFunctions):
+        (WebCore::JSBuiltinInternalFunctions::readableStreamInternals):
+        (WebCore::JSBuiltinInternalFunctions::visit):
+        (WebCore::JSBuiltinInternalFunctions::init):
+        * bindings/js/WebCoreJSBuiltins.cpp:
+        * bindings/js/WebCoreJSBuiltins.h: Added.
+        (WebCore::JSBuiltinFunctions::JSBuiltinFunctions):
+        (WebCore::JSBuiltinFunctions::byteLengthQueuingStrategyBuiltins):
+        (WebCore::JSBuiltinFunctions::countQueuingStrategyBuiltins):
+        (WebCore::JSBuiltinFunctions::readableStreamBuiltins):
+        (WebCore::JSBuiltinFunctions::readableStreamControllerBuiltins):
+        (WebCore::JSBuiltinFunctions::readableStreamInternalsBuiltins):
+        (WebCore::JSBuiltinFunctions::readableStreamReaderBuiltins):
+        * bindings/js/WebCoreJSClientData.h:
+        (WebCore::JSVMClientData::JSVMClientData):
+        (WebCore::JSVMClientData::~JSVMClientData):
+        (WebCore::JSVMClientData::builtinFunctions):
+        (WebCore::initNormalWorldClientData):
+        (WebCore::JSVMClientData::normalWorld): Deleted.
+        (WebCore::JSVMClientData::getAllWorlds): Deleted.
+
 2015-10-09  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Rationalize JSXXConstructor class definition
index a826736..f948125 100644 (file)
@@ -24,6 +24,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+
 function size(chunk)
 {
     "use strict";
index 911737d..44d630b 100644 (file)
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+
 function size()
 {
     "use strict";
index d36693a..448c2ad 100644 (file)
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+
 function initializeReadableStream(underlyingSource, strategy)
 {
     "use strict";
index 30c03d1..99f37c9 100644 (file)
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+
 function enqueue(chunk)
 {
     "use strict";
index ebd7f99..339918c 100644 (file)
@@ -23,6 +23,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+// @internals
+
 function privateInitializeReadableStreamReader(stream)
 {
     "use strict";
index 26940c3..ce273a8 100644 (file)
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+
 function cancel(reason)
 {
     "use strict";
index 19a180d..2dbc1a0 100644 (file)
@@ -24723,7 +24723,7 @@ __ZN7WebCoreL24JSDOMURLConstructorTableE
 __ZZN7WebCore12wrapperOwnerEPNS_15DOMWrapperWorldEPNS_6DOMURLEE13jsDOMURLOwner
 __ZGVZN7WebCore12wrapperOwnerEPNS_15DOMWrapperWorldEPNS_6DOMURLEE13jsDOMURLOwner
 __ZN7WebCoreL27JSDOMWindowConstructorTableE
-__ZTVN7WebCore19WebCoreJSClientDataE
+__ZTVN7WebCore19JSVMClientDataE
 __ZN7WebCoreL40JSDynamicsCompressorNodeConstructorTableE
 __ZN7WebCoreL38JSDynamicsCompressorNodePrototypeTableE
 __ZN7WebCoreL29JSDynamicsCompressorNodeTableE
index e2ebe95..48d5d0f 100644 (file)
                40ECAE7E16B8B67200C36103 /* JSDOMError.h in Headers */ = {isa = PBXBuildFile; fileRef = 40ECAE7D16B8B67200C36103 /* JSDOMError.h */; };
                40ECAE8116B8B68A00C36103 /* JSDOMError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */; };
                410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; };
-               411A90421BBAB47A000CF156 /* WebCoreJSBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411A90411BBAB46D000CF156 /* WebCoreJSBuiltins.cpp */; };
                4123081B138C429700BCCFCA /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93F19B1A08245E5A001E9ABC /* WebCore.framework */; };
                41230913138C42FF00BCCFCA /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8216299029F4FB501000131 /* JavaScriptCore.framework */; };
                4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
                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, ); }; };
+               416E6FEA1BBD1684000A6044 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764DA /* 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 */; };
                418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 418F88030FF957AE0080F045 /* JSAbstractWorker.h */; };
                419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419BC2DC1685329900D64D6D /* VisitedLinkState.cpp */; };
                419BC2DF1685329900D64D6D /* VisitedLinkState.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BC2DD1685329900D64D6D /* VisitedLinkState.h */; };
+               419BE7561BC7F41B00E1C85B /* WebCoreJSBuiltinInternals.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7531BC7F3DB00E1C85B /* WebCoreJSBuiltinInternals.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               419BE7571BC7F42100E1C85B /* WebCoreJSBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419BE7541BC7F3DB00E1C85B /* WebCoreJSBuiltins.cpp */; settings = {ASSET_TAGS = (); }; };
+               419BE7581BC7F42700E1C85B /* WebCoreJSBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7551BC7F3DB00E1C85B /* WebCoreJSBuiltins.h */; settings = {ASSET_TAGS = (); }; };
+               419BE7591BC7F42B00E1C85B /* WebCoreBuiltinNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7521BC7F3DB00E1C85B /* WebCoreBuiltinNames.h */; settings = {ASSET_TAGS = (); }; };
                41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */; };
                41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */; };
                41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
                40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMError.cpp; sourceTree = "<group>"; };
                410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = "<group>"; };
                41189EF71AD8232800B90A0D /* ReadableStreamController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamController.idl; sourceTree = "<group>"; };
-               411A90411BBAB46D000CF156 /* WebCoreJSBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreJSBuiltins.cpp; sourceTree = "<group>"; };
                4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
                4129DF811BB5B79B00322A16 /* ReadableStreamController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamController.h; sourceTree = "<group>"; };
                4129DF821BB5B7A600322A16 /* ReadableStreamReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamReader.h; sourceTree = "<group>"; };
                418F88030FF957AE0080F045 /* JSAbstractWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAbstractWorker.h; sourceTree = "<group>"; };
                419BC2DC1685329900D64D6D /* VisitedLinkState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkState.cpp; sourceTree = "<group>"; };
                419BC2DD1685329900D64D6D /* VisitedLinkState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkState.h; sourceTree = "<group>"; };
+               419BE7521BC7F3DB00E1C85B /* WebCoreBuiltinNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreBuiltinNames.h; sourceTree = "<group>"; };
+               419BE7531BC7F3DB00E1C85B /* WebCoreJSBuiltinInternals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreJSBuiltinInternals.h; sourceTree = "<group>"; };
+               419BE7541BC7F3DB00E1C85B /* WebCoreJSBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreJSBuiltins.cpp; sourceTree = "<group>"; };
+               419BE7551BC7F3DB00E1C85B /* WebCoreJSBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreJSBuiltins.h; sourceTree = "<group>"; };
                419FAFAD1ABABCD5005B828B /* ReadableStreamReader.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamReader.idl; sourceTree = "<group>"; };
                41A023ED1A39DB7900F722CF /* ReadableStream.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStream.idl; sourceTree = "<group>"; };
                41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorkerThread.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>"; };
+               9B03D8071BB3110D00B764DA /* 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>"; };
                                9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */,
                                9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */,
                                9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */,
-                               9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */,
+                               9B03D8071BB3110D00B764DA /* ReadableStreamInternalsBuiltinsWrapper.h */,
                                43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */,
                                43B85ED318CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.gperf */,
                                26AA0F9D18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp */,
                                1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */,
                                A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */,
                                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */,
-                               411A90411BBAB46D000CF156 /* WebCoreJSBuiltins.cpp */,
+                               419BE7521BC7F3DB00E1C85B /* WebCoreBuiltinNames.h */,
+                               419BE7531BC7F3DB00E1C85B /* WebCoreJSBuiltinInternals.h */,
+                               419BE7541BC7F3DB00E1C85B /* WebCoreJSBuiltins.cpp */,
+                               419BE7551BC7F3DB00E1C85B /* WebCoreJSBuiltins.h */,
                                BC53D910114310CC000D817E /* WebCoreJSClientData.h */,
                                0F099D0617B968A100FF84B9 /* WebCoreTypedArrayController.cpp */,
                                0F099D0717B968A100FF84B9 /* WebCoreTypedArrayController.h */,
                                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */,
                                A8DF3FD0097FA0FC0052981B /* HTMLCollection.h in Headers */,
                                977B3865122883E900B81FF8 /* HTMLConstructionSite.h in Headers */,
+                               419BE7591BC7F42B00E1C85B /* WebCoreBuiltinNames.h in Headers */,
                                7C3E510A18DF8F3500C112F7 /* HTMLConverter.h in Headers */,
                                F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */,
                                D359D78A129CA2710006E5D2 /* HTMLDetailsElement.h in Headers */,
                                FC9E0E4D16419C1E00392BE3 /* JSDOMWindowCSS.h in Headers */,
                                652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */,
                                BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
-                               416E6FEA1BBD1684000A6043 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */,
+                               416E6FEA1BBD1684000A6044 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */,
                                65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
                                FD7868BA136B999200D403DF /* JSDynamicsCompressorNode.h in Headers */,
                                65DF31FA09D1CC60000BE325 /* JSElement.h in Headers */,
                                FDA15EB212B03EE1003A583A /* JSPannerNode.h in Headers */,
                                8A9A587511E84C81008ACFD1 /* JSPerformance.h in Headers */,
                                8A9A587111E84C36008ACFD1 /* JSPerformanceNavigation.h in Headers */,
+                               419BE7581BC7F42700E1C85B /* WebCoreJSBuiltins.h in Headers */,
                                8A9A588811E84F37008ACFD1 /* JSPerformanceTiming.h in Headers */,
                                FDEA6247152102FC00479DF0 /* JSPeriodicWave.h in Headers */,
                                93B70D6C09EB0C7C009D8468 /* JSPluginElementFunctions.h in Headers */,
                                0FDA7C271883333200C954B5 /* JSWebKitPlaybackTargetAvailabilityEvent.h in Headers */,
                                494BD79E0F55C94C00747828 /* JSWebKitPoint.h in Headers */,
                                31C0FF400E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.h in Headers */,
+                               419BE7561BC7F41B00E1C85B /* WebCoreJSBuiltinInternals.h in Headers */,
                                5DA5E0FD102B953800088CF9 /* JSWebSocket.h in Headers */,
                                65DF320609D1CC60000BE325 /* JSWheelEvent.h in Headers */,
                                E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */,
                                0707568B142262D600414161 /* HTMLTrackElement.cpp in Sources */,
                                977B37251228721700B81FF8 /* HTMLTreeBuilder.cpp in Sources */,
                                A8EA79F30A1916DF00A8EF5F /* HTMLUListElement.cpp in Sources */,
+                               419BE7571BC7F42100E1C85B /* WebCoreJSBuiltins.cpp in Sources */,
                                E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */,
                                839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */,
-                               411A90421BBAB47A000CF156 /* WebCoreJSBuiltins.cpp in Sources */,
                                0B8C56D40F28627F000502E1 /* HTTPHeaderMap.cpp in Sources */,
                                1AC900C31943C0FC008625B5 /* HTTPHeaderNames.cpp in Sources */,
                                514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */,
index 3dd25e1..6657d2f 100644 (file)
@@ -36,14 +36,14 @@ DOMWrapperWorld::DOMWrapperWorld(JSC::VM& vm, bool isNormal)
 {
     VM::ClientData* clientData = m_vm.clientData;
     ASSERT(clientData);
-    static_cast<WebCoreJSClientData*>(clientData)->rememberWorld(*this);
+    static_cast<JSVMClientData*>(clientData)->rememberWorld(*this);
 }
 
 DOMWrapperWorld::~DOMWrapperWorld()
 {
     VM::ClientData* clientData = m_vm.clientData;
     ASSERT(clientData);
-    static_cast<WebCoreJSClientData*>(clientData)->forgetWorld(*this);
+    static_cast<JSVMClientData*>(clientData)->forgetWorld(*this);
 
     // These items are created lazily.
     while (!m_scriptControllersWithWindowShells.isEmpty())
@@ -63,7 +63,7 @@ DOMWrapperWorld& normalWorld(JSC::VM& vm)
 {
     VM::ClientData* clientData = vm.clientData;
     ASSERT(clientData);
-    return static_cast<WebCoreJSClientData*>(clientData)->normalWorld();
+    return static_cast<JSVMClientData*>(clientData)->normalWorld();
 }
 
 DOMWrapperWorld& mainThreadNormalWorld()
index 9e0ff4f..2af9799 100644 (file)
@@ -70,9 +70,7 @@ JSDOMWindowBase::JSDOMWindowBase(VM& vm, Structure* structure, PassRefPtr<DOMWin
     , m_windowCloseWatchpoints((window && window->frame()) ? IsWatched : IsInvalidated)
     , m_impl(window)
     , m_shell(shell)
-#if ENABLE(STREAMS_API)
-    , m_readableStreamFunctions(vm)
-#endif
+    , m_privateFunctions(vm)
 {
 }
 
@@ -81,25 +79,23 @@ void JSDOMWindowBase::finishCreation(VM& vm, JSDOMWindowShell* shell)
     Base::finishCreation(vm, shell);
     ASSERT(inherits(info()));
 
-#if ENABLE(STREAMS_API)
-    m_readableStreamFunctions.init(*this);
-#endif
+    m_privateFunctions.init(*this);
 
     GlobalPropertyInfo staticGlobals[] = {
         GlobalPropertyInfo(vm.propertyNames->document, jsNull(), DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->window, m_shell, DontDelete | ReadOnly),
 #if ENABLE(STREAMS_API)
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().readableStreamClosedPrivateName(), jsNumber(1), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().readableStreamErroredPrivateName(), jsNumber(2), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().readableStreamReadablePrivateName(), jsNumber(3), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().ReadableStreamControllerPrivateName(), createReadableStreamControllerPrivateConstructor(vm, *this), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().ReadableStreamReaderPrivateName(), createReadableStreamReaderPrivateConstructor(vm, *this), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().readableStreamClosedPrivateName(), jsNumber(1), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().readableStreamErroredPrivateName(), jsNumber(2), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().readableStreamReadablePrivateName(), jsNumber(3), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().ReadableStreamControllerPrivateName(), createReadableStreamControllerPrivateConstructor(vm, *this), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().ReadableStreamReaderPrivateName(), createReadableStreamReaderPrivateConstructor(vm, *this), DontDelete | ReadOnly),
 #define DECLARE_GLOBAL_STATIC(name)\
         GlobalPropertyInfo(\
-            static_cast<WebCoreJSClientData*>(vm.clientData)->readableStreamInternalsBuiltins().name##PrivateName(),\
-            m_readableStreamFunctions.m_##name##Function.get() , DontDelete | ReadOnly),
+            static_cast<JSVMClientData*>(vm.clientData)->builtinFunctions().readableStreamInternalsBuiltins().name##PrivateName(), \
+            m_privateFunctions.readableStreamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
         WEBCOREREADABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
-#undef EXPORT_FUNCTION
+#undef DECLARE_GLOBAL_STATIC
 #endif
     };
 
@@ -111,9 +107,7 @@ 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
+    thisObject->m_privateFunctions.visit(visitor);
 }
 
 void JSDOMWindowBase::destroy(JSCell* cell)
@@ -297,7 +291,7 @@ JSDOMWindow* toJSDOMWindow(JSValue value)
 void JSDOMWindowBase::fireFrameClearedWatchpointsForWindow(DOMWindow* window)
 {
     JSC::VM& vm = JSDOMWindowBase::commonVM();
-    WebCoreJSClientData* clientData = static_cast<WebCoreJSClientData*>(vm.clientData);
+    JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData);
     Vector<Ref<DOMWrapperWorld>> wrapperWorlds;
     clientData->getAllWorlds(wrapperWorlds);
     for (unsigned i = 0; i < wrapperWorlds.size(); ++i) {
index f40872f..107640c 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "JSDOMBinding.h"
 #include "JSDOMGlobalObject.h"
-#include "ReadableStreamInternalsBuiltinsWrapper.h"
+#include "WebCoreJSBuiltinInternals.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -87,9 +87,7 @@ namespace WebCore {
         RefPtr<DOMWindow> m_impl;
         JSDOMWindowShell* m_shell;
 
-#if ENABLE(STREAMS_API)
-        ReadableStreamInternalsBuiltinFunctions m_readableStreamFunctions;
-#endif
+        JSBuiltinInternalFunctions m_privateFunctions;
     };
 
     // Returns a JSDOMWindow or jsNull()
index 4b3b097..e2cf092 100644 (file)
@@ -194,7 +194,7 @@ Vector<JSC::Strong<JSDOMWindowShell>> ScriptController::windowShells()
 
 void ScriptController::getAllWorlds(Vector<Ref<DOMWrapperWorld>>& worlds)
 {
-    static_cast<WebCoreJSClientData*>(JSDOMWindow::commonVM().clientData)->getAllWorlds(worlds);
+    static_cast<JSVMClientData*>(JSDOMWindow::commonVM().clientData)->getAllWorlds(worlds);
 }
 
 void ScriptController::clearWindowShell(DOMWindow* newDOMWindow, bool goingIntoPageCache)
index 62ea1c1..088ecac 100644 (file)
@@ -2634,7 +2634,7 @@ std::unique_ptr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScrip
 
     auto contents = std::make_unique<ArrayBufferContentsArray>(arrayBuffers.size());
     Vector<Ref<DOMWrapperWorld>> worlds;
-    static_cast<WebCoreJSClientData*>(exec->vm().clientData)->getAllWorlds(worlds);
+    static_cast<JSVMClientData*>(exec->vm().clientData)->getAllWorlds(worlds);
 
     HashSet<JSC::ArrayBuffer*> visited;
     for (size_t arrayBufferIndex = 0; arrayBufferIndex < arrayBuffers.size(); arrayBufferIndex++) {
diff --git a/Source/WebCore/bindings/js/WebCoreJSBuiltinInternals.h b/Source/WebCore/bindings/js/WebCoreJSBuiltinInternals.h
new file mode 100644 (file)
index 0000000..df63793
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef WebCoreJSBuiltinInternals_h
+#define WebCoreJSBuiltinInternals_h
+
+#if ENABLE(STREAMS_API)
+#include "ReadableStreamInternalsBuiltinsWrapper.h"
+#endif
+
+namespace WebCore {
+
+class JSBuiltinInternalFunctions {
+public:
+explicit JSBuiltinInternalFunctions(JSC::VM& v)
+        : vm(v)
+#if ENABLE(STREAMS_API)
+        , m_readableStreamInternalsFunctions(vm)
+#endif
+    { }
+
+#if ENABLE(STREAMS_API)
+    ReadableStreamInternalsBuiltinFunctions readableStreamInternals() { return m_readableStreamInternalsFunctions; }
+#endif
+    void visit(JSC::SlotVisitor& visitor) {
+#if ENABLE(STREAMS_API)
+        m_readableStreamInternalsFunctions.visit(visitor);
+#endif
+    }
+    void init(JSC::JSGlobalObject& globalObject) {
+#if ENABLE(STREAMS_API)
+        m_readableStreamInternalsFunctions.init(globalObject);
+#endif
+    }
+
+private:
+    JSC::VM& vm;
+#if ENABLE(STREAMS_API)
+     ReadableStreamInternalsBuiltinFunctions m_readableStreamInternalsFunctions;
+#endif
+
+};
+
+}
+#endif
index 96c7e0e..23d421d 100644 (file)
@@ -1,26 +1,18 @@
 /*
- * 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 library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
  *
- * 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.
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "config.h"
diff --git a/Source/WebCore/bindings/js/WebCoreJSBuiltins.h b/Source/WebCore/bindings/js/WebCoreJSBuiltins.h
new file mode 100644 (file)
index 0000000..7f2f3f7
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef WebCoreJSBuiltins_h
+#define WebCoreJSBuiltins_h
+
+#if ENABLE(STREAMS_API)
+#include "ByteLengthQueuingStrategyBuiltinsWrapper.h"
+#include "CountQueuingStrategyBuiltinsWrapper.h"
+#include "ReadableStreamBuiltinsWrapper.h"
+#include "ReadableStreamControllerBuiltinsWrapper.h"
+#include "ReadableStreamInternalsBuiltinsWrapper.h"
+#include "ReadableStreamReaderBuiltinsWrapper.h"
+#endif
+
+
+#include <runtime/VM.h>
+
+namespace WebCore {
+
+class JSBuiltinFunctions {
+public:
+    explicit JSBuiltinFunctions(JSC::VM& v)
+        : vm(v)
+#if ENABLE(STREAMS_API)
+        , m_byteLengthQueuingStrategyBuiltins(&vm)
+        , m_countQueuingStrategyBuiltins(&vm)
+        , m_readableStreamBuiltins(&vm)
+        , m_readableStreamControllerBuiltins(&vm)
+        , m_readableStreamInternalsBuiltins(&vm)
+        , m_readableStreamReaderBuiltins(&vm)
+#endif
+    {
+#if ENABLE(STREAMS_API)
+        m_readableStreamInternalsBuiltins.exportNames();
+#endif
+    }
+#if ENABLE(STREAMS_API)
+    ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins;}
+    CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins;}
+    ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins;}
+    ReadableStreamControllerBuiltinsWrapper& readableStreamControllerBuiltins() { return m_readableStreamControllerBuiltins;}
+    ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins;}
+    ReadableStreamReaderBuiltinsWrapper& readableStreamReaderBuiltins() { return m_readableStreamReaderBuiltins;}
+#endif
+
+private:
+    JSC::VM& vm;
+#if ENABLE(STREAMS_API)
+    ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins;
+    CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins;
+    ReadableStreamBuiltinsWrapper m_readableStreamBuiltins;
+    ReadableStreamControllerBuiltinsWrapper m_readableStreamControllerBuiltins;
+    ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins;
+    ReadableStreamReaderBuiltinsWrapper m_readableStreamReaderBuiltins;
+#endif
+
+};
+
+}
+
+#endif
index 870dd81..1dc557d 100644 (file)
 
 #include "DOMWrapperWorld.h"
 #include "WebCoreBuiltinNames.h"
+#include "WebCoreJSBuiltins.h"
 #include "WebCoreTypedArrayController.h"
 #include <wtf/HashSet.h>
 #include <wtf/RefPtr.h>
 
-#if ENABLE(STREAMS_API)
-#include "ByteLengthQueuingStrategyBuiltinsWrapper.h"
-#include "CountQueuingStrategyBuiltinsWrapper.h"
-#include "ReadableStreamBuiltinsWrapper.h"
-#include "ReadableStreamControllerBuiltinsWrapper.h"
-#include "ReadableStreamInternalsBuiltinsWrapper.h"
-#include "ReadableStreamReaderBuiltinsWrapper.h"
-#endif
-
 namespace WebCore {
 
-class WebCoreJSClientData : public JSC::VM::ClientData {
-    WTF_MAKE_NONCOPYABLE(WebCoreJSClientData); WTF_MAKE_FAST_ALLOCATED;
+class JSVMClientData : public JSC::VM::ClientData {
+    WTF_MAKE_NONCOPYABLE(JSVMClientData); WTF_MAKE_FAST_ALLOCATED;
     friend class VMWorldIterator;
     friend void initNormalWorldClientData(JSC::VM*);
 
 public:
-    explicit WebCoreJSClientData(JSC::VM& vm)
-        : m_builtinNames(&vm)
-#if ENABLE(STREAMS_API)
-        , m_readableStreamBuiltins(&vm)
-        , m_readableStreamControllerBuiltins(&vm)
-        , m_readableStreamInternalsBuiltins(&vm)
-        , m_readableStreamReaderBuiltins(&vm)
-        , m_byteLengthQueuingStrategyBuiltins(&vm)
-        , m_countQueuingStrategyBuiltins(&vm)
-#endif
+    explicit JSVMClientData(JSC::VM& vm)
+        : m_builtinFunctions(vm)
+        , m_builtinNames(&vm)
     {
-#if ENABLE(STREAMS_API)
-        m_readableStreamInternalsBuiltins.exportNames();
-#endif
     }
 
-    virtual ~WebCoreJSClientData()
+    virtual ~JSVMClientData()
     {
         ASSERT(m_worldSet.contains(m_normalWorld.get()));
         ASSERT(m_worldSet.size() == 1);
@@ -94,37 +76,21 @@ public:
     }
 
     WebCoreBuiltinNames& builtinNames() { return m_builtinNames; }
-
-#if ENABLE(STREAMS_API)
-    ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins; }
-    ReadableStreamControllerBuiltinsWrapper& readableStreamControllerBuiltins() { return m_readableStreamControllerBuiltins; }
-    ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins; }
-    ReadableStreamReaderBuiltinsWrapper& readableStreamReaderBuiltins() { return m_readableStreamReaderBuiltins; }
-    ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; }
-    CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; }
-#endif
+    JSBuiltinFunctions& builtinFunctions() { return m_builtinFunctions; }
 
 private:
     HashSet<DOMWrapperWorld*> m_worldSet;
     RefPtr<DOMWrapperWorld> m_normalWorld;
 
+    JSBuiltinFunctions m_builtinFunctions;
     WebCoreBuiltinNames m_builtinNames;
-
-#if ENABLE(STREAMS_API)
-    ReadableStreamBuiltinsWrapper m_readableStreamBuiltins;
-    ReadableStreamControllerBuiltinsWrapper m_readableStreamControllerBuiltins;
-    ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins;
-    ReadableStreamReaderBuiltinsWrapper m_readableStreamReaderBuiltins;
-    ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins;
-    CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins;
-#endif
 };
 
 inline void initNormalWorldClientData(JSC::VM* vm)
 {
-    WebCoreJSClientData* webCoreJSClientData = new WebCoreJSClientData(*vm);
-    vm->clientData = webCoreJSClientData; // ~VM deletes this pointer.
-    webCoreJSClientData->m_normalWorld = DOMWrapperWorld::create(*vm, true);
+    JSVMClientData* clientData = new JSVMClientData(*vm);
+    vm->clientData = clientData; // ~VM deletes this pointer.
+    clientData->m_normalWorld = DOMWrapperWorld::create(*vm, true);
     vm->m_typedArrayController = adoptRef(new WebCoreTypedArrayController());
 }