Changeset 96788 in webkit


Ignore:
Timestamp:
Oct 5, 2011 11:00:41 PM (13 years ago)
Author:
haraken@chromium.org
Message:

Refactor IDL attributes about constructor
https://bugs.webkit.org/show_bug.cgi?id=69074

Reviewed by Adam Barth.

Currently, IDL attributes about constructor are confusing:

  • [CustomConstructFunction] means that there is a custom constructor for JSC.
  • [V8CustomConstructor] means that there is a custom constructor for V8.
  • [CustomConstructor] exists in CodeGenerator*.pm but is not used in any IDL files.
  • For almost all IDL files, [CustomConstructFunction] and [V8CustomConstructor] are used at the same time.
  • ObjC, CPP and GObject bindings do not support custom constructors.

This patch makes the following changes:

  • Rename [CustomConstructFunction] to [JSCustomConstructor].
  • [JSCustomConstructor] means that there is a custom constructor for JSC.
  • [V8CustomConstructor] means that there is a custom constructor for V8.
  • [CustomConstructor] means that there is a custom constructor for both JSC and V8.

No new tests. No change in behavior. Confirm that build succeeds.

  • bindings/scripts/CodeGeneratorJS.pm: Removed [CustomConstructFunction] and added [JSCustomConstructor]

(GenerateHeader):
(GenerateAttributesHashTable):
(GenerateImplementation):
(GenerateConstructorDefinition):

  • css/WebKitCSSMatrix.idl: Renamed [CustomConstructFunction] to [JSCustomConstructor]. If both [JSCustomConstructor] and [V8CustomConstructor] are specified, then we replaced them with [CustomConstructor].
  • dom/CustomEvent.idl: Ditto.
  • dom/ErrorEvent.idl: Ditto.
  • dom/Event.idl: Ditto.
  • dom/HashChangeEvent.idl: Ditto.
  • dom/MessageChannel.idl: Ditto.
  • dom/MessageEvent.idl: Ditto.
  • dom/PageTransitionEvent.idl: Ditto.
  • dom/PopStateEvent.idl: Ditto.
  • dom/ProgressEvent.idl: Ditto.
  • dom/WebKitAnimationEvent.idl: Ditto.
  • html/DOMFormData.idl: Ditto.
  • html/canvas/ArrayBuffer.idl: Ditto.
  • html/canvas/DataView.idl: Ditto.
  • html/canvas/Float32Array.idl: Ditto.
  • html/canvas/Float64Array.idl: Ditto.
  • html/canvas/Int16Array.idl: Ditto.
  • html/canvas/Int32Array.idl: Ditto.
  • html/canvas/Int8Array.idl: Ditto.
  • html/canvas/Uint16Array.idl: Ditto.
  • html/canvas/Uint32Array.idl: Ditto.
  • html/canvas/Uint8Array.idl: Ditto.
  • p2p/PeerConnection.idl: Ditto.
  • page/EventSource.idl: Ditto.
  • page/WebKitPoint.idl: Ditto.
  • webaudio/AudioContext.idl: Ditto.
  • websockets/CloseEvent.idl: Ditto.
  • websockets/WebSocket.idl: Ditto.
  • workers/SharedWorker.idl: Ditto.
  • workers/Worker.idl: Ditto.
  • xml/XMLHttpRequest.idl: Ditto.
  • xml/XSLTProcessor.idl: Ditto.
Location:
trunk/Source/WebCore
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96786 r96788  
     12011-10-05  Kentaro Hara  <haraken@chromium.org>
     2
     3        Refactor IDL attributes about constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=69074
     5
     6        Reviewed by Adam Barth.
     7
     8        Currently, IDL attributes about constructor are confusing:
     9
     10        - [CustomConstructFunction] means that there is a custom constructor for JSC.
     11        - [V8CustomConstructor] means that there is a custom constructor for V8.
     12        - [CustomConstructor] exists in CodeGenerator*.pm but is not used in any IDL files.
     13        - For almost all IDL files, [CustomConstructFunction] and [V8CustomConstructor] are used at the same time.
     14        - ObjC, CPP and GObject bindings do not support custom constructors.
     15
     16        This patch makes the following changes:
     17
     18        - Rename [CustomConstructFunction] to [JSCustomConstructor].
     19        - [JSCustomConstructor] means that there is a custom constructor for JSC.
     20        - [V8CustomConstructor] means that there is a custom constructor for V8.
     21        - [CustomConstructor] means that there is a custom constructor for both JSC and V8.
     22
     23        No new tests. No change in behavior. Confirm that build succeeds.
     24
     25        * bindings/scripts/CodeGeneratorJS.pm: Removed [CustomConstructFunction] and added [JSCustomConstructor]
     26        (GenerateHeader):
     27        (GenerateAttributesHashTable):
     28        (GenerateImplementation):
     29        (GenerateConstructorDefinition):
     30        * css/WebKitCSSMatrix.idl: Renamed [CustomConstructFunction] to [JSCustomConstructor]. If both [JSCustomConstructor] and [V8CustomConstructor] are specified, then we replaced them with [CustomConstructor].
     31        * dom/CustomEvent.idl: Ditto.
     32        * dom/ErrorEvent.idl: Ditto.
     33        * dom/Event.idl: Ditto.
     34        * dom/HashChangeEvent.idl: Ditto.
     35        * dom/MessageChannel.idl: Ditto.
     36        * dom/MessageEvent.idl: Ditto.
     37        * dom/PageTransitionEvent.idl: Ditto.
     38        * dom/PopStateEvent.idl: Ditto.
     39        * dom/ProgressEvent.idl: Ditto.
     40        * dom/WebKitAnimationEvent.idl: Ditto.
     41        * html/DOMFormData.idl: Ditto.
     42        * html/canvas/ArrayBuffer.idl: Ditto.
     43        * html/canvas/DataView.idl: Ditto.
     44        * html/canvas/Float32Array.idl: Ditto.
     45        * html/canvas/Float64Array.idl: Ditto.
     46        * html/canvas/Int16Array.idl: Ditto.
     47        * html/canvas/Int32Array.idl: Ditto.
     48        * html/canvas/Int8Array.idl: Ditto.
     49        * html/canvas/Uint16Array.idl: Ditto.
     50        * html/canvas/Uint32Array.idl: Ditto.
     51        * html/canvas/Uint8Array.idl: Ditto.
     52        * p2p/PeerConnection.idl: Ditto.
     53        * page/EventSource.idl: Ditto.
     54        * page/WebKitPoint.idl: Ditto.
     55        * webaudio/AudioContext.idl: Ditto.
     56        * websockets/CloseEvent.idl: Ditto.
     57        * websockets/WebSocket.idl: Ditto.
     58        * workers/SharedWorker.idl: Ditto.
     59        * workers/Worker.idl: Ditto.
     60        * xml/XMLHttpRequest.idl: Ditto.
     61        * xml/XSLTProcessor.idl: Ditto.
     62
    1632011-10-03  Andy Estes  <aestes@apple.com>
    264
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r96346 r96788  
    760760
    761761    my $hasGetter = $numAttributes > 0
    762                  || !($dataNode->extendedAttributes->{"OmitConstructor"}
    763                  || $dataNode->extendedAttributes->{"CustomConstructor"})
     762                 || !$dataNode->extendedAttributes->{"OmitConstructor"}
    764763                 || $dataNode->extendedAttributes->{"HasIndexGetter"}
    765764                 || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}
     
    857856
    858857    # Constructor object getter
    859     push(@headerContent, "    static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);\n") if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"}));
     858    push(@headerContent, "    static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);\n") if !$dataNode->extendedAttributes->{"OmitConstructor"};
    860859
    861860    my $numCustomFunctions = 0;
     
    10721071
    10731072    # Conditionally emit the constructor object's declaration
    1074     if ($dataNode->extendedAttributes->{"CustomConstructFunction"}) {
     1073    if ($dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"}) {
    10751074        GenerateConstructorDeclaration(\@headerContent, $className, $dataNode);
    10761075    }
     
    10861085    }
    10871086
    1088     if ($numAttributes > 0 || !($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
     1087    if ($numAttributes > 0 || !$dataNode->extendedAttributes->{"OmitConstructor"}) {
    10891088        push(@headerContent,"// Attributes\n\n");
    10901089        foreach my $attribute (@{$dataNode->attributes}) {
     
    10971096        }
    10981097       
    1099         if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
     1098        if (!$dataNode->extendedAttributes->{"OmitConstructor"}) {
    11001099            my $getter = "js" . $interfaceName . "Constructor";
    11011100            push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);\n");
     
    11381137    # - Add all attributes in a hashtable definition
    11391138    my $numAttributes = @{$dataNode->attributes};
    1140     $numAttributes++ if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"}));
     1139    $numAttributes++ if !$dataNode->extendedAttributes->{"OmitConstructor"};
    11411140
    11421141    return 0  if !$numAttributes;
     
    11801179    }
    11811180
    1182     if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
     1181    if (!$dataNode->extendedAttributes->{"OmitConstructor"}) {
    11831182        push(@hashKeys, "constructor");
    11841183        my $getter = "js" . $interfaceName . "Constructor";
     
    13391338
    13401339    # - Add all constants
    1341     if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
     1340    if (!$dataNode->extendedAttributes->{"OmitConstructor"}) {
    13421341        my $hashSize = $numConstants;
    13431342        my $hashName = $className . "ConstructorTable";
     
    13651364        my $protoClassName = "${className}Prototype";
    13661365
    1367         GenerateConstructorDeclaration(\@implContent, $className, $dataNode) unless $dataNode->extendedAttributes->{"CustomConstructFunction"};
     1366        GenerateConstructorDeclaration(\@implContent, $className, $dataNode) unless ($dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"});
    13681367        GenerateConstructorDefinition(\@implContent, $className, $protoClassName, $interfaceName, $visibleClassName, $dataNode);
    13691368    }
     
    15541553
    15551554    my $hasGetter = $numAttributes > 0
    1556                  || !($dataNode->extendedAttributes->{"OmitConstructor"}
    1557                  || $dataNode->extendedAttributes->{"CustomConstructor"})
     1555                 || !$dataNode->extendedAttributes->{"OmitConstructor"}
    15581556                 || $dataNode->extendedAttributes->{"HasIndexGetter"}
    15591557                 || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}
     
    17081706            }
    17091707
    1710             if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
     1708            if (!$dataNode->extendedAttributes->{"OmitConstructor"}) {
    17111709                my $constructorFunctionName = "js" . $interfaceName . "Constructor";
    17121710
     
    19291927    }
    19301928
    1931     if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
     1929    if (!$dataNode->extendedAttributes->{"OmitConstructor"}) {
    19321930        push(@implContent, "JSValue ${className}::getConstructor(ExecState* exec, JSGlobalObject* globalObject)\n{\n");
    19331931        push(@implContent, "    return getDOMConstructor<${className}Constructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));\n");
     
    31713169    my $constructorClassName = "${className}Constructor";
    31723170    my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"};
    3173     my $customConstructFunction = $dataNode->extendedAttributes->{"CustomConstructFunction"};
     3171    my $customConstructor = $dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"};
    31743172    my $callWith = $dataNode->extendedAttributes->{"CallWith"};
    31753173    my $numberOfconstructParameters = $dataNode->extendedAttributes->{"ConstructorParameters"};
     
    32053203
    32063204    if ($canConstruct) {
    3207         if (!$customConstructFunction) {
     3205        if (!$customConstructor) {
    32083206            push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)\n");
    32093207            push(@$outputArray, "{\n");
  • trunk/Source/WebCore/css/WebKitCSSMatrix.idl

    r94891 r96788  
    2929    interface [
    3030        CanBeConstructed,
    31         CustomConstructFunction,
     31        JSCustomConstructor,
    3232        ConstructorParameters=1,
    3333        Constructor(in [Optional=CallWithNullValue] DOMString cssValue),
  • trunk/Source/WebCore/dom/CustomEvent.idl

    r94480 r96788  
    3030    interface [
    3131        CanBeConstructed,
    32         CustomConstructFunction,
    33         V8CustomConstructor
     32        CustomConstructor
    3433    ] CustomEvent : Event {
    3534
  • trunk/Source/WebCore/dom/ErrorEvent.idl

    r96208 r96788  
    3434        NoStaticTables,
    3535        CanBeConstructed,
    36         CustomConstructFunction,
    37         V8CustomConstructor
     36        CustomConstructor
    3837    ] ErrorEvent : Event {
    3938
  • trunk/Source/WebCore/dom/Event.idl

    r94424 r96788  
    2525        CustomToJS,
    2626        CanBeConstructed,
    27         CustomConstructFunction,
    28         V8CustomConstructor,
     27        CustomConstructor,
    2928        NoStaticTables,
    3029        Polymorphic
  • trunk/Source/WebCore/dom/HashChangeEvent.idl

    r95063 r96788  
    2323    interface [
    2424        CanBeConstructed,
    25         CustomConstructFunction,
    26         V8CustomConstructor
     25        CustomConstructor
    2726    ] HashChangeEvent : Event {
    2827        void initHashChangeEvent(in [Optional=CallWithDefaultValue] DOMString type,
  • trunk/Source/WebCore/dom/MessageChannel.idl

    r89269 r96788  
    2929    interface [
    3030        CanBeConstructed,
    31         CustomConstructFunction,
    32         V8CustomConstructor,
     31        CustomConstructor,
    3332        CustomMarkFunction,
    3433        NoStaticTables
  • trunk/Source/WebCore/dom/MessageEvent.idl

    r96179 r96788  
    3131        NoStaticTables,
    3232        CanBeConstructed,
    33         CustomConstructFunction
     33        JSCustomConstructor
    3434    ] MessageEvent : Event {
    3535        readonly attribute DOMString origin;
  • trunk/Source/WebCore/dom/PageTransitionEvent.idl

    r96180 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor
     30        CustomConstructor
    3231    ] PageTransitionEvent : Event {
    3332
  • trunk/Source/WebCore/dom/PopStateEvent.idl

    r96212 r96788  
    3030    interface [
    3131        CanBeConstructed,
    32         CustomConstructFunction,
    33         V8CustomConstructor
     32        CustomConstructor,
    3433    ] PopStateEvent : Event {
    3534        void initPopStateEvent(in [Optional=CallWithDefaultValue] DOMString typeArg,
  • trunk/Source/WebCore/dom/ProgressEvent.idl

    r94946 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor
     30        CustomConstructor
    3231    ] ProgressEvent : Event {
    3332        readonly attribute boolean lengthComputable;
  • trunk/Source/WebCore/dom/WebKitAnimationEvent.idl

    r94953 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor
     30        CustomConstructor
    3231    ] WebKitAnimationEvent : Event {
    3332     readonly attribute DOMString          animationName;
  • trunk/Source/WebCore/html/DOMFormData.idl

    r92327 r96788  
    3333    interface [
    3434        CanBeConstructed,
    35         CustomConstructFunction,
    36         V8CustomConstructor,
     35        CustomConstructor,
    3736        GenerateNativeConverter,
    3837        GenerateToJS
  • trunk/Source/WebCore/html/canvas/ArrayBuffer.idl

    r89269 r96788  
    2929        GenerateIsReachable=Impl,
    3030        CanBeConstructed,
    31         CustomConstructFunction,
    32         NoStaticTables,
    33         V8CustomConstructor,
     31        CustomConstructor,
     32        NoStaticTables
    3433    ] ArrayBuffer {
    3534        readonly attribute int byteLength;
  • trunk/Source/WebCore/html/canvas/DataView.idl

    r89269 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
     30        CustomConstructor,
    3131        CustomToJS,
    3232        NoStaticTables,
    33         V8CustomConstructor
    3433    ] DataView : ArrayBufferView {
    3534        // All these methods raise an exception if they would read or write beyond the end of the view.
  • trunk/Source/WebCore/html/canvas/Float32Array.idl

    r92443 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor,
     30        CustomConstructor,
    3231        HasNumericIndexGetter,
    3332        HasCustomIndexSetter,
  • trunk/Source/WebCore/html/canvas/Float64Array.idl

    r92443 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor,
     30        CustomConstructor,
    3231        HasNumericIndexGetter,
    3332        HasCustomIndexSetter,
  • trunk/Source/WebCore/html/canvas/Int16Array.idl

    r92443 r96788  
    2727    interface [
    2828        CanBeConstructed,
    29         CustomConstructFunction,
    30         V8CustomConstructor,
     29        CustomConstructor,
    3130        HasNumericIndexGetter,
    3231        HasCustomIndexSetter,
  • trunk/Source/WebCore/html/canvas/Int32Array.idl

    r92443 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor,
     30        CustomConstructor,
    3231        HasNumericIndexGetter,
    3332        HasCustomIndexSetter,
  • trunk/Source/WebCore/html/canvas/Int8Array.idl

    r92443 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor,
     30        CustomConstructor,
    3231        HasNumericIndexGetter,
    3332        HasCustomIndexSetter,
  • trunk/Source/WebCore/html/canvas/Uint16Array.idl

    r92443 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor,
     30        CustomConstructor,
    3231        HasNumericIndexGetter,
    3332        HasCustomIndexSetter,
  • trunk/Source/WebCore/html/canvas/Uint32Array.idl

    r92443 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor,
     30        CustomConstructor,
    3231        HasNumericIndexGetter,
    3332        HasCustomIndexSetter,
  • trunk/Source/WebCore/html/canvas/Uint8Array.idl

    r92443 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
    31         V8CustomConstructor,
     30        CustomConstructor,
    3231        HasNumericIndexGetter,
    3332        HasCustomIndexSetter,
  • trunk/Source/WebCore/p2p/PeerConnection.idl

    r92304 r96788  
    2828        Conditional=MEDIA_STREAM,
    2929        CanBeConstructed,
    30         CustomConstructFunction,
     30        CustomConstructor,
    3131        ConstructorParameters=2,
    32         V8CustomConstructor,
    3332        EventTarget
    3433    ] PeerConnection {
  • trunk/Source/WebCore/page/EventSource.idl

    r95501 r96788  
    3535        ActiveDOMObject,
    3636        CanBeConstructed,
    37         CustomConstructFunction,
     37        JSCustomConstructor,
    3838        ConstructorParameters=1,
    3939        Constructor(in DOMString scriptUrl),
  • trunk/Source/WebCore/page/WebKitPoint.idl

    r89269 r96788  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction,
     30        CustomConstructor,
    3131        ConstructorParameters=2,
    32         V8CustomConstructor
    3332    ] WebKitPoint {
    3433        attribute float x;
  • trunk/Source/WebCore/webaudio/AudioContext.idl

    r94397 r96788  
    2929        ActiveDOMObject,
    3030        CanBeConstructed,
    31         CustomConstructFunction,
    32         V8CustomConstructor,
     31        CustomConstructor,
    3332        CustomMarkFunction,
    3433#if defined(V8_BINDING) && V8_BINDING
  • trunk/Source/WebCore/websockets/CloseEvent.idl

    r96061 r96788  
    3434        NoStaticTables,
    3535        CanBeConstructed,
    36         CustomConstructFunction,
    37         V8CustomConstructor
     36        CustomConstructor
    3837    ] CloseEvent : Event {
    3938        readonly attribute boolean wasClean;
  • trunk/Source/WebCore/websockets/WebSocket.idl

    r96785 r96788  
    3636        ActiveDOMObject,
    3737        CanBeConstructed,
    38         CustomConstructFunction,
     38        CustomConstructor,
    3939        ConstructorParameters=1,
    40         V8CustomConstructor,
    4140        EventTarget,
    4241        NoStaticTables
  • trunk/Source/WebCore/workers/SharedWorker.idl

    r89269 r96788  
    3636        ActiveDOMObject,
    3737        CanBeConstructed,
    38         CustomConstructFunction,
     38        CustomConstructor,
    3939        ConstructorParameters=2,
    40         V8CustomConstructor,
    4140        CustomMarkFunction,
    4241        GenerateNativeConverter,
  • trunk/Source/WebCore/workers/Worker.idl

    r95362 r96788  
    3232        ActiveDOMObject,
    3333        CanBeConstructed,
    34         CustomConstructFunction,
     34        JSCustomConstructor,
    3535        ConstructorParameters=1,
    3636        Constructor(in DOMString scriptUrl),
  • trunk/Source/WebCore/xml/XMLHttpRequest.idl

    r95165 r96788  
    3232        ActiveDOMObject,
    3333        CanBeConstructed,
    34         CustomConstructFunction,
    35         V8CustomConstructor,
     34        CustomConstructor,
    3635        CustomMarkFunction,
    3736        EventTarget,
  • trunk/Source/WebCore/xml/XSLTProcessor.idl

    r94350 r96788  
    3636        Conditional=XSLT,
    3737        CanBeConstructed,
    38         CustomConstructFunction,
     38        JSCustomConstructor,
    3939        Constructor
    4040    ] XSLTProcessor {
Note: See TracChangeset for help on using the changeset viewer.