Changeset 194100 in webkit


Ignore:
Timestamp:
Dec 15, 2015 12:55:23 AM (8 years ago)
Author:
youenn.fablet@crf.canon.fr
Message:

WebIDL generator should support the possibility for C++ classes to have a JS Builtin constructor
https://bugs.webkit.org/show_bug.cgi?id=152171

Reviewed by Darin Adler.

Reintroducing JSBuiltinConstructor keyword as a way to run automatically a JS builtin initialization function
to process the arguments passed to the DOM C++ constructor.

Specialized createJSObject for those classes.

Fixing typo in TestCustomConstructor.idl.

Covered by binding tests.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateConstructorDefinition):
(IsConstructable):
(IsJSBuiltinConstructor):
(AddJSBuiltinIncludesIfNeeded):

  • bindings/scripts/test/GObject/WebKitDOMTestClassWithJSBuiltinConstructor.cpp: Added.
  • bindings/scripts/test/GObject/WebKitDOMTestClassWithJSBuiltinConstructor.h: Added.
  • bindings/scripts/test/GObject/WebKitDOMTestClassWithJSBuiltinConstructorPrivate.h: Added.
  • bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: Added.
  • bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h: Added.
  • bindings/scripts/test/ObjC/DOMTestClassWithJSBuiltinConstructor.h: Added.
  • bindings/scripts/test/ObjC/DOMTestClassWithJSBuiltinConstructor.mm: Added.
  • bindings/scripts/test/ObjC/DOMTestClassWithJSBuiltinConstructorInternal.h: Added.
  • bindings/scripts/test/TestClassWithJSBuiltinConstructor.idl: Copied from Source/WebCore/bindings/scripts/test/TestCustomConstructor.idl.
  • bindings/scripts/test/TestCustomConstructor.idl:
Location:
trunk/Source/WebCore
Files:
8 added
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r194057 r194100  
     12015-12-15  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        WebIDL generator should support the possibility for C++ classes to have a JS Builtin constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=152171
     5
     6        Reviewed by Darin Adler.
     7
     8        Reintroducing JSBuiltinConstructor keyword as a way to run automatically a JS builtin initialization function
     9        to process the arguments passed to the DOM C++ constructor.
     10
     11        Specialized createJSObject for those classes.
     12
     13        Fixing typo in TestCustomConstructor.idl.
     14
     15        Covered by binding tests.
     16
     17        * bindings/scripts/CodeGeneratorJS.pm:
     18        (GenerateConstructorDefinition):
     19        (IsConstructable):
     20        (IsJSBuiltinConstructor):
     21        (AddJSBuiltinIncludesIfNeeded):
     22        * bindings/scripts/test/GObject/WebKitDOMTestClassWithJSBuiltinConstructor.cpp: Added.
     23        * bindings/scripts/test/GObject/WebKitDOMTestClassWithJSBuiltinConstructor.h: Added.
     24        * bindings/scripts/test/GObject/WebKitDOMTestClassWithJSBuiltinConstructorPrivate.h: Added.
     25        * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: Added.
     26        * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h: Added.
     27        * bindings/scripts/test/ObjC/DOMTestClassWithJSBuiltinConstructor.h: Added.
     28        * bindings/scripts/test/ObjC/DOMTestClassWithJSBuiltinConstructor.mm: Added.
     29        * bindings/scripts/test/ObjC/DOMTestClassWithJSBuiltinConstructorInternal.h: Added.
     30        * bindings/scripts/test/TestClassWithJSBuiltinConstructor.idl: Copied from Source/WebCore/bindings/scripts/test/TestCustomConstructor.idl.
     31        * bindings/scripts/test/TestCustomConstructor.idl:
     32
    1332015-12-14  Andreas Kling  <akling@apple.com>
    234
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r193101 r194100  
    47284728    my $function = shift;
    47294729
    4730     return if IsJSBuiltinConstructor($interface);
     4730
     4731    if (IsJSBuiltinConstructor($interface)) {
     4732        if ($interface->extendedAttributes->{"JSBuiltinConstructor"}) {
     4733            # FIXME: Add support for ConstructorCallWith
     4734            push(@$outputArray, <<END);
     4735template<> JSC::JSObject* ${className}Constructor::createJSObject()
     4736{
     4737    return ${className}::create(getDOMStructure<${className}>(globalObject()->vm(), *globalObject()), globalObject(), ${interfaceName}::create());
     4738}
     4739
     4740END
     4741        }
     4742        return;
     4743    }
    47314744
    47324745    my $constructorClassName = $generatingNamedConstructor ? "${className}NamedConstructor" : "${className}Constructor";
     
    50355048    my $interface = shift;
    50365049
    5037     return HasCustomConstructor($interface) || $interface->extendedAttributes->{"Constructor"} || $interface->extendedAttributes->{"NamedConstructor"} || $interface->extendedAttributes->{"ConstructorTemplate"};
     5050    return HasCustomConstructor($interface) || $interface->extendedAttributes->{"Constructor"} || $interface->extendedAttributes->{"NamedConstructor"} || $interface->extendedAttributes->{"ConstructorTemplate"} || $interface->extendedAttributes->{"JSBuiltinConstructor"};
    50385051}
    50395052
     
    50835096    return 0 if $interface->extendedAttributes->{"CustomConstructor"};
    50845097    return 1 if $interface->extendedAttributes->{"JSBuiltin"};
     5098    return 1 if $interface->extendedAttributes->{"JSBuiltinConstructor"};
    50855099    return 0;
    50865100}
     
    51135127    my $interface = shift;
    51145128
    5115     if ($interface->extendedAttributes->{"JSBuiltin"}) {
     5129    if ($interface->extendedAttributes->{"JSBuiltin"} || $interface->extendedAttributes->{"JSBuiltinConstructor"}) {
    51165130        AddToImplIncludes($interface->name . "Builtins.h");
    51175131        return;
  • trunk/Source/WebCore/bindings/scripts/test/TestClassWithJSBuiltinConstructor.idl

    r194095 r194100  
    2828
    2929[
    30     CustomConstructor,
    31     JSBuiltIn,
    32     NoInterfaceObject
    33 ] interface TestCustomConstructorWithNoInterfaceObject {
     30    JSBuiltinConstructor
     31] interface TestClassWithJSBuiltinConstructor {
    3432};
    35 
  • trunk/Source/WebCore/bindings/scripts/test/TestCustomConstructor.idl

    r191885 r194100  
    2929[
    3030    CustomConstructor,
    31     JSBuiltIn,
    3231    NoInterfaceObject
    3332] interface TestCustomConstructorWithNoInterfaceObject {
    3433};
    35 
Note: See TracChangeset for help on using the changeset viewer.