Title: [94354] trunk/Source/WebCore
Revision
94354
Author
par...@webkit.org
Date
2011-09-01 15:42:20 -0700 (Thu, 01 Sep 2011)

Log Message

Consider Conditional attribute in CodeGenerator for methods
https://bugs.webkit.org/show_bug.cgi?id=67409

Reviewed by Darin Adler.

This change adds appropriate #if ENABLE() lines for the preprocessor around the
generated functions depending on the Conditional attribute in the IDL file.

* bindings/scripts/CodeGeneratorCPP.pm:
(GenerateImplementation):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/CodeGeneratorObjC.pm:
(GenerateImplementation):
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateImplementation):
* bindings/scripts/test/CPP/WebDOMTestObj.cpp:
* bindings/scripts/test/CPP/WebDOMTestObj.h:
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
* bindings/scripts/test/TestObj.idl:
* bindings/scripts/test/V8/V8TestObj.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94353 => 94354)


--- trunk/Source/WebCore/ChangeLog	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/ChangeLog	2011-09-01 22:42:20 UTC (rev 94354)
@@ -1,3 +1,32 @@
+2011-09-01  Patrick Gansterer  <par...@webkit.org>
+
+        Consider Conditional attribute in CodeGenerator for methods
+        https://bugs.webkit.org/show_bug.cgi?id=67409
+
+        Reviewed by Darin Adler.
+
+        This change adds appropriate #if ENABLE() lines for the preprocessor around the
+        generated functions depending on the Conditional attribute in the IDL file.
+
+        * bindings/scripts/CodeGeneratorCPP.pm:
+        (GenerateImplementation):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        (GenerateImplementation):
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateImplementation):
+        * bindings/scripts/test/CPP/WebDOMTestObj.cpp:
+        * bindings/scripts/test/CPP/WebDOMTestObj.h:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        * bindings/scripts/test/TestObj.idl:
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+
 2011-08-29  Nat Duca  <nd...@chromium.org>
 
         [chromium] Introduce CCSingleThreadProxy in order to move LayerRenderer to CCLayerTreeHostImpl

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm	2011-09-01 22:42:20 UTC (rev 94354)
@@ -869,12 +869,17 @@
                 }
             }
 
+            my $conditionalString = GenerateConditionalString($function->signature);
+            push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
+
             push(@implContent, "$functionSig\n");
             push(@implContent, "{\n");
             push(@implContent, AddEarlyReturnStatement($returnType));
             push(@implContent, @functionContent);
             push(@implContent, "}\n\n");
 
+            push(@implContent, "#endif\n\n") if $conditionalString;
+
             # Clear the hash
             %needsCustom = ();
         }

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2011-09-01 22:42:20 UTC (rev 94354)
@@ -1375,6 +1375,7 @@
     my @hashValue1 = ();
     my @hashValue2 = ();
     my @hashSpecials = ();
+    my %conditionals = ();
 
     # FIXME: we should not need a function for every constant.
     foreach my $constant (@{$dataNode->constants}) {
@@ -1402,11 +1403,17 @@
         push(@specials, "Function");
         my $special = (@specials > 0) ? join(" | ", @specials) : "0";
         push(@hashSpecials, $special);
+
+        my $conditional = $function->signature->extendedAttributes->{"Conditional"};
+        if ($conditional) {
+            $conditionals{$name} = $conditional;
+        }
     }
 
     $object->GenerateHashTable($hashName, $hashSize,
                                \@hashKeys, \@hashSpecials,
-                               \@hashValue1, \@hashValue2);
+                               \@hashValue1, \@hashValue2,
+                               \%conditionals);
 
     if ($dataNode->extendedAttributes->{"NoStaticTables"}) {
         push(@implContent, "static const HashTable* get${className}PrototypeTable(ExecState* exec)\n");
@@ -1945,6 +1952,12 @@
             
             my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name);
 
+            my $conditional = $function->signature->extendedAttributes->{"Conditional"};
+            if ($conditional) {
+                my $conditionalString = GenerateConditionalStringFromAttributeValue($conditional);
+                push(@implContent, "#if ${conditionalString}\n");
+            }
+
             push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n");
             push(@implContent, "{\n");
 
@@ -2181,6 +2194,10 @@
                 # Generate a function dispatching call to the rest of the overloads.
                 GenerateOverloadedPrototypeFunction($function, $dataNode, $implClassName);
             }
+
+            if ($conditional) {
+                push(@implContent, "#endif\n\n");
+            }
         }
     }
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2011-09-01 22:42:20 UTC (rev 94354)
@@ -1650,12 +1650,17 @@
                 }
             }
 
+            my $conditionalString = GenerateConditionalString($function->signature);
+            push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
+
             push(@implContent, "$functionSig\n");
             push(@implContent, "{\n");
             push(@implContent, "    $jsContextSetter\n");
             push(@implContent, @functionContent);
             push(@implContent, "}\n\n");
 
+            push(@implContent, "#endif\n\n") if $conditionalString;
+
             # generate the old style method names with un-named parameters, these methods are deprecated
             if (@{$function->parameters} > 1 and $function->signature->extendedAttributes->{"OldStyleObjC"}) {
                 my $deprecatedFunctionSig = $functionSig;

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-09-01 22:42:20 UTC (rev 94354)
@@ -2054,9 +2054,12 @@
         }
         my $name = $function->signature->name;
         my $callback = GetFunctionTemplateCallbackName($function, $interfaceName);
+        my $conditionalString = GenerateConditionalString($function->signature);
+        push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
         push(@implContent, <<END);
     {"$name", $callback},
 END
+        push(@implContent, "#endif\n") if $conditionalString;
         $num_callbacks++;
     }
     push(@implContent, "};\n\n")  if $has_callbacks;

Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp	2011-09-01 22:42:20 UTC (rev 94354)
@@ -807,6 +807,42 @@
     impl()->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
 }
 
+
+#if ENABLE(Condition1)
+WebDOMString WebDOMTestObj::conditionalMethod1()
+{
+    if (!impl())
+        return WebDOMString();
+
+    return impl()->conditionalMethod1();
+}
+
+#endif
+
+
+#if ENABLE(Condition1) && ENABLE(Condition2)
+void WebDOMTestObj::conditionalMethod2()
+{
+    if (!impl())
+        return;
+
+    impl()->conditionalMethod2();
+}
+
+#endif
+
+
+#if ENABLE(Condition1) || ENABLE(Condition2)
+void WebDOMTestObj::conditionalMethod3()
+{
+    if (!impl())
+        return;
+
+    impl()->conditionalMethod3();
+}
+
+#endif
+
 void WebDOMTestObj::classMethod()
 {
     if (!impl())

Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h	2011-09-01 22:42:20 UTC (rev 94354)
@@ -158,6 +158,9 @@
     void methodWithOptionalArg(int opt);
     void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt);
     void methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2);
+    WebDOMString conditionalMethod1();
+    void conditionalMethod2();
+    void conditionalMethod3();
     void classMethod();
     int classMethodWithOptional(int arg);
 

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2011-09-01 22:42:20 UTC (rev 94354)
@@ -383,7 +383,43 @@
     item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2);
 }
 
+gchar*
+webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self)
+{
+#if ENABLE(Condition1)
+    g_return_val_if_fail(self, 0);
+    WebCore::JSMainThreadNullState state;
+    WebCore::TestObj * item = WebKit::core(self);
+    gchar* res = convertToUTF8String(item->conditionalMethod1());
+    return res;
+#else
+    return NULL;
+#endif /* ENABLE(Condition1) */
+}
+
 void
+webkit_dom_test_obj_conditional_method2(WebKitDOMTestObj* self)
+{
+#if ENABLE(Condition1) && ENABLE(Condition2)
+    g_return_if_fail(self);
+    WebCore::JSMainThreadNullState state;
+    WebCore::TestObj * item = WebKit::core(self);
+    item->conditionalMethod2();
+#endif /* ENABLE(Condition1) && ENABLE(Condition2) */
+}
+
+void
+webkit_dom_test_obj_conditional_method3(WebKitDOMTestObj* self)
+{
+#if ENABLE(Condition1) || ENABLE(Condition2)
+    g_return_if_fail(self);
+    WebCore::JSMainThreadNullState state;
+    WebCore::TestObj * item = WebKit::core(self);
+    item->conditionalMethod3();
+#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
+}
+
+void
 webkit_dom_test_obj_class_method(WebKitDOMTestObj* self)
 {
     g_return_if_fail(self);

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2011-09-01 22:42:20 UTC (rev 94354)
@@ -330,6 +330,36 @@
 webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2);
 
 /**
+ * webkit_dom_test_obj_conditional_method1:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns:
+ *
+**/
+WEBKIT_API gchar*
+webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self);
+
+/**
+ * webkit_dom_test_obj_conditional_method2:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns:
+ *
+**/
+WEBKIT_API void
+webkit_dom_test_obj_conditional_method2(WebKitDOMTestObj* self);
+
+/**
+ * webkit_dom_test_obj_conditional_method3:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns:
+ *
+**/
+WEBKIT_API void
+webkit_dom_test_obj_conditional_method3(WebKitDOMTestObj* self);
+
+/**
  * webkit_dom_test_obj_class_method:
  * @self: A #WebKitDOMTestObj
  *

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2011-09-01 22:42:20 UTC (rev 94354)
@@ -236,6 +236,15 @@
     { "methodWithCallbackArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t)1 THUNK_GENERATOR(0) },
     { "methodWithNonCallbackArgAndCallbackArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t)2 THUNK_GENERATOR(0) },
     { "methodWithCallbackAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
+#if ENABLE(Condition1)
+    { "conditionalMethod1", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod1), (intptr_t)0 THUNK_GENERATOR(0) },
+#endif
+#if ENABLE(Condition1) && ENABLE(Condition2)
+    { "conditionalMethod2", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod2), (intptr_t)0 THUNK_GENERATOR(0) },
+#endif
+#if ENABLE(Condition1) || ENABLE(Condition2)
+    { "conditionalMethod3", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod3), (intptr_t)0 THUNK_GENERATOR(0) },
+#endif
     { "overloadedMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2 THUNK_GENERATOR(0) },
     { "classMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethod), (intptr_t)0 THUNK_GENERATOR(0) },
     { "classMethodWithOptional", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithOptional), (intptr_t)1 THUNK_GENERATOR(0) },
@@ -243,7 +252,7 @@
 };
 
 #undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 136, 127, JSTestObjPrototypeTableValues, 0 };
+static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 137, 127, JSTestObjPrototypeTableValues, 0 };
 const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestObjPrototypeTable, 0 };
 
 JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
@@ -1530,6 +1539,55 @@
     return JSValue::encode(jsUndefined());
 }
 
+#if ENABLE(Condition1)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod1(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwVMTypeError(exec);
+    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
+    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+
+
+    JSC::JSValue result = jsString(exec, imp->conditionalMethod1());
+    return JSValue::encode(result);
+}
+
+#endif
+
+#if ENABLE(Condition1) && ENABLE(Condition2)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod2(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwVMTypeError(exec);
+    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
+    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+
+    imp->conditionalMethod2();
+    return JSValue::encode(jsUndefined());
+}
+
+#endif
+
+#if ENABLE(Condition1) || ENABLE(Condition2)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod3(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwVMTypeError(exec);
+    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
+    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+
+    imp->conditionalMethod3();
+    return JSValue::encode(jsUndefined());
+}
+
+#endif
+
 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec)
 {
     JSValue thisValue = exec->hostThisValue();

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2011-09-01 22:42:20 UTC (rev 94354)
@@ -127,6 +127,9 @@
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod1(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod2(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod3(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethod(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(JSC::ExecState*);

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2011-09-01 22:42:20 UTC (rev 94354)
@@ -150,6 +150,9 @@
 - (void)methodWithOptionalArg:(int)opt;
 - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
 - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
+- (NSString *)conditionalMethod1;
+- (void)conditionalMethod2;
+- (void)conditionalMethod3;
 - (void)classMethod;
 - (int)classMethodWithOptional:(int)arg;
 @end

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2011-09-01 22:42:20 UTC (rev 94354)
@@ -678,6 +678,36 @@
     IMPL->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
 }
 
+
+#if ENABLE(Condition1)
+- (NSString *)conditionalMethod1
+{
+    WebCore::JSMainThreadNullState state;
+    return IMPL->conditionalMethod1();
+}
+
+#endif
+
+
+#if ENABLE(Condition1) && ENABLE(Condition2)
+- (void)conditionalMethod2
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->conditionalMethod2();
+}
+
+#endif
+
+
+#if ENABLE(Condition1) || ENABLE(Condition2)
+- (void)conditionalMethod3
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->conditionalMethod3();
+}
+
+#endif
+
 - (void)classMethod
 {
     WebCore::JSMainThreadNullState state;

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2011-09-01 22:42:20 UTC (rev 94354)
@@ -136,6 +136,11 @@
         attribute [Conditional=Condition1&Condition2] long conditionalAttr2;
         attribute [Conditional=Condition1|Condition2] long conditionalAttr3;
 
+        // 'Conditional' extended method
+        [Conditional=Condition1] DOMString conditionalMethod1();
+        [Conditional=Condition1&Condition2] void conditionalMethod2();
+        [Conditional=Condition1|Condition2] void conditionalMethod3();
+
 #if defined(TESTING_V8) || defined(TESTING_JS)
         // Overloads
         void    overloadedMethod(in TestObj objArg, in DOMString strArg);

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (94353 => 94354)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-09-01 22:40:08 UTC (rev 94353)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-09-01 22:42:20 UTC (rev 94354)
@@ -1044,6 +1044,29 @@
     return v8::Handle<v8::Value>();
 }
 
+static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.conditionalMethod1");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    return v8String(imp->conditionalMethod1());
+}
+
+static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.conditionalMethod2");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    imp->conditionalMethod2();
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.conditionalMethod3");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    imp->conditionalMethod3();
+    return v8::Handle<v8::Value>();
+}
+
 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
 {
     INC_STATS("DOM.TestObj.overloadedMethod1");
@@ -1258,6 +1281,15 @@
     {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
     {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
     {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
+#if ENABLE(Condition1)
+    {"conditionalMethod1", TestObjInternal::conditionalMethod1Callback},
+#endif
+#if ENABLE(Condition1) && ENABLE(Condition2)
+    {"conditionalMethod2", TestObjInternal::conditionalMethod2Callback},
+#endif
+#if ENABLE(Condition1) || ENABLE(Condition2)
+    {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback},
+#endif
     {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to