Migrate streams API to JS Builtins
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Oct 2015 06:20:58 +0000 (06:20 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Oct 2015 06:20:58 +0000 (06:20 +0000)
commitba2a0217da5777dad52ba62d99d8e2389153940c
tree6a1d315b3bc916ba0ea0e23d0c5f6de34becb5d0
parent79e5476b1f976970cd03bd25125f2e840cb16bf6
Migrate streams API to JS Builtins
https://bugs.webkit.org/show_bug.cgi?id=147092

Reviewed by Darin Adler.

Source/WebCore:

Moved ReadableStream implementation from C++ to JS Builtins.
Created specific private constructors for ReadableStreamReader and ReadableStreamController.
Added these constructors to  JSDOMWindowBase.
Constructors are based on a template found in JSDOMConstructor which might serve to webidl-generated classes as well.

Covered by existing tests.

* CMakeLists.txt:
* DerivedSources.make:
* Modules/streams/ReadableStream.cpp: Removed.
* Modules/streams/ReadableStream.h: Removed.
* Modules/streams/ReadableStream.idl:
* Modules/streams/ReadableStream.js:
(strategy.size):
(initializeReadableStream):
(cancel):
(getReader):
(pipeTo):
(tee):
(locked):
* Modules/streams/ReadableStreamController.h:
* Modules/streams/ReadableStreamController.idl:
* Modules/streams/ReadableStreamController.js: Added.
(enqueue):
(error):
(close):
(desiredSize):
* Modules/streams/ReadableStreamInternals.js:
(privateInitializeReadableStreamReader):
(privateInitializeReadableStreamController):
(isReadableStream):
(isReadableStreamReader):
(isReadableStreamController):
(errorReadableStream):
(requestReadableStreamPull):
(getReadableStreamDesiredSize):
(releaseReadableStreamReader):
(cancelReadableStream):
(finishClosingReadableStream):
(closeReadableStream):
(closeReadableStreamReader):
(enqueueInReadableStream):
(readFromReadableStreamReader):
(invokeOrNoop):
(promiseInvokeOrNoop):
* Modules/streams/ReadableStreamReader.cpp: Removed.
* Modules/streams/ReadableStreamReader.h:
* Modules/streams/ReadableStreamReader.idl:
* Modules/streams/ReadableStreamReader.js: Copied from Source/WebCore/Modules/streams/ReadableStream.js.
(cancel):
(read):
(releaseLock):
(closed):
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMConstructor.h: Added.
(WebCore::JSBuiltinConstructor::create):
(WebCore::JSBuiltinConstructor::createStructure):
(WebCore::JSBuiltinConstructor::JSBuiltinConstructor):
(WebCore::JSBuiltinConstructor::initializeProperties):
(WebCore::JSBuiltinConstructor<JSClass>::finishCreation):
(WebCore::JSBuiltinConstructor<JSClass>::construct):
(WebCore::JSBuiltinConstructor<JSClass>::getConstructData):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::finishCreation):
* bindings/js/JSReadableStreamControllerCustom.cpp: Removed.
* bindings/js/JSReadableStreamCustom.cpp: Removed.
* bindings/js/JSReadableStreamPrivateConstructors.cpp: Added.
(WebCore::constructJSReadableStreamController):
(WebCore::constructJSReadableStreamReader):
(WebCore::JSBuiltinConstructor<JSReadableStreamReader>::createJSObject):
(WebCore::JSBuiltinConstructor<JSReadableStreamController>::createJSObject):
(WebCore::JSBuiltinReadableStreamReaderPrivateConstructor::createInitializeFunction):
(WebCore::JSBuiltinReadableStreamControllerPrivateConstructor::createInitializeFunction):
(WebCore::createReadableStreamReaderPrivateConstructor):
(WebCore::createReadableStreamControllerPrivateConstructor):
* bindings/js/JSReadableStreamPrivateConstructors.h: Added.
* bindings/js/JSReadableStreamReaderCustom.cpp: Removed.
* bindings/js/ReadableJSStream.cpp: Removed.
* bindings/js/ReadableJSStream.h: Removed.
* bindings/js/WebCoreBuiltinNames.h: Added.
(WebCore::WebCoreBuiltinNames::WebCoreBuiltinNames):
* bindings/js/WebCoreJSBuiltins.cpp:
* bindings/js/WebCoreJSClientData.h:
(WebCore::WebCoreJSClientData::WebCoreJSClientData):
(WebCore::WebCoreJSClientData::builtinNames):
(WebCore::WebCoreJSClientData::readableStreamControllerBuiltins):
(WebCore::WebCoreJSClientData::readableStreamReaderBuiltins):

LayoutTests:

Rebasing some tests, one subtest passing, two others still failing but with different reasons.

* streams/reference-implementation/brand-checks-expected.txt:
* streams/reference-implementation/readable-stream-reader-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190608 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/streams/reference-implementation/brand-checks-expected.txt
LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/streams/ReadableStream.cpp [deleted file]
Source/WebCore/Modules/streams/ReadableStream.h [deleted file]
Source/WebCore/Modules/streams/ReadableStream.idl
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamController.h
Source/WebCore/Modules/streams/ReadableStreamController.idl
Source/WebCore/Modules/streams/ReadableStreamController.js [new file with mode: 0644]
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/Modules/streams/ReadableStreamReader.cpp [deleted file]
Source/WebCore/Modules/streams/ReadableStreamReader.h
Source/WebCore/Modules/streams/ReadableStreamReader.idl
Source/WebCore/Modules/streams/ReadableStreamReader.js [new file with mode: 0644]
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSDOMConstructor.h [new file with mode: 0644]
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSReadableStreamCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSReadableStreamPrivateConstructors.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/JSReadableStreamPrivateConstructors.h [new file with mode: 0644]
Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp [deleted file]
Source/WebCore/bindings/js/ReadableJSStream.cpp [deleted file]
Source/WebCore/bindings/js/ReadableJSStream.h [deleted file]
Source/WebCore/bindings/js/WebCoreBuiltinNames.h [new file with mode: 0644]
Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp
Source/WebCore/bindings/js/WebCoreJSClientData.h