Changeset 151169 in webkit


Ignore:
Timestamp:
Jun 4, 2013 7:17:51 AM (11 years ago)
Author:
Christophe Dumez
Message:

Automatically generate WorkerContext constructor attributes
https://bugs.webkit.org/show_bug.cgi?id=117183

Reviewed by Kentaro Hara.

.:

Update GENERATE_BINDINGS macro to take an additional _workercontext_constructors_file
optional argument.

  • Source/cmake/WebKitMacros.cmake:

Source/WebCore:

Add [GlobalContext=WindowOnly|WorkerOnly|WindowAndWorker] IDL extended attribute
to indicate to the bindings generator on which global context the constructor
attribute should be generated for interfaces without [NoInterfaceObject]:

  • WindowOnly: only on the global Window object (default if ommitted)
  • WorkerOnly: only on the worker context
  • WindowAndWorker: On both the global Window object and the worker context

This covers all the current use cases.

The JSC bindings generator now automatically generates the Constructor attributes
on the WorkerContext for non-callback interfaces which do not have the
[NoInterfaceObject] extended attribute but have [GlobalContext=WorkerOnly|WindowAndWorker]
extended attribute.

No new tests, already covered by:
fast/js/global-constructors-attributes.html
fast/js/global-constructors-attributes-worker.html

  • CMakeLists.txt:
  • DerivedSources.make: Pass new --workerContextConstructorsFile argument to preprocess-idls.pl.
  • DerivedSources.pri: Ditto.
  • GNUmakefile.am: Ditto.
  • PlatformBlackBerry.cmake: Ditto.
  • UseJSC.cmake: Ditto.
  • bindings/scripts/IDLAttributes.txt: Add [GlobalContext=WindowOnly|WorkerOnly|WindowAndWorker]

IDL extended attribute.

  • bindings/scripts/preprocess-idls.pl: Add support for [GlobalContext] extended attribute and

generate a partial interface for WorkerContext global constructors that are automatically
generated.

  • dom/MessageEvent.idl: Add [GlobalContext=WindowAndWorker].
  • fileapi/Blob.idl: Add [GlobalContext=WindowAndWorker].
  • fileapi/FileReader.idl: Add [GlobalContext=WindowAndWorker].
  • fileapi/FileReaderSync.idl: Add [GlobalContext=WorkerOnly] and remove [NoInterfaceObject]

as the interface should only be visible in worker environment as per the spec.

  • html/DOMURL.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/ArrayBuffer.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/DataView.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Float32Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Float64Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Int16Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Int32Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Int8Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Uint16Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Uint32Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Uint8Array.idl: Add [GlobalContext=WindowAndWorker].
  • html/canvas/Uint8ClampedArray.idl: Add [GlobalContext=WindowAndWorker].
  • workers/WorkerContext.idl: Remove several Constructor attributes which are now automatically

generated.

  • workers/WorkerLocation.idl: Add [GlobalContext=WorkerOnly] and remove [NoInterfaceObject]

as the interface should only be visible in worker environment as per the spec.

Tools:

Pass new --workerContextConstructorsFile to preprocess-idl.pl for bindings
tests.

  • Scripts/webkitpy/bindings/main.py:

(BindingsTests.generate_supplemental_dependency):
(BindingsTests.main):

Location:
trunk
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r151145 r151169  
     12013-06-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        Automatically generate WorkerContext constructor attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=117183
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Update GENERATE_BINDINGS macro to take an additional _workercontext_constructors_file
     9        optional argument.
     10
     11        * Source/cmake/WebKitMacros.cmake:
     12
    1132013-06-03  Eduardo Lima Mitev  <elima@igalia.com>
    214
  • trunk/Source/WebCore/CMakeLists.txt

    r151083 r151169  
    29472947set(SUPPLEMENTAL_DEPENDENCY_FILE ${DERIVED_SOURCES_WEBCORE_DIR}/supplemental_dependency.tmp)
    29482948set(WINDOW_CONSTRUCTORS_FILE ${DERIVED_SOURCES_WEBCORE_DIR}/DOMWindowConstructors.idl)
     2949set(WORKERCONTEXT_CONSTRUCTORS_FILE ${DERIVED_SOURCES_WEBCORE_DIR}/WorkerContextConstructors.idl)
    29492950set(IDL_ATTRIBUTES_FILE ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
    29502951
  • trunk/Source/WebCore/ChangeLog

    r151164 r151169  
     12013-06-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        Automatically generate WorkerContext constructor attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=117183
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Add [GlobalContext=WindowOnly|WorkerOnly|WindowAndWorker] IDL extended attribute
     9        to indicate to the bindings generator on which global context the constructor
     10        attribute should be generated for interfaces without [NoInterfaceObject]:
     11        - WindowOnly: only on the global Window object (default if ommitted)
     12        - WorkerOnly: only on the worker context
     13        - WindowAndWorker: On both the global Window object and the worker context
     14
     15        This covers all the current use cases.
     16
     17        The JSC bindings generator now automatically generates the Constructor attributes
     18        on the WorkerContext for non-callback interfaces which do not have the
     19        [NoInterfaceObject] extended attribute but have [GlobalContext=WorkerOnly|WindowAndWorker]
     20        extended attribute.
     21
     22        No new tests, already covered by:
     23        fast/js/global-constructors-attributes.html
     24        fast/js/global-constructors-attributes-worker.html
     25
     26        * CMakeLists.txt:
     27        * DerivedSources.make: Pass new --workerContextConstructorsFile argument to preprocess-idls.pl.
     28        * DerivedSources.pri: Ditto.
     29        * GNUmakefile.am: Ditto.
     30        * PlatformBlackBerry.cmake: Ditto.
     31        * UseJSC.cmake: Ditto.
     32        * bindings/scripts/IDLAttributes.txt: Add [GlobalContext=WindowOnly|WorkerOnly|WindowAndWorker]
     33        IDL extended attribute.
     34        * bindings/scripts/preprocess-idls.pl: Add support for [GlobalContext] extended attribute and
     35        generate a partial interface for WorkerContext global constructors that are automatically
     36        generated.
     37        * dom/MessageEvent.idl: Add [GlobalContext=WindowAndWorker].
     38        * fileapi/Blob.idl: Add [GlobalContext=WindowAndWorker].
     39        * fileapi/FileReader.idl: Add [GlobalContext=WindowAndWorker].
     40        * fileapi/FileReaderSync.idl: Add [GlobalContext=WorkerOnly] and remove [NoInterfaceObject]
     41        as the interface should only be visible in worker environment as per the spec.
     42        * html/DOMURL.idl: Add [GlobalContext=WindowAndWorker].
     43        * html/canvas/ArrayBuffer.idl: Add [GlobalContext=WindowAndWorker].
     44        * html/canvas/DataView.idl: Add [GlobalContext=WindowAndWorker].
     45        * html/canvas/Float32Array.idl: Add [GlobalContext=WindowAndWorker].
     46        * html/canvas/Float64Array.idl: Add [GlobalContext=WindowAndWorker].
     47        * html/canvas/Int16Array.idl: Add [GlobalContext=WindowAndWorker].
     48        * html/canvas/Int32Array.idl: Add [GlobalContext=WindowAndWorker].
     49        * html/canvas/Int8Array.idl: Add [GlobalContext=WindowAndWorker].
     50        * html/canvas/Uint16Array.idl: Add [GlobalContext=WindowAndWorker].
     51        * html/canvas/Uint32Array.idl: Add [GlobalContext=WindowAndWorker].
     52        * html/canvas/Uint8Array.idl: Add [GlobalContext=WindowAndWorker].
     53        * html/canvas/Uint8ClampedArray.idl: Add [GlobalContext=WindowAndWorker].
     54        * workers/WorkerContext.idl: Remove several Constructor attributes which are now automatically
     55        generated.
     56        * workers/WorkerLocation.idl: Add [GlobalContext=WorkerOnly] and remove [NoInterfaceObject]
     57        as the interface should only be visible in worker environment as per the spec.
     58
    1592013-06-04  Kangil Han  <kangil.han@samsung.com>
    260
  • trunk/Source/WebCore/DerivedSources.make

    r151036 r151169  
    661661    $(SUPPLEMENTAL_DEPENDENCY_FILE) \
    662662    $(WINDOW_CONSTRUCTORS_FILE) \
     663    $(WORKERCONTEXT_CONSTRUCTORS_FILE) \
    663664    $(JS_DOM_HEADERS) \
    664665    $(WEB_DOM_HEADERS) \
     
    10061007SUPPLEMENTAL_MAKEFILE_DEPS = ./SupplementalDependencies.dep
    10071008WINDOW_CONSTRUCTORS_FILE = ./DOMWindowConstructors.idl
     1009WORKERCONTEXT_CONSTRUCTORS_FILE = ./WorkerContextConstructors.idl
    10081010IDL_FILES_TMP = ./idl_files.tmp
    10091011ADDITIONAL_IDLS = $(WebCore)/inspector/JavaScriptCallFrame.idl
     
    10171019$(SUPPLEMENTAL_MAKEFILE_DEPS) : $(PREPROCESS_IDLS_SCRIPTS) $(BINDING_IDLS) $(ADDITIONAL_IDLS) $(PLATFORM_FEATURE_DEFINES)
    10181020        printf "$(subst $(space),,$(patsubst %,%\n,$(BINDING_IDLS) $(ADDITIONAL_IDLS)))" > $(IDL_FILES_TMP)
    1019         $(call preprocess_idls_script, $(PREPROCESS_IDLS_SCRIPTS)) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --idlFilesList $(IDL_FILES_TMP) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) --windowConstructorsFile $(WINDOW_CONSTRUCTORS_FILE) --supplementalMakefileDeps $@
     1021        $(call preprocess_idls_script, $(PREPROCESS_IDLS_SCRIPTS)) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --idlFilesList $(IDL_FILES_TMP) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) --windowConstructorsFile $(WINDOW_CONSTRUCTORS_FILE) --workerContextConstructorsFile $(WORKERCONTEXT_CONSTRUCTORS_FILE) --supplementalMakefileDeps $@
    10201022        rm -f $(IDL_FILES_TMP)
    10211023
    1022 JS%.h : %.idl $(JS_BINDINGS_SCRIPTS) $(IDL_ATTRIBUTES_FILE) $(WINDOW_CONSTRUCTORS_FILE) $(PLATFORM_FEATURE_DEFINES)
     1024JS%.h : %.idl $(JS_BINDINGS_SCRIPTS) $(IDL_ATTRIBUTES_FILE) $(WINDOW_CONSTRUCTORS_FILE) $(WORKERCONTEXT_CONSTRUCTORS_FILE) $(PLATFORM_FEATURE_DEFINES)
    10231025        $(call generator_script, $(JS_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --idlAttributesFile $(IDL_ATTRIBUTES_FILE) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) $<
    10241026
  • trunk/Source/WebCore/DerivedSources.pri

    r150924 r151169  
    732732SUPPLEMENTAL_DEPENDENCY_FILE = supplemental_dependency.tmp
    733733WINDOW_CONSTRUCTORS_FILE = DOMWindowConstructors.idl
     734WORKERCONTEXT_CONSTRUCTORS_FILE = WorkerContextConstructors.idl
    734735IDL_FILES_TMP = ${QMAKE_FUNC_FILE_OUT_PATH}/idl_files.tmp
    735736PREPROCESS_IDLS_SCRIPT = $$PWD/bindings/scripts/preprocess-idls.pl
     
    750751                               --idlFilesList $$IDL_FILES_TMP \
    751752                               --supplementalDependencyFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$SUPPLEMENTAL_DEPENDENCY_FILE \
    752                                --windowConstructorsFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$WINDOW_CONSTRUCTORS_FILE
    753 preprocessIdls.output = $$SUPPLEMENTAL_DEPENDENCY_FILE $$WINDOW_CONSTRUCTORS_FILE
     753                               --windowConstructorsFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$WINDOW_CONSTRUCTORS_FILE \
     754                               --workerContextConstructorsFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$WORKERCONTEXT_CONSTRUCTORS_FILE
     755preprocessIdls.output = $$SUPPLEMENTAL_DEPENDENCY_FILE $$WINDOW_CONSTRUCTORS_FILE $$WORKERCONTEXT_CONSTRUCTORS_FILE
    754756preprocessIdls.add_output_to_sources = false
    755757preprocessIdls.depends = $$IDL_BINDINGS
  • trunk/Source/WebCore/GNUmakefile.am

    r150865 r151169  
    403403supplemental_dependency_file = $(top_builddir)/DerivedSources/WebCore/idl_supplemental_dependencies
    404404window_constructors_file = $(top_builddir)/DerivedSources/WebCore/DOMWindowConstructors.idl
     405workercontext_constructors_file = $(top_builddir)/DerivedSources/WebCore/WorkerContextConstructors.idl
    405406idl_files_list = $(top_builddir)/DerivedSources/WebCore/idl_files_list
    406407idl_attributes_file = $(WebCore)/bindings/scripts/IDLAttributes.txt
     
    411412        $(AM_V_at)echo -n > $(idl_files_list)
    412413        $(AM_V_at)($(foreach idl, $(dom_binding_idls), echo $(idl) &&) echo -n) >> $(idl_files_list)
    413         $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --idlFilesList $(idl_files_list) --windowConstructorsFile $(window_constructors_file) --supplementalDependencyFile $@
    414 
    415 .PHONY: $(window_constructors_file)
     414        $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --idlFilesList $(idl_files_list) --windowConstructorsFile $(window_constructors_file) --workerContextConstructorsFile $(workercontext_constructors_file) --supplementalDependencyFile $@
     415
     416.PHONY: $(window_constructors_file) $(workercontext_constructors_file)
    416417
    417418# This does not appear to work correctly with gnumake unless
     
    433434# which means that GNUmake will only try to build the dependencies first, but
    434435# not rebuild all the targets if the dependencies change.
    435 $(webkitgtk_sources) $(webkit2_sources) $(webkit2_plugin_process_sources) $(webcore_sources) $(webcoregtk_sources) $(platformgtk_sources) : | $(supplemental_dependency_file) $(window_constructors_file) $(webcore_built_sources)
     436$(webkitgtk_sources) $(webkit2_sources) $(webkit2_plugin_process_sources) $(webcore_sources) $(webcoregtk_sources) $(platformgtk_sources) : | $(supplemental_dependency_file) $(window_constructors_file) $(workercontext_constructors_file) $(webcore_built_sources)
    436437
    437438noinst_LTLIBRARIES += \
  • trunk/Source/WebCore/PlatformBlackBerry.cmake

    r150767 r151169  
    296296
    297297add_custom_command(
    298     OUTPUT ${SUPPLEMENTAL_DEPENDENCY_FILE} ${WINDOW_CONSTRUCTORS_FILE}
     298    OUTPUT ${SUPPLEMENTAL_DEPENDENCY_FILE} ${WINDOW_CONSTRUCTORS_FILE} ${WORKERCONTEXT_CONSTRUCTORS_FILE}
    299299    DEPENDS ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl ${SCRIPTS_RESOLVE_SUPPLEMENTAL} ${WebCore_CPP_IDL_FILES} ${IDL_ATTRIBUTES_FILE}
    300     COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} --idlAttributesFile ${IDL_ATTRIBUTES_FILE} --windowConstructorsFile ${WINDOW_CONSTRUCTORS_FILE}
     300    COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} --idlAttributesFile ${IDL_ATTRIBUTES_FILE} --windowConstructorsFile ${WINDOW_CONSTRUCTORS_FILE} --workerContextConstructorsFile ${WORKERCONTEXT_CONSTRUCTORS_FILE}
    301301    VERBATIM)
    302302
     
    308308    ${DERIVED_SOURCES_WEBCORE_DIR} WebDOM CPP
    309309    ${SUPPLEMENTAL_DEPENDENCY_FILE}
    310     ${WINDOW_CONSTRUCTORS_FILE})
     310    ${WINDOW_CONSTRUCTORS_FILE}
     311    ${WORKERCONTEXT_CONSTRUCTORS_FILE})
    311312
    312313# Generate contents for PopupPicker.cpp
  • trunk/Source/WebCore/UseJSC.cmake

    r150663 r151169  
    305305
    306306add_custom_command(
    307     OUTPUT ${SUPPLEMENTAL_DEPENDENCY_FILE} ${WINDOW_CONSTRUCTORS_FILE}
     307    OUTPUT ${SUPPLEMENTAL_DEPENDENCY_FILE} ${WINDOW_CONSTRUCTORS_FILE} ${WORKERCONTEXT_CONSTRUCTORS_FILE}
    308308    DEPENDS ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl ${SCRIPTS_PREPROCESS_IDLS} ${WebCore_IDL_FILES} ${WebCoreTestSupport_IDL_FILES}
    309     COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} --windowConstructorsFile ${WINDOW_CONSTRUCTORS_FILE}
     309    COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} --windowConstructorsFile ${WINDOW_CONSTRUCTORS_FILE} --workerContextConstructorsFile ${WORKERCONTEXT_CONSTRUCTORS_FILE}
    310310    VERBATIM)
    311311
     
    318318    ${IDL_ATTRIBUTES_FILE}
    319319    ${SUPPLEMENTAL_DEPENDENCY_FILE}
    320     ${WINDOW_CONSTRUCTORS_FILE})
     320    ${WINDOW_CONSTRUCTORS_FILE}
     321    ${WORKERCONTEXT_CONSTRUCTORS_FILE})
    321322
    322323GENERATE_BINDINGS(WebCoreTestSupport_SOURCES
     
    328329    ${IDL_ATTRIBUTES_FILE}
    329330    ${SUPPLEMENTAL_DEPENDENCY_FILE}
    330     ${WINDOW_CONSTRUCTORS_FILE})
     331    ${WINDOW_CONSTRUCTORS_FILE}
     332    ${WORKERCONTEXT_CONSTRUCTORS_FILE})
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt

    r150292 r151169  
    5757ExtendsDOMGlobalObject
    5858GenerateIsReachable=|Impl|ImplContext|ImplDocument|ImplElementRoot|ImplFrame|ImplOwnerNodeRoot
     59GlobalContext=WindowOnly|WorkerOnly|WindowAndWorker
    5960Immutable
    6061ImplementationLacksVTable
  • trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl

    r150283 r151169  
    3030my $supplementalDependencyFile;
    3131my $windowConstructorsFile;
     32my $workerContextConstructorsFile;
    3233my $supplementalMakefileDeps;
    3334
     
    3738           'supplementalDependencyFile=s' => \$supplementalDependencyFile,
    3839           'windowConstructorsFile=s' => \$windowConstructorsFile,
     40           'workerContextConstructorsFile=s' => \$workerContextConstructorsFile,
    3941           'supplementalMakefileDeps=s' => \$supplementalMakefileDeps);
    4042
     
    4244die('Must specify an output file using --supplementalDependencyFile.') unless defined($supplementalDependencyFile);
    4345die('Must specify an output file using --windowConstructorsFile.') unless defined($windowConstructorsFile);
     46die('Must specify an output file using --workerContextConstructorsFile.') unless defined($workerContextConstructorsFile);
    4447die('Must specify the file listing all IDLs using --idlFilesList.') unless defined($idlFilesList);
    4548
     
    5457my %supplementalDependencies;
    5558my %supplementals;
    56 my $constructorAttributesCode = "";
     59my $windowConstructorsCode = "";
     60my $workerContextConstructorsCode = "";
    5761# Get rid of duplicates in idlFiles array.
    5862my %idlFileHash = map { $_, 1 } @idlFiles;
     
    6973        my $extendedAttributes = getInterfaceExtendedAttributesFromIDL($idlFileContents);
    7074        unless ($extendedAttributes->{"NoInterfaceObject"}) {
    71             $constructorAttributesCode .= GenerateConstructorAttribute($interfaceName, $extendedAttributes);
     75            my $globalContext = $extendedAttributes->{"GlobalContext"} || "WindowOnly";
     76            my $attributeCode = GenerateConstructorAttribute($interfaceName, $extendedAttributes);
     77            $windowConstructorsCode .= $attributeCode unless $globalContext eq "WorkerOnly";
     78            $workerContextConstructorsCode .= $attributeCode unless $globalContext eq "WindowOnly"
    7279        }
    7380    }
     
    7885
    7986# Generate DOMWindow Constructors partial interface.
    80 open PARTIAL_WINDOW_FH, "> $windowConstructorsFile" or die "Cannot open $windowConstructorsFile\n";
    81 print PARTIAL_WINDOW_FH "partial interface DOMWindow {\n";
    82 print PARTIAL_WINDOW_FH $constructorAttributesCode;
    83 print PARTIAL_WINDOW_FH "};\n";
    84 close PARTIAL_WINDOW_FH;
    85 my $fullPath = Cwd::realpath($windowConstructorsFile);
    86 $supplementalDependencies{$fullPath} = "DOMWindow" if $interfaceNameToIdlFile{"DOMWindow"};
     87GeneratePartialInterface("DOMWindow", $windowConstructorsCode, $windowConstructorsFile);
     88
     89# Generate WorkerContext Constructors partial interface.
     90GeneratePartialInterface("WorkerContext", $workerContextConstructorsCode, $workerContextConstructorsFile);
    8791
    8892# Resolves partial interfaces dependencies.
     
    131135
    132136    close MAKE_FH;
     137}
     138
     139sub GeneratePartialInterface
     140{
     141    my $interfaceName = shift;
     142    my $attributesCode = shift;
     143    my $destinationFile = shift;
     144
     145    # Generate partial interface for global constructors.
     146    open PARTIAL_INTERFACE_FH, "> $destinationFile" or die "Cannot open $destinationFile\n";
     147    print PARTIAL_INTERFACE_FH "partial interface ${interfaceName} {\n";
     148    print PARTIAL_INTERFACE_FH $attributesCode;
     149    print PARTIAL_INTERFACE_FH "};\n";
     150    close PARTIAL_INTERFACE_FH;
     151    my $fullPath = Cwd::realpath($destinationFile);
     152    $supplementalDependencies{$fullPath} = $interfaceName if $interfaceNameToIdlFile{$interfaceName};
    133153}
    134154
  • trunk/Source/WebCore/dom/MessageEvent.idl

    r150580 r151169  
    2727
    2828[
     29    GlobalContext=WindowAndWorker,
    2930    JSNoStaticTables,
    3031    ConstructorTemplate=Event
  • trunk/Source/WebCore/fileapi/Blob.idl

    r150292 r151169  
    3030
    3131[
     32    GlobalContext=WindowAndWorker,
    3233    GenerateIsReachable=Impl,
    3334    CustomToJSObject,
  • trunk/Source/WebCore/fileapi/FileReader.idl

    r149368 r151169  
    3131
    3232[
     33    GlobalContext=WindowAndWorker,
    3334    Conditional=BLOB,
    3435    ActiveDOMObject,
  • trunk/Source/WebCore/fileapi/FileReaderSync.idl

    r150590 r151169  
    3030
    3131[
    32     NoInterfaceObject,
     32    GlobalContext=WorkerOnly,
    3333    Conditional=BLOB,
    3434    Constructor,
  • trunk/Source/WebCore/html/DOMURL.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    Conditional=BLOB,
    2930    Constructor,
  • trunk/Source/WebCore/html/canvas/ArrayBuffer.idl

    r150292 r151169  
    2525
    2626[
     27    GlobalContext=WindowAndWorker,
    2728    GenerateIsReachable=Impl,
    2829    CustomConstructor(unsigned long length),
  • trunk/Source/WebCore/html/canvas/DataView.idl

    r150292 r151169  
    2525
    2626[
     27    GlobalContext=WindowAndWorker,
    2728    CustomConstructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength),
    2829    CustomToJSObject,
  • trunk/Source/WebCore/html/canvas/Float32Array.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Float64Array.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Int16Array.idl

    r149368 r151169  
    2525
    2626[
     27    GlobalContext=WindowAndWorker,
    2728    ConstructorTemplate=TypedArray,
    2829    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Int32Array.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Int8Array.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Uint16Array.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Uint32Array.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Uint8Array.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/html/canvas/Uint8ClampedArray.idl

    r149368 r151169  
    2626
    2727[
     28    GlobalContext=WindowAndWorker,
    2829    ConstructorTemplate=TypedArray,
    2930    NumericIndexedGetter,
  • trunk/Source/WebCore/workers/WorkerContext.idl

    r149796 r151169  
    6969#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP
    7070    // Constructors
    71     attribute MessageEventConstructor MessageEvent;
    72     attribute WorkerLocationConstructor WorkerLocation;
    73 
    7471    [Conditional=CHANNEL_MESSAGING, CustomGetter] attribute MessageChannelConstructor MessageChannel;
    7572    [CustomGetter] attribute EventSourceConstructor EventSource;
     
    7774#endif
    7875
    79 #if defined(ENABLE_BLOB) && ENABLE_BLOB
    80     attribute BlobConstructor Blob;
    81     attribute FileReaderConstructor FileReader;
    82     attribute FileReaderSyncConstructor FileReaderSync;
    83 #endif
    84 
    85     [Conditional=BLOB] attribute DOMURLConstructor URL;
    8676    [Conditional=BLOB] attribute DOMURLConstructor webkitURL; // FIXME: deprecate this.
    87 
    88     attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator
    89     attribute Int8ArrayConstructor Int8Array; // Usable with new operator
    90     attribute Uint8ArrayConstructor Uint8Array; // Usable with new operator
    91     attribute Uint8ClampedArrayConstructor Uint8ClampedArray; // Usable with new operator
    92     attribute Int16ArrayConstructor Int16Array; // Usable with new operator
    93     attribute Uint16ArrayConstructor Uint16Array; // Usable with new operator
    94     attribute Int32ArrayConstructor Int32Array; // Usable with new operator
    95     attribute Uint32ArrayConstructor Uint32Array; // Usable with new operator
    96     attribute Float32ArrayConstructor Float32Array; // Usable with new operator
    97     attribute Float64ArrayConstructor Float64Array; // Usable with new operator
    98     attribute DataViewConstructor DataView; // Usable with new operator
    9977};
    10078
  • trunk/Source/WebCore/workers/WorkerLocation.idl

    r150590 r151169  
    2828
    2929[
    30     NoInterfaceObject,
     30    GlobalContext=WorkerOnly,
    3131    Conditional=WORKERS,
    3232    GenerateIsReachable=Impl,
  • trunk/Source/cmake/WebKitMacros.cmake

    r149796 r151169  
    3939    set(_args ${ARGN})
    4040    list(LENGTH _args _argCount)
    41     if (_argCount EQUAL 2)
     41    if (_argCount EQUAL 3)
    4242        list(GET _args 0 _supplemental_dependency_file)
    4343        if (_supplemental_dependency_file)
     
    4545        endif ()
    4646        list(GET _args 1 _window_constructors_file)
     47        list(GET _args 2 _workercontext_constructors_file)
    4748    endif ()
    4849
     
    5354            OUTPUT ${_destination}/${_prefix}${_name}.cpp ${_destination}/${_prefix}${_name}.h
    5455            MAIN_DEPENDENCY ${_file}
    55             DEPENDS ${BINDING_GENERATOR} ${SCRIPTS_BINDINGS} ${_supplemental_dependency_file} ${_idl_attributes_file} ${_window_constructors_file}
     56            DEPENDS ${BINDING_GENERATOR} ${SCRIPTS_BINDINGS} ${_supplemental_dependency_file} ${_idl_attributes_file} ${_window_constructors_file} ${_workercontext_constructors_file}
    5657            COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${BINDING_GENERATOR} --defines "${_features}" --generator ${_generator} ${_idl_includes} --outputDir "${_destination}" --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --idlAttributesFile ${_idl_attributes_file} ${_supplemental_dependency} ${_file}
    5758            WORKING_DIRECTORY ${_base_dir}
  • trunk/Tools/ChangeLog

    r151166 r151169  
     12013-06-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        Automatically generate WorkerContext constructor attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=117183
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Pass new --workerContextConstructorsFile to preprocess-idl.pl for bindings
     9        tests.
     10
     11        * Scripts/webkitpy/bindings/main.py:
     12        (BindingsTests.generate_supplemental_dependency):
     13        (BindingsTests.main):
     14
    1152013-06-04  Ryuan Choi  <ryuan.choi@samsung.com>
    216
  • trunk/Tools/Scripts/webkitpy/bindings/main.py

    r149796 r151169  
    6262        return exit_code
    6363
    64     def generate_supplemental_dependency(self, input_directory, supplemental_dependency_file, window_constructors_file):
     64    def generate_supplemental_dependency(self, input_directory, supplemental_dependency_file, window_constructors_file, workercontext_constructors_file):
    6565        idl_files_list = tempfile.mkstemp()
    6666        for input_file in os.listdir(input_directory):
     
    7777               '--defines', '',
    7878               '--supplementalDependencyFile', supplemental_dependency_file,
    79                '--windowConstructorsFile', window_constructors_file]
     79               '--windowConstructorsFile', window_constructors_file,
     80               '--workerContextConstructorsFile', workercontext_constructors_file]
    8081
    8182        exit_code = 0
     
    153154        supplemental_dependency_file = tempfile.mkstemp()[1]
    154155        window_constructors_file = tempfile.mkstemp()[1]
    155         if self.generate_supplemental_dependency(input_directory, supplemental_dependency_file, window_constructors_file):
     156        workercontext_constructors_file = tempfile.mkstemp()[1]
     157        if self.generate_supplemental_dependency(input_directory, supplemental_dependency_file, window_constructors_file, workercontext_constructors_file):
    156158            print 'Failed to generate a supplemental dependency file.'
    157159            os.remove(supplemental_dependency_file)
Note: See TracChangeset for help on using the changeset viewer.