Changeset 104778 in webkit
- Timestamp:
- Jan 11, 2012 5:57:45 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r104775 r104778 1 2012-01-11 Kentaro Hara <haraken@chromium.org> 2 3 [JSC] Remove redundant arguments from [Supplemental] custom methods 4 https://bugs.webkit.org/show_bug.cgi?id=76127 5 6 Reviewed by Adam Barth. 7 8 Since in JSC a callback of custom methods is non-static, we do not need 9 to pass a pointer of an implementation object. 10 11 Before (JSTestInterface.cpp): 12 JSValue jsTestInterfaceSupplementalStr3(ExecState* exec, JSValue slotBase, ...) 13 { 14 JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(slotBase)); 15 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); 16 return castedThis->supplementalStr3(impl, exec); 17 } 18 19 After (JSTestInterface.cpp): 20 JSValue jsTestInterfaceSupplementalStr3(ExecState* exec, JSValue slotBase, ...) 21 { 22 JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(slotBase)); 23 return castedThis->supplementalStr3(exec); // JSTestInterface knows 'impl'. 24 } 25 26 Tests: bindings/scripts/test/TestInterface.idl 27 http/tests/websocket/tests/* 28 webaudio/* 29 30 * bindings/scripts/CodeGeneratorJS.pm: 31 (GenerateHeader): Previously when we specify [CustomGetter, CustomSetter], the header for 32 the custom setter was not generated. This patch fixes the bug. 33 (GenerateImplementation): 34 35 * bindings/js/JSDOMWindowWebAudioCustom.cpp: Removed redundant DOMWindow* from webkitAudioContext(). 36 (WebCore::JSDOMWindow::webkitAudioContext): 37 * bindings/js/JSDOMWindowWebSocketCustom.cpp: Removed redundant DOMWindow* from webSocket(). 38 (WebCore::JSDOMWindow::webSocket): 39 40 * bindings/scripts/test/JS/JSTestInterface.cpp: Updated the test result. 41 (WebCore::jsTestInterfaceSupplementalStr3): 42 (WebCore::setJSTestInterfaceSupplementalStr3): 43 * bindings/scripts/test/JS/JSTestInterface.h: Ditto. 44 1 45 2012-01-11 Adam Barth <abarth@webkit.org> 2 46 -
trunk/Source/WebCore/bindings/js/JSDOMWindowWebAudioCustom.cpp
r103274 r104778 38 38 } 39 39 40 JSValue JSDOMWindow::webkitAudioContext( DOMWindow*,ExecState* exec) const40 JSValue JSDOMWindow::webkitAudioContext(ExecState* exec) const 41 41 { 42 42 Settings* settings = settingsForWindowWebAudio(this); -
trunk/Source/WebCore/bindings/js/JSDOMWindowWebSocketCustom.cpp
r103274 r104778 38 38 } 39 39 40 JSValue JSDOMWindow::webSocket( DOMWindow*,ExecState* exec) const40 JSValue JSDOMWindow::webSocket(ExecState* exec) const 41 41 { 42 42 if (!settingsForWindowWebSocket(this)) -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r104643 r104778 903 903 904 904 foreach my $attribute (@{$dataNode->attributes}) { 905 if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"}) { 906 push(@headerContent, " JSC::JSValue " . $codeGenerator->WK_lcfirst($attribute->signature->name) . "(JSC::ExecState*) const;\n"); 907 if ($attribute->type !~ /^readonly/) { 908 push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n"); 909 } 910 } elsif (($attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"})) { 905 if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}) { 911 906 my $methodName = $codeGenerator->WK_lcfirst($attribute->signature->name); 912 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { 913 push(@headerContent, " JSC::JSValue " . $methodName . "(" . $interfaceName . "*, JSC::ExecState*) const;\n"); 914 } else { 915 push(@headerContent, " JSC::JSValue " . $methodName . "(JSC::ExecState*) const;\n"); 916 } 917 } elsif (($attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"})) { 918 if ($attribute->type !~ /^readonly/) { 919 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { 920 push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(" . $interfaceName . "*, JSC::ExecState*, JSC::JSValue);\n"); 921 } else { 922 push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n"); 923 } 924 } 907 push(@headerContent, " JSC::JSValue " . $methodName . "(JSC::ExecState*) const;\n"); 908 } 909 if (($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}) && $attribute->type !~ /^readonly/) { 910 push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n"); 925 911 } 926 912 } … … 1747 1733 1748 1734 if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}) { 1749 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { 1750 push(@implContent, " ${interfaceName}* impl = static_cast<${interfaceName}*>(castedThis->impl());\n"); 1751 push(@implContent, " return castedThis->$implGetterFunctionName(impl, exec);\n"); 1752 } else { 1753 push(@implContent, " return castedThis->$implGetterFunctionName(exec);\n"); 1754 } 1735 push(@implContent, " return castedThis->$implGetterFunctionName(exec);\n"); 1755 1736 } elsif ($attribute->signature->extendedAttributes->{"allowAccessToNode"}) { 1756 1737 $implIncludes{"JSDOMBinding.h"} = 1; … … 1935 1916 1936 1917 if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}) { 1937 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { 1938 push(@implContent, " ${className}* castedThis = static_cast<${className}*>(thisObject);\n"); 1939 push(@implContent, " ${interfaceName}* impl = static_cast<${interfaceName}*>(castedThis->impl());\n"); 1940 push(@implContent, " castedThis->set$implSetterFunctionName(impl, exec, value);\n"); 1941 } else { 1942 push(@implContent, " static_cast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n"); 1943 } 1918 push(@implContent, " static_cast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n"); 1944 1919 } elsif ($type eq "EventListener") { 1945 1920 $implIncludes{"JSEventListener.h"} = 1; -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r104767 r104778 231 231 { 232 232 JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(slotBase)); 233 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); 234 return castedThis->supplementalStr3(impl, exec); 233 return castedThis->supplementalStr3(exec); 235 234 } 236 235 … … 265 264 void setJSTestInterfaceSupplementalStr3(ExecState* exec, JSObject* thisObject, JSValue value) 266 265 { 267 JSTestInterface* castedThis = static_cast<JSTestInterface*>(thisObject); 268 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); 269 castedThis->setSupplementalStr3(impl, exec, value); 266 static_cast<JSTestInterface*>(thisObject)->setSupplementalStr3(exec, value); 270 267 } 271 268 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h
r104767 r104778 58 58 59 59 // Custom attributes 60 JSC::JSValue supplementalStr3(TestInterface*, JSC::ExecState*) const; 60 JSC::JSValue supplementalStr3(JSC::ExecState*) const; 61 void setSupplementalStr3(JSC::ExecState*, JSC::JSValue); 61 62 62 63 // Custom functions
Note: See TracChangeset
for help on using the changeset viewer.