Changeset 190401 in webkit


Ignore:
Timestamp:
Oct 1, 2015 5:30:43 AM (9 years ago)
Author:
youenn.fablet@crf.canon.fr
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/JavaScriptCore:

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:
Location:
trunk
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r190396 r190401  
     12015-10-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Streams API] Add support for private WebCore JS builtins functions
     4        https://bugs.webkit.org/show_bug.cgi?id=149518
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebasing tests now that tee is appearing in the IDL, although not yet conformant in its implementation.
     9
     10        * streams/reference-implementation/readable-stream-expected.txt:
     11        * streams/reference-implementation/readable-stream-tee-expected.txt:
     12        * streams/reference-implementation/readable-stream-templated-expected.txt:
     13
    1142015-10-01  Xabier Rodriguez Calvar  <calvaris@igalia.com>
    215
  • trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt

    r190396 r190401  
    22PASS ReadableStream can be constructed with no errors
    33PASS ReadableStream can't be constructed with garbage
    4 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
     4FAIL ReadableStream instances should have the correct list of properties assert_false: method should be non-enumerable expected false got true
    55PASS ReadableStream constructor should throw for non-function start arguments
    66PASS ReadableStream constructor can get initial garbage as cancel argument
  • trunk/LayoutTests/streams/reference-implementation/readable-stream-tee-expected.txt

    r185586 r190401  
    11
    2 FAIL ReadableStream teeing: rs.tee() returns an array of two ReadableStreams rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
    3 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)
    4 FAIL ReadableStream teeing: values should be equal across each branch rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
    5 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)
    6 FAIL ReadableStream teeing: canceling branch1 should not impact branch2 rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
    7 FAIL ReadableStream teeing: canceling branch2 should not impact branch1 rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
    8 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)
    9 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)
    10 FAIL ReadableStream teeing: closing the original should immediately close the branches rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
    11 FAIL ReadableStream teeing: erroring the original should immediately error the branches rs.tee is not a function. (In 'rs.tee()', 'rs.tee' is undefined)
     2FAIL ReadableStream teeing: rs.tee() returns an array of two ReadableStreams tee is not implemented
     3FAIL ReadableStream teeing: should be able to read one branch to the end without affecting the other tee is not implemented
     4FAIL ReadableStream teeing: values should be equal across each branch tee is not implemented
     5FAIL ReadableStream teeing: errors in the source should propagate to both branches tee is not implemented
     6FAIL ReadableStream teeing: canceling branch1 should not impact branch2 tee is not implemented
     7FAIL ReadableStream teeing: canceling branch2 should not impact branch1 tee is not implemented
     8FAIL ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array tee is not implemented
     9FAIL ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches tee is not implemented
     10FAIL ReadableStream teeing: closing the original should immediately close the branches tee is not implemented
     11FAIL ReadableStream teeing: erroring the original should immediately error the branches tee is not implemented
    1212
  • trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt

    r189693 r190401  
    11
    22PASS Running templatedRSEmpty with ReadableStream (empty)
    3 FAIL instances have the correct methods and properties assert_equals: has a tee method expected "function" but got "undefined"
     3PASS instances have the correct methods and properties
    44PASS Running templatedRSEmptyReader with ReadableStream (empty) reader
    55PASS instances have the correct methods and properties
  • trunk/Source/JavaScriptCore/ChangeLog

    r190390 r190401  
     12015-10-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Streams API] Add support for private WebCore JS builtins functions
     4        https://bugs.webkit.org/show_bug.cgi?id=149518
     5
     6        Reviewed by Darin Adler.
     7
     8        Adding API to add private identifiers on the fly.
     9        This is used to support private JS Builtin functions/private JS Builtin names in WebCore.
     10
     11        * builtins/BuiltinNames.h:
     12        (JSC::BuiltinNames::appendExternalName):
     13        * runtime/CommonIdentifiers.cpp:
     14        (JSC::CommonIdentifiers::appendExternalName):
     15        * runtime/CommonIdentifiers.h:
     16
    1172015-09-30  Jaehun Lim  <ljaehun.lim@samsung.com>
    218
  • trunk/Source/JavaScriptCore/builtins/BuiltinNames.h

    r190155 r190401  
    6060    const Identifier& lookUpPublicName(const Identifier&) const;
    6161   
     62    void appendExternalName(const Identifier& publicName, const Identifier& privateName);
     63
    6264    JSC_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
    6365    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
     
    109111}
    110112
     113inline void BuiltinNames::appendExternalName(const Identifier& publicName, const Identifier& privateName)
     114{
     115#ifndef NDEBUG
     116    for (const auto& key : m_publicToPrivateMap.keys())
     117        ASSERT(publicName.string() != *key);
     118#endif
     119
     120    m_privateToPublicMap.add(privateName.impl(), &publicName);
     121    m_publicToPrivateMap.add(publicName.impl(), &privateName);
     122}
    111123
    112124}
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp

    r188752 r190401  
    7979}
    8080
     81void CommonIdentifiers::appendExternalName(const Identifier& publicName, const Identifier& privateName)
     82{
     83    m_builtinNames->appendExternalName(publicName, privateName);
     84}
    8185
    8286} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r190385 r190401  
    360360        const BytecodeIntrinsicRegistry& bytecodeIntrinsicRegistry() const { return m_bytecodeIntrinsicRegistry; }
    361361
     362        // Callers of this method should make sure that identifiers given to this method
     363        // survive the lifetime of CommonIdentifiers and related VM.
     364        JS_EXPORT_PRIVATE void appendExternalName(const Identifier& publicName, const Identifier& privateName);
     365
    362366    private:
    363367        BytecodeIntrinsicRegistry m_bytecodeIntrinsicRegistry;
  • trunk/Source/WebCore/CMakeLists.txt

    r190394 r190401  
    33563356    ${WEBCORE_DIR}/Modules/streams/CountQueuingStrategy.js
    33573357    ${WEBCORE_DIR}/Modules/streams/ReadableStream.js
     3358    ${WEBCORE_DIR}/Modules/streams/ReadableStreamInternals.js
    33583359)
    33593360
  • trunk/Source/WebCore/ChangeLog

    r190398 r190401  
     12015-10-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Streams API] Add support for private WebCore JS builtins functions
     4        https://bugs.webkit.org/show_bug.cgi?id=149518
     5
     6        Reviewed by Darin Adler.
     7
     8        Using ReadableStream tee method as a testbed to add support for private WebCore JS builtins functions.
     9        Private functions are hooked to JSDOMWindowBase, as it is the one connected to WebCoreClientData.
     10        WebCoreClientData is responsible to export the private function symbols to the VM.
     11
     12        Updated generate-js-builtins script to generate a class that can create and own all JS functions.
     13        This class is used by JSDOMWindowBase to create the JS builtin functions.
     14        It is also used to manage the GC of these objects.
     15
     16        Covered by rebased tests.
     17
     18        * CMakeLists.txt: Adding ReadableStreamInternals builtin files.
     19        * DerivedSources.cpp: Ditto.
     20        * DerivedSources.make: Ditto.
     21        * Modules/streams/ReadableStream.idl: Adding tee declaration as builtin
     22        * Modules/streams/ReadableStream.js:
     23        (tee): Calling @teeReadableStream
     24        * Modules/streams/ReadableStreamInternals.js: Barebone @teeReadableStream implementation.
     25        (teeReadableStream):
     26        * WebCore.vcxproj/WebCore.vcxproj: Adding ReadableStreamInternals builtin files.
     27        * WebCore.xcodeproj/project.pbxproj: Adding ReadableStreamInternals builtin files.
     28        * bindings/js/JSDOMWindowBase.cpp:
     29        (WebCore::JSDOMWindowBase::JSDOMWindowBase): Creating ReadableStreamInternalsBuiltinFunctions object.
     30        (WebCore::JSDOMWindowBase::finishCreation): Creating builtin functions through ReadableStreamInternalsBuiltinFunctions and registering them to the JS engine.
     31        (WebCore::JSDOMWindowBase::visitChildren): Ensuring GC does not collect private builtin functions through ReadableStreamInternalsBuiltinFunctions object
     32        * bindings/js/JSDOMWindowBase.h:
     33        * bindings/js/WebCoreJSClientData.h:
     34        (WebCore::WebCoreJSClientData::WebCoreJSClientData): Exporting private names of ReadableStreamInternalsBuiltins
     35        (WebCore::WebCoreJSClientData::readableStreamBuiltins):
     36        (WebCore::WebCoreJSClientData::readableStreamInternalsBuiltins):
     37        * generate-js-builtins: Adding support for ReadableStreamInternalsBuiltinFunctions and exportNames.
     38
    1392015-10-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
    240
  • trunk/Source/WebCore/DerivedSources.make

    r190394 r190401  
    12541254    $(WebCore)/Modules/streams/CountQueuingStrategy.js \
    12551255    $(WebCore)/Modules/streams/ReadableStream.js \
     1256    $(WebCore)/Modules/streams/ReadableStreamInternals.js \
    12561257#
    12571258
  • trunk/Source/WebCore/Modules/streams/ReadableStream.idl

    r190155 r190401  
    3838    [Custom] Promise pipeTo(any streams, any options);
    3939    [JSBuiltin] Object pipeThrough(any dest, any options);
     40    [JSBuiltin] Object tee();
    4041
    4142    readonly attribute boolean locked;
  • trunk/Source/WebCore/Modules/streams/ReadableStream.js

    r190155 r190401  
    3131    return streams.readable;
    3232}
     33
     34function tee()
     35{
     36    "use strict";
     37
     38    // TODO: check this is a ReadableStream
     39    return @teeReadableStream(this, false)
     40}
  • trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js

    r190400 r190401  
    11/*
    2  * Copyright (C) 2015 Canon Inc.
     2 * Copyright (C) 2015 Canon Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 function pipeThrough(streams, options)
     26function teeReadableStream(stream, shouldClone)
    2727{
    2828    "use strict";
    2929
    30     this.pipeTo(streams.writable, options);
    31     return streams.readable;
     30    throw new @TypeError("tee is not implemented");
    3231}
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r190394 r190401  
    39343934    </ClCompile>
    39353935    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStream.cpp">
     3936      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     3937      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     3938      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
     3939      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     3940      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
     3941      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
     3942      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     3943      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     3944      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     3945      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     3946      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     3947      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     3948    </ClCompile>
     3949    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ReadableStreamInternalsBuiltins.cpp">
    39363950      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    39373951      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r190394 r190401  
    15051505                4162A4581011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A4561011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h */; };
    15061506                416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; };
     1507                416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1508                416E6FE91BBD12E5000A6043 /* ReadableStreamBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1509                416E6FEA1BBD1684000A6043 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15071510                417253AA1354BBBC00360F2A /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417253A81354BBBC00360F2A /* MediaControlElements.cpp */; };
    15081511                417253AB1354BBBC00360F2A /* MediaControlElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 417253A91354BBBC00360F2A /* MediaControlElements.h */; };
     
    1132811331                9AB1F37F18E2489A00534743 /* CSSToLengthConversionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSToLengthConversionData.cpp; sourceTree = "<group>"; };
    1132911332                9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltins.h; sourceTree = "<group>"; };
     11333                9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltins.h; sourceTree = "<group>"; };
    1133011334                9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltinsWrapper.h; sourceTree = "<group>"; };
     11335                9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltinsWrapper.h; sourceTree = "<group>"; };
    1133111336                9B19B67E1B964E5200348745 /* ShadowRoot.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRoot.idl; sourceTree = "<group>"; };
    1133211337                9B1AB0791648C69D0051F3F2 /* HTMLFormControlsCollection.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLFormControlsCollection.idl; sourceTree = "<group>"; };
     
    1707817083                                71E2183917359FB8006E6E4D /* PlugInsResourcesData.cpp */,
    1707917084                                9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */,
     17085                                9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */,
    1708017086                                9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */,
     17087                                9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */,
    1708117088                                43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */,
    1708217089                                43B85ED318CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.gperf */,
     
    2508525092                                85526CD20AB0B7D9000302EA /* DOMTreeWalker.h in Headers */,
    2508625093                                850B41C30AD9E7E700A6ED4F /* DOMTreeWalkerInternal.h in Headers */,
     25094                                416E6FE91BBD12E5000A6043 /* ReadableStreamBuiltins.h in Headers */,
    2508725095                                85C7F4910AAF79DC004014DD /* DOMUIEvent.h in Headers */,
    2508825096                                85989DD00ACC8BBD00A0BC51 /* DOMUIEventInternal.h in Headers */,
     
    2526525273                                B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */,
    2526625274                                4A6E9FC813C17D570046A7F8 /* FontFeatureSettings.h in Headers */,
     25275                                416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */,
    2526725276                                409EBDB616B7EEA300CBA3FC /* FontLoader.h in Headers */,
    2526825277                                0845680812B90DA600960A9F /* FontMetrics.h in Headers */,
     
    2573025739                                652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */,
    2573125740                                BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
     25741                                416E6FEA1BBD1684000A6043 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */,
    2573225742                                65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
    2573325743                                FD7868BA136B999200D403DF /* JSDynamicsCompressorNode.h in Headers */,
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp

    r190272 r190401  
    4848#endif
    4949
     50#if ENABLE(STREAMS_API)
     51#include "ReadableStreamInternalsBuiltins.h"
     52#endif
     53
    5054using namespace JSC;
    5155
     
    6670    , m_impl(window)
    6771    , m_shell(shell)
     72#if ENABLE(STREAMS_API)
     73    , m_readableStreamFunctions(vm)
     74#endif
    6875{
    6976}
     
    7481    ASSERT(inherits(info()));
    7582
     83#if ENABLE(STREAMS_API)
     84    m_readableStreamFunctions.init(*this);
     85#endif
     86
    7687    GlobalPropertyInfo staticGlobals[] = {
    7788        GlobalPropertyInfo(vm.propertyNames->document, jsNull(), DontDelete | ReadOnly),
    78         GlobalPropertyInfo(vm.propertyNames->window, m_shell, DontDelete | ReadOnly)
     89        GlobalPropertyInfo(vm.propertyNames->window, m_shell, DontDelete | ReadOnly),
     90#if ENABLE(STREAMS_API)
     91#define DECLARE_GLOBAL_STATIC(name)\
     92        GlobalPropertyInfo(\
     93            static_cast<WebCoreJSClientData*>(vm.clientData)->readableStreamInternalsBuiltins().name##PrivateName(),\
     94            m_readableStreamFunctions.m_##name##Function.get() , DontDelete | ReadOnly),
     95        WEBCOREREADABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
     96#undef EXPORT_FUNCTION
     97#endif
    7998    };
    80    
     99
    81100    addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
     101}
     102
     103void JSDOMWindowBase::visitChildren(JSCell* cell, SlotVisitor& visitor)
     104{
     105    JSDOMWindowBase* thisObject = jsCast<JSDOMWindowBase*>(cell);
     106    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     107    Base::visitChildren(thisObject, visitor);
     108#if ENABLE(STREAMS_API)
     109    thisObject->m_readableStreamFunctions.visit(visitor);
     110#endif
    82111}
    83112
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h

    r190272 r190401  
    2323#include "JSDOMBinding.h"
    2424#include "JSDOMGlobalObject.h"
     25#include "ReadableStreamInternalsBuiltinsWrapper.h"
    2526#include <wtf/Forward.h>
    2627
     
    7475        static JSC::VM& commonVM();
    7576        static void fireFrameClearedWatchpointsForWindow(DOMWindow*);
     77        static void visitChildren(JSC::JSCell*, JSC::SlotVisitor&);
    7678
    7779    protected:
     
    8587        RefPtr<DOMWindow> m_impl;
    8688        JSDOMWindowShell* m_shell;
     89
     90#if ENABLE(STREAMS_API)
     91        ReadableStreamInternalsBuiltinFunctions m_readableStreamFunctions;
     92#endif
    8793    };
    8894
  • trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp

    r190394 r190401  
    3030#include "CountQueuingStrategyBuiltins.cpp"
    3131#include "ReadableStreamBuiltins.cpp"
     32#include "ReadableStreamInternalsBuiltins.cpp"
    3233#endif
  • trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h

    r190394 r190401  
    3232#include "CountQueuingStrategyBuiltinsWrapper.h"
    3333#include "ReadableStreamBuiltinsWrapper.h"
     34#include "ReadableStreamInternalsBuiltinsWrapper.h"
    3435#endif
    3536
     
    4546    explicit WebCoreJSClientData(JSC::VM& vm)
    4647        : m_readableStreamBuiltins(&vm)
     48        , m_readableStreamInternalsBuiltins(&vm)
    4749        , m_byteLengthQueuingStrategyBuiltins(&vm)
    4850        , m_countQueuingStrategyBuiltins(&vm)
     
    5153#endif
    5254    {
     55#if ENABLE(STREAMS_API)
     56        m_readableStreamInternalsBuiltins.exportNames();
     57#endif
    5358    }
    5459
     
    8792#if ENABLE(STREAMS_API)
    8893    ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins; }
     94    ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins; }
    8995    ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; }
    9096    CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; }
     
    97103#if ENABLE(STREAMS_API)
    98104    ReadableStreamBuiltinsWrapper m_readableStreamBuiltins;
     105    ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins;
    99106    ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins;
    100107    CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins;
  • trunk/Source/WebCore/generate-js-builtins

    r190178 r190401  
    8181#include <builtins/BuiltinUtils.h>
    8282#include <runtime/Identifier.h>
     83#include <runtime/JSFunction.h>
    8384
    8485namespace WebCore {
    8586
    86 class ${Filename}BuiltinsWrapper : private JSC::WeakHandleOwner
    87 {
     87class ${Filename}BuiltinsWrapper : private JSC::WeakHandleOwner {
    8888public:
    8989    explicit ${Filename}BuiltinsWrapper(JSC::VM* vm)
     
    103103
    104104    ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
     105
     106    void exportNames();
    105107
    106108private:
     
    127129#undef DEFINE_BUILTIN_EXECUTABLES
    128130
     131inline void ${Filename}BuiltinsWrapper::exportNames()
     132{
     133#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
     134    ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
     135#undef EXPORT_FUNCTION_NAME
     136}
     137
     138class ${Filename}BuiltinFunctions {
     139public:
     140    explicit ${Filename}BuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
     141
     142    void init(JSC::JSGlobalObject&);
     143    void visit(JSC::SlotVisitor&);
     144
     145public:
     146    JSC::VM& m_vm;
     147
     148#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \\
     149    JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
     150    ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
     151#undef DECLARE_BUILTIN_SOURCE_MEMBERS
     152};
     153
     154inline void ${Filename}BuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
     155{
     156#define EXPORT_FUNCTION(codeName, functionName, length)\\
     157    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
     158    ${Prefix}_FOREACH_BUILTIN(EXPORT_FUNCTION)
     159#undef EXPORT_FUNCTION
     160}
     161
     162inline void ${Filename}BuiltinFunctions::visit(JSC::SlotVisitor& visitor)
     163{
     164#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
     165    ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
     166#undef VISIT_FUNCTION
     167}
     168
    129169} // namespace WebCore
    130170
Note: See TracChangeset for help on using the changeset viewer.