Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: Source/bindings/scripts/CodeGeneratorV8.pm

Issue 15877002: move constructors to new style callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8Float64Array.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 static v8::Handle<v8::Value> ${name}MethodCustom(const v8::Arguments&); 691 static v8::Handle<v8::Value> ${name}MethodCustom(const v8::Arguments&);
692 END 692 END
693 $header{classPublic}->add("#endif // ${conditionalString}\n") if $co nditionalString; 693 $header{classPublic}->add("#endif // ${conditionalString}\n") if $co nditionalString;
694 } 694 }
695 if ($attrExt->{"EnabledPerContext"}) { 695 if ($attrExt->{"EnabledPerContext"}) {
696 push(@enabledPerContextFunctions, $function); 696 push(@enabledPerContextFunctions, $function);
697 } 697 }
698 } 698 }
699 699
700 if (IsConstructable($interface)) { 700 if (IsConstructable($interface)) {
701 $header{classPublic}->add(" static v8::Handle<v8::Value> constructorC allback(const v8::Arguments&);\n"); 701 $header{classPublic}->add(" static void constructorCallback(const v8: :FunctionCallbackInfo<v8::Value>&);\n");
702 END 702 END
703 } 703 }
704 if (HasCustomConstructor($interface)) { 704 if (HasCustomConstructor($interface)) {
705 $header{classPublic}->add(" static v8::Handle<v8::Value> constructorC ustom(const v8::Arguments&);\n"); 705 $header{classPublic}->add(" static void constructorCustom(const v8::F unctionCallbackInfo<v8::Value>&);\n");
706 } 706 }
707 707
708 my @enabledPerContextAttributes; 708 my @enabledPerContextAttributes;
709 foreach my $attribute (@{$interface->attributes}) { 709 foreach my $attribute (@{$interface->attributes}) {
710 my $name = $attribute->signature->name; 710 my $name = $attribute->signature->name;
711 my $attrExt = $attribute->signature->extendedAttributes; 711 my $attrExt = $attribute->signature->extendedAttributes;
712 my $conditionalString = GenerateConditionalString($attribute->signature) ; 712 my $conditionalString = GenerateConditionalString($attribute->signature) ;
713 if (HasCustomGetter($attrExt) && !$attrExt->{"ImplementedBy"}) { 713 if (HasCustomGetter($attrExt) && !$attrExt->{"ImplementedBy"}) {
714 $header{classPublic}->add("#if ${conditionalString}\n") if $conditio nalString; 714 $header{classPublic}->add("#if ${conditionalString}\n") if $conditio nalString;
715 $header{classPublic}->add(<<END); 715 $header{classPublic}->add(<<END);
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 } 2116 }
2117 return v8Undefined(); 2117 return v8Undefined();
2118 } 2118 }
2119 2119
2120 END 2120 END
2121 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; 2121 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString;
2122 $implementation{nameSpaceInternal}->add($code); 2122 $implementation{nameSpaceInternal}->add($code);
2123 return; 2123 return;
2124 } 2124 }
2125 2125
2126 $code .= GenerateArgumentsCountCheck($function, $interface); 2126 $code .= GenerateArgumentsCountCheckOldStyle($function, $interface);
2127 2127
2128 if ($name eq "set" and IsConstructorTemplate($interface, "TypedArray")) { 2128 if ($name eq "set" and IsConstructorTemplate($interface, "TypedArray")) {
2129 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h"); 2129 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h");
2130 $code .= <<END; 2130 $code .= <<END;
2131 return setWebGLArrayHelper<$implClassName, ${v8ClassName}>(args); 2131 return setWebGLArrayHelper<$implClassName, ${v8ClassName}>(args);
2132 } 2132 }
2133 2133
2134 END 2134 END
2135 $implementation{nameSpaceInternal}->add($code); 2135 $implementation{nameSpaceInternal}->add($code);
2136 return; 2136 return;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 $code .= " ExceptionCode ec = 0;\n"; 2184 $code .= " ExceptionCode ec = 0;\n";
2185 } 2185 }
2186 2186
2187 if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) { 2187 if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) {
2188 AddToImplIncludes("bindings/v8/BindingSecurity.h"); 2188 AddToImplIncludes("bindings/v8/BindingSecurity.h");
2189 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get ImplName($function->signature) . "(ec)))\n"; 2189 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get ImplName($function->signature) . "(ec)))\n";
2190 $code .= " return v8::Handle<v8::Value>(v8Null(args.GetIsolate()) );\n"; 2190 $code .= " return v8::Handle<v8::Value>(v8Null(args.GetIsolate()) );\n";
2191 END 2191 END
2192 } 2192 }
2193 2193
2194 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heck($function, $interface, $forMainWorldSuffix); 2194 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heckOldStyle($function, $interface, $forMainWorldSuffix);
2195 $code .= $parameterCheckString; 2195 $code .= $parameterCheckString;
2196 2196
2197 # Build the function call string. 2197 # Build the function call string.
2198 $code .= GenerateFunctionCallString($function, $paramIndex, " ", $interfa ce, $forMainWorldSuffix, %replacements); 2198 $code .= GenerateFunctionCallString($function, $paramIndex, " ", $interfa ce, $forMainWorldSuffix, %replacements);
2199 $code .= "}\n\n"; 2199 $code .= "}\n\n";
2200 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; 2200 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString;
2201 $implementation{nameSpaceInternal}->add($code); 2201 $implementation{nameSpaceInternal}->add($code);
2202 } 2202 }
2203 2203
2204 sub GenerateCallWith 2204 sub GenerateCallWith
(...skipping 25 matching lines...) Expand all
2230 } 2230 }
2231 if (ExtendedAttributeContains($callWith, "ActiveWindow")) { 2231 if (ExtendedAttributeContains($callWith, "ActiveWindow")) {
2232 push(@callWithArgs, "activeDOMWindow()"); 2232 push(@callWithArgs, "activeDOMWindow()");
2233 } 2233 }
2234 if (ExtendedAttributeContains($callWith, "FirstWindow")) { 2234 if (ExtendedAttributeContains($callWith, "FirstWindow")) {
2235 push(@callWithArgs, "firstDOMWindow()"); 2235 push(@callWithArgs, "firstDOMWindow()");
2236 } 2236 }
2237 return ([@callWithArgs], $code); 2237 return ([@callWithArgs], $code);
2238 } 2238 }
2239 2239
2240 sub GenerateArgumentsCountCheckOldStyle
2241 {
2242 my $function = shift;
2243 my $interface = shift;
2244 GenerateArgumentsCountCheck($function, $interface, "old");
2245 }
2246
2240 sub GenerateArgumentsCountCheck 2247 sub GenerateArgumentsCountCheck
2241 { 2248 {
2242 my $function = shift; 2249 my $function = shift;
2243 my $interface = shift; 2250 my $interface = shift;
2251 my $style = shift || "new";
2244 2252
2245 my $numMandatoryParams = 0; 2253 my $numMandatoryParams = 0;
2246 my $allowNonOptional = 1; 2254 my $allowNonOptional = 1;
2247 foreach my $param (@{$function->parameters}) { 2255 foreach my $param (@{$function->parameters}) {
2248 if ($param->isOptional or $param->isVariadic) { 2256 if ($param->isOptional or $param->isVariadic) {
2249 $allowNonOptional = 0; 2257 $allowNonOptional = 0;
2250 } else { 2258 } else {
2251 die "An argument must not be declared to be optional unless all subs equent arguments to the operation are also optional." if !$allowNonOptional; 2259 die "An argument must not be declared to be optional unless all subs equent arguments to the operation are also optional." if !$allowNonOptional;
2252 $numMandatoryParams++; 2260 $numMandatoryParams++;
2253 } 2261 }
2254 } 2262 }
2255 2263
2256 my $argumentsCountCheckString = ""; 2264 my $argumentsCountCheckString = "";
2257 if ($numMandatoryParams >= 1) { 2265 if ($numMandatoryParams >= 1) {
2258 $argumentsCountCheckString .= " if (args.Length() < $numMandatoryPara ms)\n"; 2266 if ($style eq "old") {
2259 $argumentsCountCheckString .= " return throwNotEnoughArgumentsErr or(args.GetIsolate());\n"; 2267 $argumentsCountCheckString .= " if (args.Length() < $numMandatory Params)\n";
2268 $argumentsCountCheckString .= " return throwNotEnoughArgument sError(args.GetIsolate());\n";
2269 } else {
2270 $argumentsCountCheckString .= " if (args.Length() < $numMandatory Params) {\n";
2271 $argumentsCountCheckString .= " throwNotEnoughArgumentsError( args.GetIsolate());\n";
2272 $argumentsCountCheckString .= " return;\n";
2273 $argumentsCountCheckString .= " }\n";
2274 }
2260 } 2275 }
2261 return $argumentsCountCheckString; 2276 return $argumentsCountCheckString;
2262 } 2277 }
2263 2278
2279 sub GenerateParametersCheckOldStyle
2280 {
2281 my $function = shift;
2282 my $interface = shift;
2283 my $forMainWorldSuffix = shift;
2284 GenerateParametersCheck($function, $interface, $forMainWorldSuffix, "old");
2285 }
2286
2264 sub GenerateParametersCheck 2287 sub GenerateParametersCheck
2265 { 2288 {
2266 my $function = shift; 2289 my $function = shift;
2267 my $interface = shift; 2290 my $interface = shift;
2268 my $forMainWorldSuffix = shift; 2291 my $forMainWorldSuffix = shift;
2292 my $style = shift || "new";
2293
2294 my $isOld = $style eq "old";
2295 my $trySuffix = "_VOID";
2296 if ($isOld) {
2297 $trySuffix = "";
2298 }
2269 2299
2270 my $parameterCheckString = ""; 2300 my $parameterCheckString = "";
2271 my $paramIndex = 0; 2301 my $paramIndex = 0;
2272 my %replacements = (); 2302 my %replacements = ();
2273 2303
2274 foreach my $parameter (@{$function->parameters}) { 2304 foreach my $parameter (@{$function->parameters}) {
2275 my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex); 2305 my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex);
2276 2306
2277 # Optional arguments without [Default=...] should generate an early call with fewer arguments. 2307 # Optional arguments without [Default=...] should generate an early call with fewer arguments.
2278 # Optional arguments with [Optional=...] should not generate the early c all. 2308 # Optional arguments with [Optional=...] should not generate the early c all.
(...skipping 14 matching lines...) Expand all
2293 } 2323 }
2294 2324
2295 my $parameterName = $parameter->name; 2325 my $parameterName = $parameter->name;
2296 AddToImplIncludes("core/dom/ExceptionCode.h"); 2326 AddToImplIncludes("core/dom/ExceptionCode.h");
2297 if (IsCallbackInterface($parameter->type)) { 2327 if (IsCallbackInterface($parameter->type)) {
2298 my $v8ClassName = "V8" . $parameter->type; 2328 my $v8ClassName = "V8" . $parameter->type;
2299 AddToImplIncludes("$v8ClassName.h"); 2329 AddToImplIncludes("$v8ClassName.h");
2300 if ($parameter->isOptional) { 2330 if ($parameter->isOptional) {
2301 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $ parameterName;\n"; 2331 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $ parameterName;\n";
2302 $parameterCheckString .= " if (args.Length() > $paramIndex && !args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n"; 2332 $parameterCheckString .= " if (args.Length() > $paramIndex && !args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n";
2303 $parameterCheckString .= " if (!args[$paramIndex]->IsFunc tion())\n"; 2333 if ($isOld) {
2304 $parameterCheckString .= " return throwTypeError(0, a rgs.GetIsolate());\n"; 2334 $parameterCheckString .= " if (!args[$paramIndex]->Is Function())\n";
2335 $parameterCheckString .= " return throwTypeError( 0, args.GetIsolate());\n";
2336 } else {
2337 $parameterCheckString .= " if (!args[$paramIndex]->Is Function()) {\n";
2338 $parameterCheckString .= " throwTypeError(0, args .GetIsolate());\n";
2339 $parameterCheckString .= " return;\n";
2340 $parameterCheckString .= " }\n";
2341 }
2305 $parameterCheckString .= " $parameterName = ${v8ClassName }::create(args[$paramIndex], getScriptExecutionContext());\n"; 2342 $parameterCheckString .= " $parameterName = ${v8ClassName }::create(args[$paramIndex], getScriptExecutionContext());\n";
2306 $parameterCheckString .= " }\n"; 2343 $parameterCheckString .= " }\n";
2307 } else { 2344 } else {
2308 $parameterCheckString .= " if (args.Length() <= $paramIndex | | !args[$paramIndex]->IsFunction())\n"; 2345 if ($isOld) {
2309 $parameterCheckString .= " return throwTypeError(0, args. GetIsolate());\n"; 2346 $parameterCheckString .= " if (args.Length() <= $paramInd ex || !args[$paramIndex]->IsFunction())\n";
2347 $parameterCheckString .= " return throwTypeError(0, a rgs.GetIsolate());\n";
2348 } else {
2349 $parameterCheckString .= " if (args.Length() <= $paramInd ex || !args[$paramIndex]->IsFunction()) {\n";
2350 $parameterCheckString .= " throwTypeError(0, args.Get Isolate());\n";
2351 $parameterCheckString .= " return;\n";
2352 $parameterCheckString .= " }\n";
2353 }
2310 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $ parameterName = ${v8ClassName}::create(args[$paramIndex], getScriptExecutionCont ext());\n"; 2354 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $ parameterName = ${v8ClassName}::create(args[$paramIndex], getScriptExecutionCont ext());\n";
2311 } 2355 }
2312 } elsif ($parameter->extendedAttributes->{"Clamp"}) { 2356 } elsif ($parameter->extendedAttributes->{"Clamp"}) {
2313 my $nativeValue = "${parameterName}NativeValue"; 2357 my $nativeValue = "${parameterName}NativeValue";
2314 my $paramType = $parameter->type; 2358 my $paramType = $parameter->type;
2315 $parameterCheckString .= " $paramType $parameterName = 0;\n"; 2359 $parameterCheckString .= " $paramType $parameterName = 0;\n";
2316 $parameterCheckString .= " V8TRYCATCH(double, $nativeValue, a rgs[$paramIndex]->NumberValue());\n"; 2360 $parameterCheckString .= " V8TRYCATCH$trySuffix(double, $nati veValue, args[$paramIndex]->NumberValue());\n";
2317 $parameterCheckString .= " if (!std::isnan($nativeValue))\n"; 2361 $parameterCheckString .= " if (!std::isnan($nativeValue))\n";
2318 $parameterCheckString .= " $parameterName = clampTo<$para mType>($nativeValue);\n"; 2362 $parameterCheckString .= " $parameterName = clampTo<$para mType>($nativeValue);\n";
2319 } elsif ($parameter->type eq "SerializedScriptValue") { 2363 } elsif ($parameter->type eq "SerializedScriptValue") {
2320 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); 2364 AddToImplIncludes("bindings/v8/SerializedScriptValue.h");
2321 $parameterCheckString .= " bool ${parameterName}DidThrow = false; \n"; 2365 $parameterCheckString .= " bool ${parameterName}DidThrow = false; \n";
2322 $parameterCheckString .= " $nativeType $parameterName = Serialize dScriptValue::create(args[$paramIndex], 0, 0, ${parameterName}DidThrow, args.Get Isolate());\n"; 2366 $parameterCheckString .= " $nativeType $parameterName = Serialize dScriptValue::create(args[$paramIndex], 0, 0, ${parameterName}DidThrow, args.Get Isolate());\n";
2323 $parameterCheckString .= " if (${parameterName}DidThrow)\n"; 2367 if ($isOld) {
2324 $parameterCheckString .= " return v8Undefined();\n"; 2368 $parameterCheckString .= " if (${parameterName}DidThrow)\n";
2369 $parameterCheckString .= " return v8Undefined();\n";
2370 } else {
2371 $parameterCheckString .= " if (${parameterName}DidThrow) {\n" ;
2372 $parameterCheckString .= " return;\n";
2373 $parameterCheckString .= " }\n";
2374 }
2325 } elsif ($parameter->isVariadic) { 2375 } elsif ($parameter->isVariadic) {
2326 my $nativeElementType = GetNativeType($parameter->type); 2376 my $nativeElementType = GetNativeType($parameter->type);
2327 if ($nativeElementType =~ />$/) { 2377 if ($nativeElementType =~ />$/) {
2328 $nativeElementType .= " "; 2378 $nativeElementType .= " ";
2329 } 2379 }
2330 2380
2331 my $argType = $parameter->type; 2381 my $argType = $parameter->type;
2332 if (IsWrapperType($argType)) { 2382 if (IsWrapperType($argType)) {
2333 $parameterCheckString .= " Vector<$nativeElementType> $parame terName;\n"; 2383 $parameterCheckString .= " Vector<$nativeElementType> $parame terName;\n";
2334 $parameterCheckString .= " for (int i = $paramIndex; i < args .Length(); ++i) {\n"; 2384 $parameterCheckString .= " for (int i = $paramIndex; i < args .Length(); ++i) {\n";
2335 $parameterCheckString .= " if (!V8${argType}::HasInstance (args[i], args.GetIsolate(), worldType(args.GetIsolate())))\n"; 2385 if ($isOld) {
2336 $parameterCheckString .= " return throwTypeError(0, a rgs.GetIsolate());\n"; 2386 $parameterCheckString .= " if (!V8${argType}::HasInst ance(args[i], args.GetIsolate(), worldType(args.GetIsolate())))\n";
2387 $parameterCheckString .= " return throwTypeError( 0, args.GetIsolate());\n";
2388 } else {
2389 $parameterCheckString .= " if (!V8${argType}::HasInst ance(args[i], args.GetIsolate(), worldType(args.GetIsolate()))) {\n";
2390 $parameterCheckString .= " throwTypeError(0, args .GetIsolate());\n";
2391 $parameterCheckString .= " return;\n";
2392 $parameterCheckString .= " }\n";
2393 }
2337 $parameterCheckString .= " $parameterName.append(V8${argT ype}::toNative(v8::Handle<v8::Object>::Cast(args[i])));\n"; 2394 $parameterCheckString .= " $parameterName.append(V8${argT ype}::toNative(v8::Handle<v8::Object>::Cast(args[i])));\n";
2338 $parameterCheckString .= " }\n"; 2395 $parameterCheckString .= " }\n";
2339 } else { 2396 } else {
2340 $parameterCheckString .= " V8TRYCATCH(Vector<$nativeElementTy pe>, $parameterName, toNativeArguments<$nativeElementType>(args, $paramIndex));\ n"; 2397 $parameterCheckString .= " V8TRYCATCH$trySuffix(Vector<$nativ eElementType>, $parameterName, toNativeArguments<$nativeElementType>(args, $para mIndex));\n";
2341 } 2398 }
2342 } elsif ($nativeType =~ /^V8StringResource/) { 2399 } elsif ($nativeType =~ /^V8StringResource/) {
2343 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; 2400 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : "";
2344 my $value = JSValueToNative($parameter->type, $parameter->extendedAt tributes, $parameter->isOptional && $default eq "NullString" ? "argumentOrNull(a rgs, $paramIndex)" : "args[$paramIndex]", "args.GetIsolate()"); 2401 my $value = JSValueToNative($parameter->type, $parameter->extendedAt tributes, $parameter->isOptional && $default eq "NullString" ? "argumentOrNull(a rgs, $paramIndex)" : "args[$paramIndex]", "args.GetIsolate()");
2345 $parameterCheckString .= " " . ConvertToV8StringResource($paramet er, $nativeType, $parameterName, $value) . "\n"; 2402 my $suffix = $isOld ? "" : "VOID";
2403 $parameterCheckString .= " " . ConvertToV8StringResource($paramet er, $nativeType, $parameterName, $value, $suffix) . "\n";
2346 if (IsEnumType($parameter->type)) { 2404 if (IsEnumType($parameter->type)) {
2347 my @enumValues = ValidEnumValues($parameter->type); 2405 my @enumValues = ValidEnumValues($parameter->type);
2348 my @validEqualities = (); 2406 my @validEqualities = ();
2349 foreach my $enumValue (@enumValues) { 2407 foreach my $enumValue (@enumValues) {
2350 push(@validEqualities, "string == \"$enumValue\""); 2408 push(@validEqualities, "string == \"$enumValue\"");
2351 } 2409 }
2352 my $enumValidationExpression = join(" || ", @validEqualities); 2410 my $enumValidationExpression = join(" || ", @validEqualities);
2353 $parameterCheckString .= " String string = $parameterName;\n "; 2411 $parameterCheckString .= " String string = $parameterName;\n ";
2354 $parameterCheckString .= " if (!($enumValidationExpression)) \n"; 2412 if ($isOld) {
2355 $parameterCheckString .= " return throwTypeError(0, args .GetIsolate());\n"; 2413 $parameterCheckString .= " if (!($enumValidationExpressi on))\n";
2414 $parameterCheckString .= " return throwTypeError(0, a rgs.GetIsolate());\n";
2415 } else {
2416 $parameterCheckString .= " if (!($enumValidationExpressio n)) {\n";
2417 $parameterCheckString .= " throwTypeError(0, args.Get Isolate());\n";
2418 $parameterCheckString .= " return;\n";
2419 $parameterCheckString .= " }\n";
2420 }
2356 } 2421 }
2357 } else { 2422 } else {
2358 # If the "StrictTypeChecking" extended attribute is present, and the argument's type is an 2423 # If the "StrictTypeChecking" extended attribute is present, and the argument's type is an
2359 # interface type, then if the incoming value does not implement that interface, a TypeError 2424 # interface type, then if the incoming value does not implement that interface, a TypeError
2360 # is thrown rather than silently passing NULL to the C++ code. 2425 # is thrown rather than silently passing NULL to the C++ code.
2361 # Per the Web IDL and ECMAScript specifications, incoming values can always be converted 2426 # Per the Web IDL and ECMAScript specifications, incoming values can always be converted
2362 # to both strings and numbers, so do not throw TypeError if the argu ment is of these 2427 # to both strings and numbers, so do not throw TypeError if the argu ment is of these
2363 # types. 2428 # types.
2364 if ($function->signature->extendedAttributes->{"StrictTypeChecking"} ) { 2429 if ($function->signature->extendedAttributes->{"StrictTypeChecking"} ) {
2365 my $argValue = "args[$paramIndex]"; 2430 my $argValue = "args[$paramIndex]";
2366 my $argType = $parameter->type; 2431 my $argType = $parameter->type;
2367 if (IsWrapperType($argType)) { 2432 if (IsWrapperType($argType)) {
2368 $parameterCheckString .= " if (args.Length() > $paramInde x && !isUndefinedOrNull($argValue) && !V8${argType}::HasInstance($argValue, args .GetIsolate(), worldType(args.GetIsolate())))\n"; 2433 if ($isOld) {
2369 $parameterCheckString .= " return throwTypeError(0, a rgs.GetIsolate());\n"; 2434 $parameterCheckString .= " if (args.Length() > $param Index && !isUndefinedOrNull($argValue) && !V8${argType}::HasInstance($argValue, args.GetIsolate(), worldType(args.GetIsolate())))\n";
2435 $parameterCheckString .= " return throwTypeError( 0, args.GetIsolate());\n";
2436 } else {
2437 $parameterCheckString .= " if (args.Length() > $param Index && !isUndefinedOrNull($argValue) && !V8${argType}::HasInstance($argValue, args.GetIsolate(), worldType(args.GetIsolate()))) {\n";
2438 $parameterCheckString .= " throwTypeError(0, args .GetIsolate());\n";
2439 $parameterCheckString .= " return;\n";
2440 $parameterCheckString .= " }\n";
2441 }
2370 } 2442 }
2371 } 2443 }
2372 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; 2444 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : "";
2373 my $value = JSValueToNative($parameter->type, $parameter->extendedAt tributes, $parameter->isOptional && $default eq "NullString" ? "argumentOrNull(a rgs, $paramIndex)" : "args[$paramIndex]", "args.GetIsolate()"); 2445 my $value = JSValueToNative($parameter->type, $parameter->extendedAt tributes, $parameter->isOptional && $default eq "NullString" ? "argumentOrNull(a rgs, $paramIndex)" : "args[$paramIndex]", "args.GetIsolate()");
2374 if ($parameter->extendedAttributes->{"EnforceRange"}) { 2446 if ($parameter->extendedAttributes->{"EnforceRange"}) {
2375 $parameterCheckString .= " V8TRYCATCH_WITH_TYPECHECK($nativeT ype, $parameterName, $value, args.GetIsolate());\n"; 2447 $parameterCheckString .= " V8TRYCATCH_WITH_TYPECHECK$trySuffi x($nativeType, $parameterName, $value, args.GetIsolate());\n";
2376 } else { 2448 } else {
2377 $parameterCheckString .= " V8TRYCATCH($nativeType, $parameter Name, $value);\n"; 2449 $parameterCheckString .= " V8TRYCATCH$trySuffix($nativeType, $parameterName, $value);\n";
2378 } 2450 }
2379 if ($nativeType eq 'Dictionary') { 2451 if ($nativeType eq 'Dictionary') {
2380 $parameterCheckString .= " if (!$parameterName.isUndefinedOrNu ll() && !$parameterName.isObject())\n"; 2452 if ($isOld) {
2381 $parameterCheckString .= " return throwTypeError(\"Not an object.\", args.GetIsolate());\n"; 2453 $parameterCheckString .= " if (!$parameterName.isUndefine dOrNull() && !$parameterName.isObject())\n";
2454 $parameterCheckString .= " return throwTypeError(\"No t an object.\", args.GetIsolate());\n";
2455 } else {
2456 $parameterCheckString .= " if (!$parameterName.isUndefine dOrNull() && !$parameterName.isObject()) {\n";
2457 $parameterCheckString .= " throwTypeError(\"Not an ob ject.\", args.GetIsolate());\n";
2458 $parameterCheckString .= " return;\n";
2459 $parameterCheckString .= " }\n";
2460 }
2382 } 2461 }
2383 } 2462 }
2384 2463
2385 if ($parameter->extendedAttributes->{"IsIndex"}) { 2464 if ($parameter->extendedAttributes->{"IsIndex"}) {
2386 $parameterCheckString .= " if (UNLIKELY($parameterName < 0))\n"; 2465 if ($isOld) {
2387 $parameterCheckString .= " return setDOMException(INDEX_SIZE_ ERR, args.GetIsolate());\n"; 2466 $parameterCheckString .= " if (UNLIKELY($parameterName < 0))\ n";
2467 $parameterCheckString .= " return setDOMException(INDEX_S IZE_ERR, args.GetIsolate());\n";
2468 } else {
2469 $parameterCheckString .= " if (UNLIKELY($parameterName < 0)) {\n";
2470 $parameterCheckString .= " setDOMException(INDEX_SIZE_ERR , args.GetIsolate());\n";
2471 $parameterCheckString .= " return;\n";
2472 $parameterCheckString .= " }\n";
2473 }
2388 } 2474 }
2389 2475
2390 $paramIndex++; 2476 $paramIndex++;
2391 } 2477 }
2392 return ($parameterCheckString, $paramIndex, %replacements); 2478 return ($parameterCheckString, $paramIndex, %replacements);
2393 } 2479 }
2394 2480
2395 sub GenerateOverloadedConstructorCallback 2481 sub GenerateOverloadedConstructorCallback
2396 { 2482 {
2397 my $interface = shift; 2483 my $interface = shift;
2398 my $implClassName = GetImplName($interface); 2484 my $implClassName = GetImplName($interface);
2399 2485
2400 my $code = ""; 2486 my $code = "";
2401 $code .= <<END; 2487 $code .= <<END;
2402 static v8::Handle<v8::Value> constructor(const v8::Arguments& args) 2488 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args)
2403 { 2489 {
2404 END 2490 END
2405 my $leastNumMandatoryParams = 255; 2491 my $leastNumMandatoryParams = 255;
2406 foreach my $constructor (@{$interface->constructors}) { 2492 foreach my $constructor (@{$interface->constructors}) {
2407 my $name = "constructor" . $constructor->{overloadedIndex}; 2493 my $name = "constructor" . $constructor->{overloadedIndex};
2408 my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersC heck($constructor); 2494 my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersC heck($constructor);
2409 $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams < $leastNumMandatoryParams); 2495 $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams < $leastNumMandatoryParams);
2410 $code .= " if ($parametersCheck)\n"; 2496 $code .= " if ($parametersCheck) {\n";
2411 $code .= " return ${implClassName}V8Internal::${name}(args);\n"; 2497 $code .= " ${implClassName}V8Internal::${name}(args);\n";
2498 $code .= " return;\n";
2499 $code .= " }\n";
2412 } 2500 }
2413 if ($leastNumMandatoryParams >= 1) { 2501 if ($leastNumMandatoryParams >= 1) {
2414 $code .= " if (args.Length() < $leastNumMandatoryParams)\n"; 2502 $code .= " if (args.Length() < $leastNumMandatoryParams) {\n";
2415 $code .= " return throwNotEnoughArgumentsError(args.GetIsolate()) ;\n"; 2503 $code .= " throwNotEnoughArgumentsError(args.GetIsolate());\n";
2504 $code .= " return;\n";
2505 $code .= " }\n";
2416 } 2506 }
2417 $code .= <<END; 2507 $code .= <<END;
2418 return throwTypeError(0, args.GetIsolate()); 2508 throwTypeError(0, args.GetIsolate());
2509 return;
2419 END 2510 END
2420 $code .= "}\n\n"; 2511 $code .= "}\n\n";
2421 $implementation{nameSpaceInternal}->add($code); 2512 $implementation{nameSpaceInternal}->add($code);
2422 } 2513 }
2423 2514
2424 sub GenerateSingleConstructorCallback 2515 sub GenerateSingleConstructorCallback
2425 { 2516 {
2426 my $interface = shift; 2517 my $interface = shift;
2427 my $function = shift; 2518 my $function = shift;
2428 2519
(...skipping 13 matching lines...) Expand all
2442 if ($parameter->extendedAttributes->{"IsIndex"}) { 2533 if ($parameter->extendedAttributes->{"IsIndex"}) {
2443 $raisesExceptions = 1; 2534 $raisesExceptions = 1;
2444 } 2535 }
2445 } 2536 }
2446 } 2537 }
2447 2538
2448 my @beforeArgumentList; 2539 my @beforeArgumentList;
2449 my @afterArgumentList; 2540 my @afterArgumentList;
2450 my $code = ""; 2541 my $code = "";
2451 $code .= <<END; 2542 $code .= <<END;
2452 static v8::Handle<v8::Value> constructor${overloadedIndexString}(const v8::Argum ents& args) 2543 static void constructor${overloadedIndexString}(const v8::FunctionCallbackInfo<v 8::Value>& args)
2453 { 2544 {
2454 END 2545 END
2455 2546
2456 if ($function->{overloadedIndex} == 0) { 2547 if ($function->{overloadedIndex} == 0) {
2457 $code .= GenerateArgumentsCountCheck($function, $interface); 2548 $code .= GenerateArgumentsCountCheck($function, $interface);
2458 } 2549 }
2459 2550
2460 if ($raisesExceptions) { 2551 if ($raisesExceptions) {
2461 AddToImplIncludes("core/dom/ExceptionCode.h"); 2552 AddToImplIncludes("core/dom/ExceptionCode.h");
2462 $code .= " ExceptionCode ec = 0;\n"; 2553 $code .= " ExceptionCode ec = 0;\n";
(...skipping 26 matching lines...) Expand all
2489 } 2580 }
2490 $index++; 2581 $index++;
2491 } 2582 }
2492 2583
2493 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr gumentList); 2584 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr gumentList);
2494 $code .= "\n"; 2585 $code .= "\n";
2495 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::create(${arg umentString});\n"; 2586 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::create(${arg umentString});\n";
2496 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n"; 2587 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n";
2497 2588
2498 if ($interface->extendedAttributes->{"RaisesException"}) { 2589 if ($interface->extendedAttributes->{"RaisesException"}) {
2499 $code .= " if (ec)\n"; 2590 $code .= " if (ec) {\n";
2500 $code .= " return setDOMException(ec, args.GetIsolate());\n"; 2591 $code .= " setDOMException(ec, args.GetIsolate());\n";
2592 $code .= " return;\n";
2593 $code .= " }\n";
2501 } 2594 }
2502 2595
2503 $code .= <<END; 2596 $code .= <<END;
2504 2597
2505 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}::in fo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 2598 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}::in fo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
2506 return wrapper; 2599 args.GetReturnValue().Set(wrapper);
2507 } 2600 }
2508 2601
2509 END 2602 END
2510 $implementation{nameSpaceInternal}->add($code); 2603 $implementation{nameSpaceInternal}->add($code);
2511 } 2604 }
2512 2605
2513 # The Web IDL specification states that Interface objects for interfaces MUST ha ve a property named 2606 # The Web IDL specification states that Interface objects for interfaces MUST ha ve a property named
2514 # "length" that returns the length of the shortest argument list of the entries in the effective 2607 # "length" that returns the length of the shortest argument list of the entries in the effective
2515 # overload set for constructors. In other words, use the lowest number of mandat ory arguments among 2608 # overload set for constructors. In other words, use the lowest number of mandat ory arguments among
2516 # all constructors. 2609 # all constructors.
(...skipping 17 matching lines...) Expand all
2534 return $leastConstructorLength; 2627 return $leastConstructorLength;
2535 } 2628 }
2536 2629
2537 sub GenerateConstructorCallback 2630 sub GenerateConstructorCallback
2538 { 2631 {
2539 my $interface = shift; 2632 my $interface = shift;
2540 2633
2541 my $implClassName = GetImplName($interface); 2634 my $implClassName = GetImplName($interface);
2542 my $v8ClassName = GetV8ClassName($interface); 2635 my $v8ClassName = GetV8ClassName($interface);
2543 my $code = ""; 2636 my $code = "";
2544 $code .= "v8::Handle<v8::Value> ${v8ClassName}::constructorCallback(const v8 ::Arguments& args)\n"; 2637 $code .= "void ${v8ClassName}::constructorCallback(const v8::FunctionCallbac kInfo<v8::Value>& args)\n";
2545 $code .= "{\n"; 2638 $code .= "{\n";
2546 $code .= GenerateFeatureObservation($interface->extendedAttributes->{"Measur eAs"}); 2639 $code .= GenerateFeatureObservation($interface->extendedAttributes->{"Measur eAs"});
2547 $code .= GenerateDeprecationNotification($interface->extendedAttributes->{"D eprecateAs"}); 2640 $code .= GenerateDeprecationNotification($interface->extendedAttributes->{"D eprecateAs"});
2548 $code .= GenerateConstructorHeader(); 2641 $code .= GenerateConstructorHeader();
2549 if (HasCustomConstructor($interface)) { 2642 if (HasCustomConstructor($interface)) {
2550 $code .= " return ${v8ClassName}::constructorCustom(args);\n"; 2643 $code .= " ${v8ClassName}::constructorCustom(args);\n";
2551 } else { 2644 } else {
2552 $code .= " return ${implClassName}V8Internal::constructor(args);\n"; 2645 $code .= " ${implClassName}V8Internal::constructor(args);\n";
2553 } 2646 }
2554 $code .= "}\n\n"; 2647 $code .= "}\n\n";
2555 $implementation{nameSpaceWebCore}->add($code); 2648 $implementation{nameSpaceWebCore}->add($code);
2556 } 2649 }
2557 2650
2558 sub GenerateConstructor 2651 sub GenerateConstructor
2559 { 2652 {
2560 my $interface = shift; 2653 my $interface = shift;
2561 2654
2562 if (@{$interface->constructors} == 1) { 2655 if (@{$interface->constructors} == 1) {
2563 GenerateSingleConstructorCallback($interface, @{$interface->constructors }[0]); 2656 GenerateSingleConstructorCallback($interface, @{$interface->constructors }[0]);
2564 } else { 2657 } else {
2565 foreach my $constructor (@{$interface->constructors}) { 2658 foreach my $constructor (@{$interface->constructors}) {
2566 GenerateSingleConstructorCallback($interface, $constructor); 2659 GenerateSingleConstructorCallback($interface, $constructor);
2567 } 2660 }
2568 GenerateOverloadedConstructorCallback($interface); 2661 GenerateOverloadedConstructorCallback($interface);
2569 } 2662 }
2570 } 2663 }
2571 2664
2572 sub GenerateEventConstructor 2665 sub GenerateEventConstructor
2573 { 2666 {
2574 my $interface = shift; 2667 my $interface = shift;
2575 my $implClassName = GetImplName($interface); 2668 my $implClassName = GetImplName($interface);
2576 my $v8ClassName = GetV8ClassName($interface); 2669 my $v8ClassName = GetV8ClassName($interface);
2577 2670
2578 AddToImplIncludes("bindings/v8/Dictionary.h"); 2671 AddToImplIncludes("bindings/v8/Dictionary.h");
2579 $implementation{nameSpaceInternal}->add(<<END); 2672 $implementation{nameSpaceInternal}->add(<<END);
2580 static v8::Handle<v8::Value> constructor(const v8::Arguments& args) 2673 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args)
2581 { 2674 {
2582 if (args.Length() < 1) 2675 if (args.Length() < 1) {
2583 return throwNotEnoughArgumentsError(args.GetIsolate()); 2676 throwNotEnoughArgumentsError(args.GetIsolate());
2677 return;
2678 }
2584 2679
2585 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, type, args[0]); 2680 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]);
2586 ${implClassName}Init eventInit; 2681 ${implClassName}Init eventInit;
2587 if (args.Length() >= 2) { 2682 if (args.Length() >= 2) {
2588 V8TRYCATCH(Dictionary, options, Dictionary(args[1], args.GetIsolate())); 2683 V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate ()));
2589 if (!fill${implClassName}Init(eventInit, options)) 2684 if (!fill${implClassName}Init(eventInit, options))
2590 return v8Undefined(); 2685 return;
2591 } 2686 }
2592 2687
2593 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit); 2688 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit);
2594 2689
2595 v8::Handle<v8::Object> wrapper = args.Holder(); 2690 v8::Handle<v8::Object> wrapper = args.Holder();
2596 V8DOMWrapper::associateObjectWithWrapper(event.release(), &${v8ClassName}::i nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 2691 V8DOMWrapper::associateObjectWithWrapper(event.release(), &${v8ClassName}::i nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
2597 return wrapper; 2692 args.GetReturnValue().Set(wrapper);
2598 } 2693 }
2599 END 2694 END
2600 2695
2601 my $code = ""; 2696 my $code = "";
2602 $code .= <<END; 2697 $code .= <<END;
2603 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary& options) 2698 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary& options)
2604 { 2699 {
2605 END 2700 END
2606 2701
2607 foreach my $interfaceBase (@{$interface->parents}) { 2702 foreach my $interfaceBase (@{$interface->parents}) {
(...skipping 23 matching lines...) Expand all
2631 sub GenerateTypedArrayConstructor 2726 sub GenerateTypedArrayConstructor
2632 { 2727 {
2633 my $interface = shift; 2728 my $interface = shift;
2634 my $implClassName = GetImplName($interface); 2729 my $implClassName = GetImplName($interface);
2635 my $v8ClassName = GetV8ClassName($interface); 2730 my $v8ClassName = GetV8ClassName($interface);
2636 2731
2637 my ($nativeType, $arrayType) = GetNativeTypeOfTypedArray($interface); 2732 my ($nativeType, $arrayType) = GetNativeTypeOfTypedArray($interface);
2638 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h"); 2733 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h");
2639 2734
2640 $implementation{nameSpaceInternal}->add(<<END); 2735 $implementation{nameSpaceInternal}->add(<<END);
2641 static v8::Handle<v8::Value> constructor(const v8::Arguments& args) 2736 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args)
2642 { 2737 {
2643 return constructWebGLArray<$implClassName, ${v8ClassName}, $nativeType>(args , &${v8ClassName}::info, $arrayType); 2738 return constructWebGLArray<$implClassName, ${v8ClassName}, $nativeType>(args , &${v8ClassName}::info, $arrayType);
2644 } 2739 }
2645 2740
2646 END 2741 END
2647 } 2742 }
2648 2743
2649 sub GenerateNamedConstructor 2744 sub GenerateNamedConstructor
2650 { 2745 {
2651 my $function = shift; 2746 my $function = shift;
(...skipping 30 matching lines...) Expand all
2682 } 2777 }
2683 2778
2684 AddToImplIncludes("core/page/Frame.h"); 2779 AddToImplIncludes("core/page/Frame.h");
2685 $implementation{nameSpaceWebCore}->add(<<END); 2780 $implementation{nameSpaceWebCore}->add(<<END);
2686 WrapperTypeInfo ${v8ClassName}Constructor::info = { ${v8ClassName}Constructor::G etTemplate, ${v8ClassName}::derefObject, $toActiveDOMObject, $toEventTarget, 0, ${v8ClassName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectProtot ype }; 2781 WrapperTypeInfo ${v8ClassName}Constructor::info = { ${v8ClassName}Constructor::G etTemplate, ${v8ClassName}::derefObject, $toActiveDOMObject, $toEventTarget, 0, ${v8ClassName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectProtot ype };
2687 2782
2688 END 2783 END
2689 2784
2690 my $code = ""; 2785 my $code = "";
2691 $code .= <<END; 2786 $code .= <<END;
2692 static v8::Handle<v8::Value> ${v8ClassName}ConstructorCallback(const v8::Argumen ts& args) 2787 static void ${v8ClassName}ConstructorCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
2693 { 2788 {
2694 END 2789 END
2695 $code .= $maybeObserveFeature if $maybeObserveFeature; 2790 $code .= $maybeObserveFeature if $maybeObserveFeature;
2696 $code .= $maybeDeprecateFeature if $maybeDeprecateFeature; 2791 $code .= $maybeDeprecateFeature if $maybeDeprecateFeature;
2697 $code .= GenerateConstructorHeader(); 2792 $code .= GenerateConstructorHeader();
2698 AddToImplIncludes("V8Document.h"); 2793 AddToImplIncludes("V8Document.h");
2699 $code .= <<END; 2794 $code .= <<END;
2700 Document* document = currentDocument(); 2795 Document* document = currentDocument();
2701 2796
2702 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp lClassName} instance 2797 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp lClassName} instance
(...skipping 29 matching lines...) Expand all
2732 } 2827 }
2733 $index++; 2828 $index++;
2734 } 2829 }
2735 2830
2736 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr gumentList); 2831 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr gumentList);
2737 $code .= "\n"; 2832 $code .= "\n";
2738 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::createForJSC onstructor(${argumentString});\n"; 2833 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::createForJSC onstructor(${argumentString});\n";
2739 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n"; 2834 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n";
2740 2835
2741 if ($interface->extendedAttributes->{"RaisesException"}) { 2836 if ($interface->extendedAttributes->{"RaisesException"}) {
2742 $code .= " if (ec)\n"; 2837 $code .= " if (ec) {\n";
2743 $code .= " return setDOMException(ec, args.GetIsolate());\n"; 2838 $code .= " setDOMException(ec, args.GetIsolate());\n";
2839 $code .= " return;\n";
2840 $code .= " }\n";
2744 } 2841 }
2745 2842
2746 $code .= <<END; 2843 $code .= <<END;
2747 2844
2748 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}Cons tructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 2845 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}Cons tructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
2749 return wrapper; 2846 args.GetReturnValue().Set(wrapper);
2750 } 2847 }
2751 2848
2752 END 2849 END
2753 $implementation{nameSpaceWebCore}->add($code); 2850 $implementation{nameSpaceWebCore}->add($code);
2754 2851
2755 $code = <<END; 2852 $code = <<END;
2756 v8::Persistent<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8:: Isolate* isolate, WrapperWorldType currentWorldType) 2853 v8::Persistent<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8:: Isolate* isolate, WrapperWorldType currentWorldType)
2757 { 2854 {
2758 static v8::Persistent<v8::FunctionTemplate> cachedTemplate; 2855 static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
2759 if (!cachedTemplate.IsEmpty()) 2856 if (!cachedTemplate.IsEmpty())
(...skipping 12 matching lines...) Expand all
2772 } 2869 }
2773 2870
2774 END 2871 END
2775 $implementation{nameSpaceWebCore}->add($code); 2872 $implementation{nameSpaceWebCore}->add($code);
2776 } 2873 }
2777 2874
2778 sub GenerateConstructorHeader 2875 sub GenerateConstructorHeader
2779 { 2876 {
2780 AddToImplIncludes("bindings/v8/V8ObjectConstructor.h"); 2877 AddToImplIncludes("bindings/v8/V8ObjectConstructor.h");
2781 my $content = <<END; 2878 my $content = <<END;
2782 if (!args.IsConstructCall()) 2879 if (!args.IsConstructCall()) {
2783 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate()); 2880 throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
2881 return;
2882 }
2784 2883
2785 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) 2884 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
2786 return args.Holder(); 2885 args.GetReturnValue().Set(args.Holder());
2886 return;
2887 }
2787 2888
2788 END 2889 END
2789 return $content; 2890 return $content;
2790 } 2891 }
2791 2892
2792 sub GenerateBatchedAttributeData 2893 sub GenerateBatchedAttributeData
2793 { 2894 {
2794 my $interface = shift; 2895 my $interface = shift;
2795 my $attributes = shift; 2896 my $attributes = shift;
2796 my $code = ""; 2897 my $code = "";
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after
5442 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 5543 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
5443 $found = 1; 5544 $found = 1;
5444 } 5545 }
5445 return 1 if $found; 5546 return 1 if $found;
5446 }, 0); 5547 }, 0);
5447 5548
5448 return $found; 5549 return $found;
5449 } 5550 }
5450 5551
5451 1; 5552 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8Float64Array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698