Changeset 102351 in webkit
- Timestamp:
- Dec 8, 2011 10:55:05 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102349 r102351 1 2011-12-08 Kaustubh Atrawalkar <kaustubh@motorola.com> 2 3 Fixing support for static conditional overloaded functions. 4 https://bugs.webkit.org/show_bug.cgi?id=74068 5 6 Reviewed by Adam Barth. 7 8 * bindings/scripts/CodeGeneratorJS.pm: 9 (GenerateImplementation): Pushing "static" keyword after condition "#if". 10 * bindings/scripts/test/CPP/WebDOMTestObj.cpp: 11 (WebDOMTestObj::overloadedMethod1): Added newly generated bindings. 12 * bindings/scripts/test/CPP/WebDOMTestObj.h: Ditto. 13 * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Ditto. 14 (webkit_dom_test_obj_overloaded_method1): 15 * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Ditto. 16 * bindings/scripts/test/JS/JSTestObj.cpp: Ditto. 17 (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): 18 (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): 19 (WebCore::jsTestObjConstructorFunctionOverloadedMethod1): 20 * bindings/scripts/test/JS/JSTestObj.h: Ditto. 21 * bindings/scripts/test/ObjC/DOMTestObj.h: Ditto. 22 * bindings/scripts/test/ObjC/DOMTestObj.mm: Ditto. 23 (-[DOMTestObj overloadedMethod1:]): 24 * bindings/scripts/test/TestObj.idl: Ditto. 25 * bindings/scripts/test/V8/V8TestObj.cpp: Ditto. 26 (WebCore::TestObjInternal::overloadedMethod11Callback): 27 (WebCore::TestObjInternal::overloadedMethod12Callback): 28 (WebCore::TestObjInternal::overloadedMethod1Callback): 29 (WebCore::ConfigureV8TestObjTemplate): 30 1 31 2011-12-08 Andreas Kling <kling@webkit.org> 2 32 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r102233 r102351 2072 2072 my $functionName = GetFunctionName($className, $function); 2073 2073 2074 my $conditional = $function->signature->extendedAttributes->{"Conditional"}; 2075 if ($conditional) { 2076 my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional); 2077 push(@implContent, "#if ${conditionalString}\n"); 2078 } 2079 2080 2074 2081 if (!$isCustom && $isOverloaded) { 2075 2082 # Append a number to an overloaded method's name to make it unique: … … 2079 2086 push(@implContent, "static "); 2080 2087 } 2081 2088 2082 2089 my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); 2083 2084 my $conditional = $function->signature->extendedAttributes->{"Conditional"};2085 if ($conditional) {2086 my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);2087 push(@implContent, "#if ${conditionalString}\n");2088 }2089 2090 2090 2091 push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); -
trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
r100163 r102351 906 906 } 907 907 908 909 #if ENABLE(Condition1) 910 void WebDOMTestObj::overloadedMethod1(int arg) 911 { 912 if (!impl()) 913 return; 914 915 impl()->overloadedMethod1(arg); 916 } 917 918 #endif 919 920 921 #if ENABLE(Condition1) 922 void WebDOMTestObj::overloadedMethod1(const WebDOMString& type) 923 { 924 if (!impl()) 925 return; 926 927 impl()->overloadedMethod1(type); 928 } 929 930 #endif 931 908 932 WebCore::TestObj* toWebCore(const WebDOMTestObj& wrapper) 909 933 { -
trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
r101102 r102351 182 182 void classMethod(); 183 183 int classMethodWithOptional(int arg); 184 void overloadedMethod1(int arg); 185 void overloadedMethod1(const WebDOMString& type); 184 186 185 187 WebCore::TestObj* impl() const; -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
r100163 r102351 414 414 glong res = item->classMethodWithOptional(arg); 415 415 return res; 416 } 417 418 void 419 webkit_dom_test_obj_overloaded_method1(WebKitDOMTestObj* self, glong arg) 420 { 421 #if ENABLE(Condition1) 422 g_return_if_fail(self); 423 WebCore::JSMainThreadNullState state; 424 WebCore::TestObj * item = WebKit::core(self); 425 item->overloadedMethod1(arg); 426 #endif /* ENABLE(Condition1) */ 427 } 428 429 void 430 webkit_dom_test_obj_overloaded_method1(WebKitDOMTestObj* self, const gchar* type) 431 { 432 #if ENABLE(Condition1) 433 g_return_if_fail(self); 434 WebCore::JSMainThreadNullState state; 435 WebCore::TestObj * item = WebKit::core(self); 436 g_return_if_fail(type); 437 WTF::String converted_type = WTF::String::fromUTF8(type); 438 item->overloadedMethod1(converted_type); 439 #endif /* ENABLE(Condition1) */ 416 440 } 417 441 -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
r100163 r102351 370 370 371 371 /** 372 * webkit_dom_test_obj_overloaded_method1: 373 * @self: A #WebKitDOMTestObj 374 * @arg: A #glong 375 * 376 * Returns: 377 * 378 **/ 379 WEBKIT_API void 380 webkit_dom_test_obj_overloaded_method1(WebKitDOMTestObj* self, glong arg); 381 382 /** 383 * webkit_dom_test_obj_overloaded_method1: 384 * @self: A #WebKitDOMTestObj 385 * @type: A #gchar 386 * 387 * Returns: 388 * 389 **/ 390 WEBKIT_API void 391 webkit_dom_test_obj_overloaded_method1(WebKitDOMTestObj* self, const gchar* type); 392 393 /** 372 394 * webkit_dom_test_obj_get_read_only_int_attr: 373 395 * @self: A #WebKitDOMTestObj -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r102233 r102351 165 165 { "classMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionClassMethod), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }, 166 166 { "classMethodWithOptional", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionClassMethodWithOptional), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }, 167 #if ENABLE(Condition1) 168 { "overloadedMethod1", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionOverloadedMethod1), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }, 169 #endif 167 170 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) } 168 171 }; 169 172 170 173 #undef THUNK_GENERATOR 171 static const HashTable JSTestObjConstructorTable = { 3 5, 31, JSTestObjConstructorTableValues, 0 };174 static const HashTable JSTestObjConstructorTable = { 36, 31, JSTestObjConstructorTableValues, 0 }; 172 175 173 176 #if ENABLE(Condition1) … … 1890 1893 } 1891 1894 1895 #if ENABLE(Condition1) 1896 static EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod11(ExecState* exec) 1897 { 1898 if (exec->argumentCount() < 1) 1899 return throwVMError(exec, createTypeError(exec, "Not enough arguments")); 1900 int arg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); 1901 if (exec->hadException()) 1902 return JSValue::encode(jsUndefined()); 1903 TestObj::overloadedMethod1(arg); 1904 return JSValue::encode(jsUndefined()); 1905 } 1906 1907 #endif 1908 1909 #if ENABLE(Condition1) 1910 static EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod12(ExecState* exec) 1911 { 1912 if (exec->argumentCount() < 1) 1913 return throwVMError(exec, createTypeError(exec, "Not enough arguments")); 1914 const String& type(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); 1915 if (exec->hadException()) 1916 return JSValue::encode(jsUndefined()); 1917 TestObj::overloadedMethod1(type); 1918 return JSValue::encode(jsUndefined()); 1919 } 1920 1921 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(ExecState* exec) 1922 { 1923 size_t argsCount = exec->argumentCount(); 1924 if (argsCount == 1) 1925 return jsTestObjConstructorFunctionOverloadedMethod11(exec); 1926 JSValue arg0(exec->argument(0)); 1927 if ((argsCount == 1 && (arg0.isUndefinedOrNull() || arg0.isString() || arg0.isObject()))) 1928 return jsTestObjConstructorFunctionOverloadedMethod12(exec); 1929 return throwVMTypeError(exec); 1930 } 1931 1932 #endif 1933 1892 1934 void JSTestObj::visitChildren(JSCell* cell, SlotVisitor& visitor) 1893 1935 { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
r101421 r102351 186 186 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod(JSC::ExecState*); 187 187 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethodWithOptional(JSC::ExecState*); 188 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(JSC::ExecState*); 188 189 // Attributes 189 190 -
trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
r101102 r102351 174 174 - (void)classMethod; 175 175 - (int)classMethodWithOptional:(int)arg; 176 - (void)overloadedMethod1:(int)arg; 177 - (void)overloadedMethod1:(NSString *)type; 176 178 @end 177 179 -
trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
r100163 r102351 769 769 } 770 770 771 772 #if ENABLE(Condition1) 773 - (void)overloadedMethod1:(int)arg 774 { 775 WebCore::JSMainThreadNullState state; 776 IMPL->overloadedMethod1(arg); 777 } 778 779 #endif 780 781 782 #if ENABLE(Condition1) 783 - (void)overloadedMethod1:(NSString *)type 784 { 785 WebCore::JSMainThreadNullState state; 786 IMPL->overloadedMethod1(type); 787 } 788 789 #endif 790 771 791 @end 772 792 -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r101433 r102351 166 166 static long classMethodWithOptional(in [Optional] long arg); 167 167 168 // Static method with conditional on overloaded methods 169 170 static [Conditional=Condition1] void overloadedMethod1(in long arg); 171 static [Conditional=Condition1] void overloadedMethod1(in DOMString type); 172 168 173 #if defined(TESTING_V8) 169 174 // 'EnabledAtRuntime' methods and attributes. -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r102233 r102351 1284 1284 EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); 1285 1285 return v8::Integer::New(TestObj::classMethodWithOptional(arg)); 1286 } 1287 1288 static v8::Handle<v8::Value> overloadedMethod11Callback(const v8::Arguments& args) 1289 { 1290 INC_STATS("DOM.TestObj.overloadedMethod11"); 1291 if (args.Length() < 1) 1292 return throwError("Not enough arguments", V8Proxy::TypeError); 1293 EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); 1294 TestObj::overloadedMethod1(arg); 1295 return v8::Handle<v8::Value>(); 1296 } 1297 1298 static v8::Handle<v8::Value> overloadedMethod12Callback(const v8::Arguments& args) 1299 { 1300 INC_STATS("DOM.TestObj.overloadedMethod12"); 1301 if (args.Length() < 1) 1302 return throwError("Not enough arguments", V8Proxy::TypeError); 1303 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)); 1304 TestObj::overloadedMethod1(type); 1305 return v8::Handle<v8::Value>(); 1306 } 1307 1308 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args) 1309 { 1310 INC_STATS("DOM.TestObj.overloadedMethod1"); 1311 if (args.Length() == 1) 1312 return overloadedMethod11Callback(args); 1313 if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject()))) 1314 return overloadedMethod12Callback(args); 1315 V8Proxy::throwTypeError(); 1316 return notHandledByInterceptor(); 1286 1317 } 1287 1318 … … 1561 1592 desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjInternal::classMethodCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>())); 1562 1593 desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjInternal::classMethodWithOptionalCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>())); 1594 desc->Set(v8::String::New("overloadedMethod1"), v8::FunctionTemplate::New(TestObjInternal::overloadedMethod1Callback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>())); 1563 1595 if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled()) 1564 1596 proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
Note: See TracChangeset
for help on using the changeset viewer.