Changeset 166070 in webkit
- Timestamp:
- Mar 21, 2014 10:29:03 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r166069 r166070 1 2014-03-21 Michael Saboff <msaboff@apple.com> 2 3 Change CodeGeneratorJS.pm special cases for "DOMWindow" to be general purpose 4 https://bugs.webkit.org/show_bug.cgi?id=130553 5 6 Reviewed by Geoffrey Garen. 7 8 Eliminated 'if ($interfaceName eq "DOMWindow") {' sections in CodeGeneratorJS where 9 it was used to do DOMWindow specific casting to a JSObject, either a JSDOMWindow* or 10 a JSDOMWindowShell*. Instead the code generator will use the existing 11 JSDOMWindow* toJSDOMWindow(JSValue value) function based on a newly added attribute 12 "CustomProxyToJSObject". That attribute will emit a call to the function 13 ${className}* to${className}(JSValue). 14 15 This is being done to clean up the code generator and for a subsequent patch that 16 will use a similar custom to{className} function for workers, 17 JSDedicatedWorkerGlobalScope* toJSDedicatedWorkerGlobalScope(JSValue). 18 19 Changes covered by existing tests. 20 21 * bindings/scripts/CodeGeneratorJS.pm: 22 (GenerateImplementation): 23 * bindings/scripts/IDLAttributes.txt: 24 * page/DOMWindow.idl: 25 1 26 2014-03-21 Krzysztof Czech <k.czech@samsung.com> 2 27 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r165914 r166070 2128 2128 2129 2129 if (!$attribute->isStatic || $attribute->signature->type =~ /Constructor$/) { 2130 if ($interfaceName eq "DOMWindow") { 2131 push(@implContent, " ${className}* castedThis = jsDynamicCast<$className*>(JSValue::decode(thisValue));\n"); 2132 push(@implContent, " if (UNLIKELY(!castedThis)) {\n"); 2133 push(@implContent, " if (JSDOMWindowShell* shell = jsDynamicCast<JSDOMWindowShell*>(JSValue::decode(thisValue)))\n"); 2134 push(@implContent, " castedThis = shell->window();\n"); 2135 push(@implContent, " }\n"); 2130 if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) { 2131 push(@implContent, " ${className}* castedThis = to${className}(JSValue::decode(thisValue));\n"); 2136 2132 push(@implContent, " UNUSED_PARAM(slotBase);\n"); 2137 2133 } else { … … 2351 2347 push(@implContent, " UNUSED_PARAM(baseValue);\n"); 2352 2348 push(@implContent, " UNUSED_PARAM(thisValue);\n"); 2353 if ($interfaceName eq "DOMWindow") { 2354 push(@implContent, " ${className}* domObject = jsDynamicCast<$className*>(JSValue::decode(thisValue));\n"); 2355 push(@implContent, " if (!domObject) {\n"); 2356 push(@implContent, " if (JSDOMWindowShell* shell = jsDynamicCast<JSDOMWindowShell*>(JSValue::decode(thisValue)))\n"); 2357 push(@implContent, " domObject = shell->window();\n"); 2358 push(@implContent, " }\n"); 2349 if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) { 2350 push(@implContent, " ${className}* domObject = to${className}(JSValue::decode(thisValue));\n"); 2359 2351 } else { 2360 2352 push(@implContent, " ${className}* domObject = jsDynamicCast<${className}*>(JSValue::decode(thisValue));\n") if ConstructorShouldBeOnInstance($interface); … … 2380 2372 push(@implContent, "{\n"); 2381 2373 push(@implContent, " JSValue value = JSValue::decode(encodedValue);"); 2382 push(@implContent, " ${className}* castedThis = jsDynamicCast<${className}*>(JSValue::decode(thisValue));\n"); 2383 if ($interfaceName eq "DOMWindow") { 2384 push(@implContent, " if (UNLIKELY(!castedThis)) {\n"); 2385 push(@implContent, " if (JSDOMWindowShell* shell = jsDynamicCast<JSDOMWindowShell*>(JSValue::decode(thisValue)))\n"); 2386 push(@implContent, " castedThis = shell->window();\n"); 2387 push(@implContent, " }\n"); 2374 if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) { 2375 push(@implContent, " ${className}* castedThis = to${className}(JSValue::decode(thisValue));\n"); 2376 } else { 2377 push(@implContent, " ${className}* castedThis = jsDynamicCast<${className}*>(JSValue::decode(thisValue));\n"); 2388 2378 } 2389 2379 push(@implContent, " if (UNLIKELY(!castedThis)) {\n"); … … 2489 2479 push(@implContent, " UNUSED_PARAM(exec);\n"); 2490 2480 if (!$attribute->isStatic) { 2491 push(@implContent, " ${className}* castedThis = jsDynamicCast<${className}*>(JSValue::decode(thisValue));\n"); 2492 if ($interfaceName eq "DOMWindow") { 2493 push(@implContent, " if (UNLIKELY(!castedThis)) {\n"); 2494 push(@implContent, " if (JSDOMWindowShell* shell = jsDynamicCast<JSDOMWindowShell*>(JSValue::decode(thisValue)))\n"); 2495 push(@implContent, " castedThis = shell->window();\n"); 2496 push(@implContent, " }\n"); 2481 if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) { 2482 push(@implContent, " ${className}* castedThis = to${className}(JSValue::decode(thisValue));\n"); 2483 } else { 2484 push(@implContent, " ${className}* castedThis = jsDynamicCast<${className}*>(JSValue::decode(thisValue));\n"); 2497 2485 } 2498 2486 push(@implContent, " if (UNLIKELY(!castedThis)) {\n"); … … 2719 2707 } 2720 2708 } else { 2721 if ($interface Name eq "DOMWindow") {2722 push(@implContent, " $className* castedThis = to JSDOMWindow(exec->hostThisValue().toThis(exec, NotStrictMode));\n");2709 if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) { 2710 push(@implContent, " $className* castedThis = to${className}(exec->hostThisValue().toThis(exec, NotStrictMode));\n"); 2723 2711 push(@implContent, " if (UNLIKELY(!castedThis))\n"); 2724 2712 push(@implContent, " return throwVMTypeError(exec);\n"); -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r165521 r166070 44 44 CustomNamedGetter 45 45 CustomNamedSetter 46 CustomProxyToJSObject 46 47 CustomPutFunction 47 48 CustomReturn -
trunk/Source/WebCore/page/DOMWindow.idl
r165676 r166070 31 31 CustomGetOwnPropertySlot, 32 32 CustomEnumerateProperty, 33 CustomProxyToJSObject, 33 34 JSCustomMarkFunction, 34 35 JSCustomToNativeObject,
Note: See TracChangeset
for help on using the changeset viewer.