Title: [104767] trunk/Source/WebCore
Revision
104767
Author
[email protected]
Date
2012-01-11 16:56:24 -0800 (Wed, 11 Jan 2012)

Log Message

Implement the [Supplemental] IDL for custom methods
https://bugs.webkit.org/show_bug.cgi?id=76036

Reviewed by Adam Barth.

We have implemented the [Supplemental] IDL for non-custom methods in bug 75944.
This patch implements it for custom methods. This patch modifies only CodeGeneratorV8.pm,
since CodeGeneratorJS.pm requires no change and other code generators
do not support custom methods.

Test: bindings/scripts/test/TestSupplemental.idl

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader):

* bindings/scripts/test/TestSupplemental.idl: Added a custom method with the [Supplemental] IDL.

* bindings/scripts/test/JS/JSTestInterface.cpp: Updated the test result.
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod3):
* bindings/scripts/test/JS/JSTestInterface.h: Ditto.
* bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto.
* bindings/scripts/test/ObjC/DOMTestInterface.mm: Ditto.
(-[DOMTestInterface supplementalMethod3]):
* bindings/scripts/test/V8/V8TestInterface.cpp: Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104766 => 104767)


--- trunk/Source/WebCore/ChangeLog	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/ChangeLog	2012-01-12 00:56:24 UTC (rev 104767)
@@ -1,3 +1,30 @@
+2012-01-11  Kentaro Hara  <[email protected]>
+
+        Implement the [Supplemental] IDL for custom methods
+        https://bugs.webkit.org/show_bug.cgi?id=76036
+
+        Reviewed by Adam Barth.
+
+        We have implemented the [Supplemental] IDL for non-custom methods in bug 75944.
+        This patch implements it for custom methods. This patch modifies only CodeGeneratorV8.pm,
+        since CodeGeneratorJS.pm requires no change and other code generators
+        do not support custom methods.
+
+        Test: bindings/scripts/test/TestSupplemental.idl
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateHeader):
+
+        * bindings/scripts/test/TestSupplemental.idl: Added a custom method with the [Supplemental] IDL.
+
+        * bindings/scripts/test/JS/JSTestInterface.cpp: Updated the test result.
+        (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod3):
+        * bindings/scripts/test/JS/JSTestInterface.h: Ditto.
+        * bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto.
+        * bindings/scripts/test/ObjC/DOMTestInterface.mm: Ditto.
+        (-[DOMTestInterface supplementalMethod3]):
+        * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto.
+
 2011-12-21  Shaw Andy  <[email protected]>
 
         Fix build issue on Windows when Qt is configured with -ltcg

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (104766 => 104767)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-01-12 00:56:24 UTC (rev 104767)
@@ -400,7 +400,7 @@
         my $name = $function->signature->name;
         my $attrExt = $function->signature->extendedAttributes;
 
-        if (($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) && $function->{overloadIndex} == 1) {
+        if (($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) && !$attrExt->{"ImplementedBy"} && $function->{overloadIndex} == 1) {
             push(@headerContent, <<END);
     static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments&);
 END

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (104766 => 104767)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2012-01-12 00:56:24 UTC (rev 104767)
@@ -137,10 +137,13 @@
 #if ENABLE(Condition11) || ENABLE(Condition12)
     { "supplementalMethod2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t)2, NoIntrinsic },
 #endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+    { "supplementalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod3), (intptr_t)0, NoIntrinsic },
+#endif
     { 0, 0, 0, 0, NoIntrinsic }
 };
 
-static const HashTable JSTestInterfacePrototypeTable = { 5, 3, JSTestInterfacePrototypeTableValues, 0 };
+static const HashTable JSTestInterfacePrototypeTable = { 8, 7, JSTestInterfacePrototypeTableValues, 0 };
 const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, &JSTestInterfacePrototypeTable, 0, CREATE_METHOD_TABLE(JSTestInterfacePrototype) };
 
 JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
@@ -317,6 +320,19 @@
 
 #endif
 
+#if ENABLE(Condition11) || ENABLE(Condition12)
+EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSTestInterface::s_info))
+        return throwVMTypeError(exec);
+    JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(thisValue));
+    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info);
+    return JSValue::encode(castedThis->supplementalMethod3(exec));
+}
+
+#endif
+
 static inline bool isObservable(JSTestInterface* jsTestInterface)
 {
     if (jsTestInterface->hasCustomProperties())

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h (104766 => 104767)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h	2012-01-12 00:56:24 UTC (rev 104767)
@@ -58,6 +58,9 @@
 
     // Custom attributes
     JSC::JSValue supplementalStr3(TestInterface*, JSC::ExecState*) const;
+
+    // Custom functions
+    JSC::JSValue supplementalMethod3(JSC::ExecState*);
     TestInterface* impl() const { return m_impl; }
     void releaseImpl() { m_impl->deref(); m_impl = 0; }
 
@@ -146,6 +149,7 @@
 
 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(JSC::ExecState*);
 // Attributes
 
 JSC::JSValue jsTestInterfaceSupplementalStr1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h (104766 => 104767)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h	2012-01-12 00:56:24 UTC (rev 104767)
@@ -45,6 +45,7 @@
 #endif
 - (void)supplementalMethod1;
 - (DOMTestObj *)supplementalMethod2:(NSString *)strArg objArg:(DOMTestObj *)objArg;
+- (void)supplementalMethod3;
 @end
 
 #endif

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm (104766 => 104767)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm	2012-01-12 00:56:24 UTC (rev 104767)
@@ -131,6 +131,16 @@
 
 #endif
 
+
+#if ENABLE(Condition11) || ENABLE(Condition12)
+- (void)supplementalMethod3
+{
+    WebCore::JSMainThreadNullState state;
+    TestSupplemental::supplementalMethod3(IMPL);
+}
+
+#endif
+
 @end
 
 WebCore::TestInterface* core(DOMTestInterface *wrapper)

Modified: trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl (104766 => 104767)


--- trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl	2012-01-12 00:56:24 UTC (rev 104767)
@@ -39,5 +39,6 @@
 
         void supplementalMethod1();
         [CallWith=ScriptExecutionContext] TestObj supplementalMethod2(in DOMString strArg, in TestObj objArg) raises(DOMException);
+        [Custom] void supplementalMethod3();
     };
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp (104766 => 104767)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp	2012-01-12 00:51:14 UTC (rev 104766)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp	2012-01-12 00:56:24 UTC (rev 104767)
@@ -141,6 +141,9 @@
 #if ENABLE(Condition11) || ENABLE(Condition12)
     {"supplementalMethod1", TestInterfaceInternal::supplementalMethod1Callback},
 #endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+    {"supplementalMethod3", V8TestInterface::supplementalMethod3Callback},
+#endif
 };
 
 v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to