Changeset 58298 in webkit


Ignore:
Timestamp:
Apr 27, 2010 2:12:18 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-04-27 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Remove custom bindings for TreeWalker
https://bugs.webkit.org/show_bug.cgi?id=38182

This custom code is just CallWith=ScriptState.

  • WebCore.gypi:
  • bindings/js/JSTreeWalkerCustom.cpp: (WebCore::JSTreeWalker::markChildren):
  • bindings/scripts/CodeGeneratorJS.pm:
  • bindings/scripts/CodeGeneratorV8.pm:
  • bindings/scripts/test/TestObj.idl:
  • bindings/v8/custom/V8TreeWalkerCustom.cpp: Removed.
  • dom/TreeWalker.idl:
Location:
trunk/WebCore
Files:
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r58296 r58298  
     12010-04-27  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Remove custom bindings for TreeWalker
     6        https://bugs.webkit.org/show_bug.cgi?id=38182
     7
     8        This custom code is just CallWith=ScriptState.
     9
     10        * WebCore.gypi:
     11        * bindings/js/JSTreeWalkerCustom.cpp:
     12        (WebCore::JSTreeWalker::markChildren):
     13        * bindings/scripts/CodeGeneratorJS.pm:
     14        * bindings/scripts/CodeGeneratorV8.pm:
     15        * bindings/scripts/test/TestObj.idl:
     16        * bindings/v8/custom/V8TreeWalkerCustom.cpp: Removed.
     17        * dom/TreeWalker.idl:
     18
    1192010-04-27  Eric Seidel  <eric@webkit.org>
    220
  • trunk/WebCore/WebCore.gypi

    r58236 r58298  
    788788            'bindings/v8/custom/V8StyleSheetCustom.cpp',
    789789            'bindings/v8/custom/V8StyleSheetListCustom.cpp',
    790             'bindings/v8/custom/V8TreeWalkerCustom.cpp',
    791790            'bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp',
    792791            'bindings/v8/custom/V8WebKitPointConstructor.cpp',
  • trunk/WebCore/bindings/js/JSTreeWalkerCustom.cpp

    r47022 r58298  
    3737        filter->markAggregate(markStack);
    3838}
    39    
    40 JSValue JSTreeWalker::parentNode(ExecState* exec, const ArgList&)
    41 {
    42     Node* node = impl()->parentNode(exec);
    43     if (exec->hadException())
    44         return jsUndefined();
    45     return toJS(exec, node);
    46 }
    47    
    48 JSValue JSTreeWalker::firstChild(ExecState* exec, const ArgList&)
    49 {
    50     Node* node = impl()->firstChild(exec);
    51     if (exec->hadException())
    52         return jsUndefined();
    53     return toJS(exec, node);
    54 }
    55    
    56 JSValue JSTreeWalker::lastChild(ExecState* exec, const ArgList&)
    57 {
    58     Node* node = impl()->lastChild(exec);
    59     if (exec->hadException())
    60         return jsUndefined();
    61     return toJS(exec, node);
    62 }
    63    
    64 JSValue JSTreeWalker::nextSibling(ExecState* exec, const ArgList&)
    65 {
    66     Node* node = impl()->nextSibling(exec);
    67     if (exec->hadException())
    68         return jsUndefined();
    69     return toJS(exec, node);
    70 }
    71    
    72 JSValue JSTreeWalker::previousSibling(ExecState* exec, const ArgList&)
    73 {
    74     Node* node = impl()->previousSibling(exec);
    75     if (exec->hadException())
    76         return jsUndefined();
    77     return toJS(exec, node);
    78 }
    79    
    80 JSValue JSTreeWalker::previousNode(ExecState* exec, const ArgList&)
    81 {
    82     Node* node = impl()->previousNode(exec);
    83     if (exec->hadException())
    84         return jsUndefined();
    85     return toJS(exec, node);
    86 }
    87    
    88 JSValue JSTreeWalker::nextNode(ExecState* exec, const ArgList&)
    89 {
    90     Node* node = impl()->nextNode(exec);
    91     if (exec->hadException())
    92         return jsUndefined();
    93     return toJS(exec, node);
    94 }
    9539
    9640}
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r58296 r58298  
    17051705
    17061706                my $callWith = $function->signature->extendedAttributes->{"CallWith"};
    1707                 if ($callWith && $callWith eq "DynamicFrame") {
    1708                     push(@implContent, "    Frame* dynamicFrame = toDynamicFrame(exec);\n");
    1709                     push(@implContent, "    if (!dynamicFrame)\n");
    1710                     push(@implContent, "        return jsUndefined();\n");
     1707                if ($callWith) {
     1708                    my $callWithArg = "COMPILE_ASSERT(false)";
     1709                    if ($callWith eq "DynamicFrame") {
     1710                        push(@implContent, "    Frame* dynamicFrame = toDynamicFrame(exec);\n");
     1711                        push(@implContent, "    if (!dynamicFrame)\n");
     1712                        push(@implContent, "        return jsUndefined();\n");
     1713                        $callWithArg = "dynamicFrame";
     1714                    } elsif ($callWith eq "ScriptState") {
     1715                        $callWithArg = "exec";
     1716                    }
    17111717                    $functionString .= ", " if $paramIndex;
    1712                     $functionString .= "dynamicFrame";
     1718                    $functionString .= $callWithArg;
    17131719                    $paramIndex++;
    17141720                }
     
    18861892    } else {
    18871893        push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n");
     1894        $callWith = $function->signature->extendedAttributes->{"CallWith"};
     1895        if ($callWith and $callWith eq "ScriptState") {
     1896            push(@implContent, $indent . "if (exec->hadException())\n");
     1897            push(@implContent, $indent . "    return jsUndefined();\n");
     1898        }
    18881899        push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions};
    18891900
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r58295 r58298  
    23342334
    23352335    my $index = 0;
     2336    my $hasScriptState = 0;
    23362337
    23372338    my $callWith = $function->signature->extendedAttributes->{"CallWith"};
    2338     if ($callWith && $callWith eq "DynamicFrame") {
    2339         $result .= $indent . "Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();\n";
    2340         $result .= $indent . "if (!enteredFrame)\n";
    2341         $result .= $indent . "    return v8::Undefined();\n";
     2339    if ($callWith) {
     2340        my $callWithArg = "COMPILE_ASSERT(false)";
     2341        if ($callWith eq "DynamicFrame") {
     2342            $result .= $indent . "Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();\n";
     2343            $result .= $indent . "if (!enteredFrame)\n";
     2344            $result .= $indent . "    return v8::Undefined();\n";
     2345            $callWithArg = "enteredFrame";
     2346        } elsif ($callWith eq "ScriptState") {
     2347            $result .= $indent . "EmptyScriptState state;\n";
     2348            $callWithArg = "&state";
     2349            $hasScriptState = 1;
     2350        }
    23422351        $functionString .= ", " if $index;
    2343         $functionString .= "enteredFrame";
     2352        $functionString .= $callWithArg;
    23442353        $index++;
    23452354        $numberOfParameters++
     
    23982407    } elsif ($returnsListItemPodType) {
    23992408        $result .= $indent . "RefPtr<SVGPODListItem<$nativeReturnType> > result = $functionString;\n";
    2400     } elsif (@{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) {
     2409    } elsif ($hasScriptState or @{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) {
    24012410        $result .= $indent . $nativeReturnType . " result = $functionString;\n";
    24022411    } else {
     
    24062415    }
    24072416
     2417    if ($hasScriptState) {
     2418        $result .= $indent . "if (state.hadException())\n";
     2419        $result .= $indent . "    return throwError(state.exception());\n"
     2420    }
     2421
    24082422    if (@{$function->raisesExceptions}) {
    2409         $result .= $indent . "if (UNLIKELY(ec))\n" . $indent . "    goto fail;\n";
     2423        $result .= $indent . "if (UNLIKELY(ec))\n";
     2424        $result .= $indent . "    goto fail;\n";
    24102425    }
    24112426
  • trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp

    r58295 r58298  
    184184    WebCore::TestObj * item = WebKit::core(self);
    185185    item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg);
     186
     187}
     188
     189void
     190webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self)
     191{
     192    g_return_if_fail (self);
     193    WebCore::TestObj * item = WebKit::core(self);
     194    item->withScriptStateVoid();
     195
     196}
     197
     198WebKitDOMTestObj*
     199webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self)
     200{
     201    g_return_val_if_fail (self, 0);
     202    WebCore::TestObj * item = WebKit::core(self);
     203    PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj());
     204    WebKitDOMTestObj*  res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
     205    return res;
    186206
    187207}
  • trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h

    r58295 r58298  
    8787
    8888WEBKIT_API void
     89webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self);
     90
     91WEBKIT_API WebKitDOMTestObj*
     92webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self);
     93
     94WEBKIT_API void
    8995webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt);
    9096
  • trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r58295 r58298  
    129129#endif
    130130
    131 static const HashTableValue JSTestObjPrototypeTableValues[19] =
     131static const HashTableValue JSTestObjPrototypeTableValues[21] =
    132132{
    133133    { "voidMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) },
     
    146146    { "withDynamicFrameAndUserGesture", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1 THUNK_GENERATOR(0) },
    147147    { "withDynamicFrameAndUserGestureASAD", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2 THUNK_GENERATOR(0) },
     148    { "withScriptStateVoid", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoid), (intptr_t)0 THUNK_GENERATOR(0) },
     149    { "withScriptStateObj", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) },
    148150    { "methodWithOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
    149151    { "methodWithNonOptionalArgAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
     
    582584}
    583585
     586JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     587{
     588    UNUSED_PARAM(args);
     589    if (!thisValue.inherits(&JSTestObj::s_info))
     590        return throwError(exec, TypeError);
     591    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     592    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     593
     594    imp->withScriptStateVoid(exec);
     595    return jsUndefined();
     596}
     597
     598JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     599{
     600    UNUSED_PARAM(args);
     601    if (!thisValue.inherits(&JSTestObj::s_info))
     602        return throwError(exec, TypeError);
     603    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     604    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     605
     606
     607    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->withScriptStateObj(exec)));
     608    if (exec->hadException())
     609        return jsUndefined();
     610    return result;
     611}
     612
    584613JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    585614{
  • trunk/WebCore/bindings/scripts/test/JS/JSTestObj.h

    r58295 r58298  
    101101JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
    102102JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     103JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     104JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
    103105JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
    104106JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
  • trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h

    r58295 r58298  
    6666- (void)withDynamicFrameAndUserGesture:(int)intArg;
    6767- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg;
     68- (void)withScriptStateVoid;
     69- (DOMTestObj *)withScriptStateObj;
    6870- (void)methodWithOptionalArg:(int)opt;
    6971- (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
  • trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm

    r58295 r58298  
    234234}
    235235
     236- (void)withScriptStateVoid
     237{
     238    IMPL->withScriptStateVoid();
     239}
     240
     241- (DOMTestObj *)withScriptStateObj
     242{
     243    return kit(WTF::getPtr(IMPL->withScriptStateObj()));
     244}
     245
    236246- (void)methodWithOptionalArg:(int)opt
    237247{
  • trunk/WebCore/bindings/scripts/test/TestObj.idl

    r58295 r58298  
    6767        [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGesture(in long intArg);
    6868        [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGestureASAD(in long intArg, in [Optional] long optionalArg);
     69        [CallWith=ScriptState] void withScriptStateVoid();
     70        [CallWith=ScriptState] TestObj withScriptStateObj();
    6971
    7072        // 'Optional' extended attribute
  • trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r58295 r58298  
    329329    imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, optionalArg, processingUserGesture());
    330330    return v8::Handle<v8::Value>();
     331}
     332
     333static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
     334{
     335    INC_STATS("DOM.TestObj.withScriptStateVoid");
     336    TestObj* imp = V8TestObj::toNative(args.Holder());
     337    EmptyScriptState state;
     338    imp->withScriptStateVoid(&state);
     339    if (state->hadException())
     340        return throwError(state->exception());
     341    return v8::Handle<v8::Value>();
     342}
     343
     344static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
     345{
     346    INC_STATS("DOM.TestObj.withScriptStateObj");
     347    TestObj* imp = V8TestObj::toNative(args.Holder());
     348    EmptyScriptState state;
     349    RefPtr<TestObj> result = imp->withScriptStateObj(&state);
     350    if (state->hadException())
     351        return throwError(state->exception());
     352    return toV8(result.release());
    331353}
    332354
     
    466488    {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback},
    467489    {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback},
     490    {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
     491    {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
    468492    {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
    469493    {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
  • trunk/WebCore/dom/TreeWalker.idl

    r52537 r58298  
    3232                     setter raises(DOMException);
    3333
    34         [Custom] Node parentNode();
    35         [Custom] Node firstChild();
    36         [Custom] Node lastChild();
    37         [Custom] Node previousSibling();
    38         [Custom] Node nextSibling();
    39         [Custom] Node previousNode();
    40         [Custom] Node nextNode();
     34        [CallWith=ScriptState] Node parentNode();
     35        [CallWith=ScriptState] Node firstChild();
     36        [CallWith=ScriptState] Node lastChild();
     37        [CallWith=ScriptState] Node previousSibling();
     38        [CallWith=ScriptState] Node nextSibling();
     39        [CallWith=ScriptState] Node previousNode();
     40        [CallWith=ScriptState] Node nextNode();
    4141    };
    4242
Note: See TracChangeset for help on using the changeset viewer.