| OLD | NEW |
| 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 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 # Generate security checks if necessary | 1151 # Generate security checks if necessary |
| 1152 if ($attribute->signature->extendedAttributes->{"CheckSecurityForNode"}) { | 1152 if ($attribute->signature->extendedAttributes->{"CheckSecurityForNode"}) { |
| 1153 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(BindingState
::instance(), imp->" . $attribute->signature->name . "()))\n return v8::H
andle<v8::Value>(v8Null(info.GetIsolate()));\n\n"; | 1153 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(BindingState
::instance(), imp->" . $attribute->signature->name . "()))\n return v8::H
andle<v8::Value>(v8Null(info.GetIsolate()));\n\n"; |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 my $useExceptions = 1 if $attribute->signature->extendedAttributes->{"Getter
RaisesException"}; | 1156 my $useExceptions = 1 if $attribute->signature->extendedAttributes->{"Getter
RaisesException"}; |
| 1157 my $isNullable = $attribute->signature->isNullable; | 1157 my $isNullable = $attribute->signature->isNullable; |
| 1158 if ($useExceptions) { | 1158 if ($useExceptions) { |
| 1159 AddToImplIncludes("ExceptionCode.h"); | 1159 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 1160 $code .= " ExceptionCode ec = 0;\n"; | 1160 $code .= " ExceptionCode ec = 0;\n"; |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 if ($isNullable) { | 1163 if ($isNullable) { |
| 1164 $code .= " bool isNull = false;\n"; | 1164 $code .= " bool isNull = false;\n"; |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 my $returnType = $attribute->signature->type; | 1167 my $returnType = $attribute->signature->type; |
| 1168 my $getterString; | 1168 my $getterString; |
| 1169 | 1169 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 sub GenerateCustomElementInvocationScopeIfNeeded | 1390 sub GenerateCustomElementInvocationScopeIfNeeded |
| 1391 { | 1391 { |
| 1392 my $code = ""; | 1392 my $code = ""; |
| 1393 my $ext = shift; | 1393 my $ext = shift; |
| 1394 | 1394 |
| 1395 if ($ext->{"DeliverCustomElementCallbacks"}) { | 1395 if ($ext->{"DeliverCustomElementCallbacks"}) { |
| 1396 if ($ext->{"Reflect"}) { | 1396 if ($ext->{"Reflect"}) { |
| 1397 die "IDL error: [Reflect] and [DeliverCustomElementCallbacks] cannot
coexist yet"; | 1397 die "IDL error: [Reflect] and [DeliverCustomElementCallbacks] cannot
coexist yet"; |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 AddToImplIncludes("CustomElementRegistry.h"); | 1400 AddToImplIncludes("core/dom/CustomElementRegistry.h"); |
| 1401 $code .= <<END; | 1401 $code .= <<END; |
| 1402 CustomElementRegistry::CallbackDeliveryScope deliveryScope; | 1402 CustomElementRegistry::CallbackDeliveryScope deliveryScope; |
| 1403 END | 1403 END |
| 1404 } | 1404 } |
| 1405 return $code; | 1405 return $code; |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 sub GenerateNormalAttrSetterCallback | 1408 sub GenerateNormalAttrSetterCallback |
| 1409 { | 1409 { |
| 1410 my $attribute = shift; | 1410 my $attribute = shift; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($interfaceName)
; | 1477 my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($interfaceName)
; |
| 1478 if ($svgNativeType) { | 1478 if ($svgNativeType) { |
| 1479 my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearO
ff($interfaceName); | 1479 my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearO
ff($interfaceName); |
| 1480 if ($svgWrappedNativeType =~ /List$/) { | 1480 if ($svgWrappedNativeType =~ /List$/) { |
| 1481 $code .= <<END; | 1481 $code .= <<END; |
| 1482 $svgNativeType* imp = ${v8InterfaceName}::toNative(info.Holder()); | 1482 $svgNativeType* imp = ${v8InterfaceName}::toNative(info.Holder()); |
| 1483 END | 1483 END |
| 1484 } else { | 1484 } else { |
| 1485 AddToImplIncludes("ExceptionCode.h"); | 1485 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 1486 $code .= " $svgNativeType* wrapper = ${v8InterfaceName}::toNative
(info.Holder());\n"; | 1486 $code .= " $svgNativeType* wrapper = ${v8InterfaceName}::toNative
(info.Holder());\n"; |
| 1487 $code .= " if (wrapper->isReadOnly()) {\n"; | 1487 $code .= " if (wrapper->isReadOnly()) {\n"; |
| 1488 $code .= " setDOMException(NO_MODIFICATION_ALLOWED_ERR, info.
GetIsolate());\n"; | 1488 $code .= " setDOMException(NO_MODIFICATION_ALLOWED_ERR, info.
GetIsolate());\n"; |
| 1489 $code .= " return;\n"; | 1489 $code .= " return;\n"; |
| 1490 $code .= " }\n"; | 1490 $code .= " }\n"; |
| 1491 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; | 1491 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; |
| 1492 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; | 1492 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; |
| 1493 } | 1493 } |
| 1494 } elsif ($attrExt->{"OnProto"}) { | 1494 } elsif ($attrExt->{"OnProto"}) { |
| 1495 $code .= <<END; | 1495 $code .= <<END; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 my $returnType = $attribute->signature->type; | 1559 my $returnType = $attribute->signature->type; |
| 1560 if ($codeGenerator->IsRefPtrType($returnType) && !$codeGenerator->GetArrayTy
pe($returnType)) { | 1560 if ($codeGenerator->IsRefPtrType($returnType) && !$codeGenerator->GetArrayTy
pe($returnType)) { |
| 1561 $expression = "WTF::getPtr(" . $expression . ")"; | 1561 $expression = "WTF::getPtr(" . $expression . ")"; |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 $code .= GenerateCustomElementInvocationScopeIfNeeded($attribute->signature-
>extendedAttributes); | 1564 $code .= GenerateCustomElementInvocationScopeIfNeeded($attribute->signature-
>extendedAttributes); |
| 1565 | 1565 |
| 1566 my $useExceptions = 1 if $attribute->signature->extendedAttributes->{"Setter
RaisesException"}; | 1566 my $useExceptions = 1 if $attribute->signature->extendedAttributes->{"Setter
RaisesException"}; |
| 1567 | 1567 |
| 1568 if ($useExceptions) { | 1568 if ($useExceptions) { |
| 1569 AddToImplIncludes("ExceptionCode.h"); | 1569 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 1570 $code .= " ExceptionCode ec = 0;\n"; | 1570 $code .= " ExceptionCode ec = 0;\n"; |
| 1571 } | 1571 } |
| 1572 | 1572 |
| 1573 if ($interfaceName eq "SVGNumber") { | 1573 if ($interfaceName eq "SVGNumber") { |
| 1574 $code .= " *imp = $expression;\n"; | 1574 $code .= " *imp = $expression;\n"; |
| 1575 } else { | 1575 } else { |
| 1576 if ($attribute->signature->type eq "EventListener") { | 1576 if ($attribute->signature->type eq "EventListener") { |
| 1577 my $implSetterFunctionName = $codeGenerator->WK_ucfirst($attrName); | 1577 my $implSetterFunctionName = $codeGenerator->WK_ucfirst($attrName); |
| 1578 AddToImplIncludes("V8AbstractEventListener.h"); | 1578 AddToImplIncludes("V8AbstractEventListener.h"); |
| 1579 if (!$codeGenerator->InheritsInterface($interface, "Node")) { | 1579 if (!$codeGenerator->InheritsInterface($interface, "Node")) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 return; | 1874 return; |
| 1875 } | 1875 } |
| 1876 | 1876 |
| 1877 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); | 1877 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); |
| 1878 | 1878 |
| 1879 if ($svgNativeType) { | 1879 if ($svgNativeType) { |
| 1880 my $nativeClassName = GetNativeType($interfaceName); | 1880 my $nativeClassName = GetNativeType($interfaceName); |
| 1881 if ($interfaceName =~ /List$/) { | 1881 if ($interfaceName =~ /List$/) { |
| 1882 $code .= " $nativeClassName imp = ${v8InterfaceName}::toNative(ar
gs.Holder());\n"; | 1882 $code .= " $nativeClassName imp = ${v8InterfaceName}::toNative(ar
gs.Holder());\n"; |
| 1883 } else { | 1883 } else { |
| 1884 AddToImplIncludes("ExceptionCode.h"); | 1884 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 1885 $code .= " $nativeClassName wrapper = ${v8InterfaceName}::toNativ
e(args.Holder());\n"; | 1885 $code .= " $nativeClassName wrapper = ${v8InterfaceName}::toNativ
e(args.Holder());\n"; |
| 1886 $code .= " if (wrapper->isReadOnly())\n"; | 1886 $code .= " if (wrapper->isReadOnly())\n"; |
| 1887 $code .= " return setDOMException(NO_MODIFICATION_ALLOWED_ERR
, args.GetIsolate());\n"; | 1887 $code .= " return setDOMException(NO_MODIFICATION_ALLOWED_ERR
, args.GetIsolate());\n"; |
| 1888 my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingT
earOff($interfaceName); | 1888 my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingT
earOff($interfaceName); |
| 1889 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; | 1889 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; |
| 1890 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; | 1890 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; |
| 1891 } | 1891 } |
| 1892 } elsif (!$function->isStatic) { | 1892 } elsif (!$function->isStatic) { |
| 1893 $code .= <<END; | 1893 $code .= <<END; |
| 1894 ${interfaceName}* imp = ${v8InterfaceName}::toNative(args.Holder()); | 1894 ${interfaceName}* imp = ${v8InterfaceName}::toNative(args.Holder()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1910 my $raisesExceptions = $function->signature->extendedAttributes->{"RaisesExc
eption"}; | 1910 my $raisesExceptions = $function->signature->extendedAttributes->{"RaisesExc
eption"}; |
| 1911 if (!$raisesExceptions) { | 1911 if (!$raisesExceptions) { |
| 1912 foreach my $parameter (@{$function->parameters}) { | 1912 foreach my $parameter (@{$function->parameters}) { |
| 1913 if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailCo
nversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { | 1913 if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailCo
nversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { |
| 1914 $raisesExceptions = 1; | 1914 $raisesExceptions = 1; |
| 1915 } | 1915 } |
| 1916 } | 1916 } |
| 1917 } | 1917 } |
| 1918 | 1918 |
| 1919 if ($raisesExceptions) { | 1919 if ($raisesExceptions) { |
| 1920 AddToImplIncludes("ExceptionCode.h"); | 1920 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 1921 $code .= " ExceptionCode ec = 0;\n"; | 1921 $code .= " ExceptionCode ec = 0;\n"; |
| 1922 $code .= " {\n"; | 1922 $code .= " {\n"; |
| 1923 # The brace here is needed to prevent the ensuing 'goto fail's from jump
ing past constructors | 1923 # The brace here is needed to prevent the ensuing 'goto fail's from jump
ing past constructors |
| 1924 # of objects (like Strings) declared later, causing compile errors. The
block scope ends | 1924 # of objects (like Strings) declared later, causing compile errors. The
block scope ends |
| 1925 # right before the label 'fail:'. | 1925 # right before the label 'fail:'. |
| 1926 } | 1926 } |
| 1927 | 1927 |
| 1928 if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) { | 1928 if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) { |
| 1929 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(BindingState
::instance(), imp->" . $function->signature->name . "(ec)))\n"; | 1929 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(BindingState
::instance(), imp->" . $function->signature->name . "(ec)))\n"; |
| 1930 $code .= " return v8::Handle<v8::Value>(v8Null(args.GetIsolate())
);\n"; | 1930 $code .= " return v8::Handle<v8::Value>(v8Null(args.GetIsolate())
);\n"; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 $parameterDefaultPolicy = "DefaultIsNullString"; | 2046 $parameterDefaultPolicy = "DefaultIsNullString"; |
| 2047 } | 2047 } |
| 2048 | 2048 |
| 2049 my $parameterName = $parameter->name; | 2049 my $parameterName = $parameter->name; |
| 2050 if (GetIndexOf($parameterName, @paramTransferListNames) != -1) { | 2050 if (GetIndexOf($parameterName, @paramTransferListNames) != -1) { |
| 2051 $replacements{$parameterName} = "messagePortArray" . ucfirst($parame
terName); | 2051 $replacements{$parameterName} = "messagePortArray" . ucfirst($parame
terName); |
| 2052 $paramIndex++; | 2052 $paramIndex++; |
| 2053 next; | 2053 next; |
| 2054 } | 2054 } |
| 2055 | 2055 |
| 2056 AddToImplIncludes("ExceptionCode.h"); | 2056 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 2057 if ($parameter->extendedAttributes->{"Callback"}) { | 2057 if ($parameter->extendedAttributes->{"Callback"}) { |
| 2058 my $v8InterfaceName = "V8" . $parameter->type; | 2058 my $v8InterfaceName = "V8" . $parameter->type; |
| 2059 AddToImplIncludes("$v8InterfaceName.h"); | 2059 AddToImplIncludes("$v8InterfaceName.h"); |
| 2060 if ($parameter->isOptional) { | 2060 if ($parameter->isOptional) { |
| 2061 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $
parameterName;\n"; | 2061 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $
parameterName;\n"; |
| 2062 $parameterCheckString .= " if (args.Length() > $paramIndex &&
!args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n"; | 2062 $parameterCheckString .= " if (args.Length() > $paramIndex &&
!args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n"; |
| 2063 $parameterCheckString .= " if (!args[$paramIndex]->IsFunc
tion())\n"; | 2063 $parameterCheckString .= " if (!args[$paramIndex]->IsFunc
tion())\n"; |
| 2064 $parameterCheckString .= " return throwTypeError(0, a
rgs.GetIsolate());\n"; | 2064 $parameterCheckString .= " return throwTypeError(0, a
rgs.GetIsolate());\n"; |
| 2065 $parameterCheckString .= " $parameterName = ${v8Interface
Name}::create(args[$paramIndex], getScriptExecutionContext());\n"; | 2065 $parameterCheckString .= " $parameterName = ${v8Interface
Name}::create(args[$paramIndex], getScriptExecutionContext());\n"; |
| 2066 $parameterCheckString .= " }\n"; | 2066 $parameterCheckString .= " }\n"; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 $code .= <<END; | 2250 $code .= <<END; |
| 2251 static v8::Handle<v8::Value> constructor${overloadedIndexString}(const v8::Argum
ents& args) | 2251 static v8::Handle<v8::Value> constructor${overloadedIndexString}(const v8::Argum
ents& args) |
| 2252 { | 2252 { |
| 2253 END | 2253 END |
| 2254 | 2254 |
| 2255 if ($function->{overloadedIndex} == 0) { | 2255 if ($function->{overloadedIndex} == 0) { |
| 2256 $code .= GenerateArgumentsCountCheck($function, $interface); | 2256 $code .= GenerateArgumentsCountCheck($function, $interface); |
| 2257 } | 2257 } |
| 2258 | 2258 |
| 2259 if ($raisesExceptions) { | 2259 if ($raisesExceptions) { |
| 2260 AddToImplIncludes("ExceptionCode.h"); | 2260 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 2261 $code .= "\n"; | 2261 $code .= "\n"; |
| 2262 $code .= " ExceptionCode ec = 0;\n"; | 2262 $code .= " ExceptionCode ec = 0;\n"; |
| 2263 } | 2263 } |
| 2264 | 2264 |
| 2265 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] | 2265 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] |
| 2266 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interfaceName, ""); | 2266 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interfaceName, ""); |
| 2267 $code .= $parameterCheckString; | 2267 $code .= $parameterCheckString; |
| 2268 | 2268 |
| 2269 if ($interface->extendedAttributes->{"CallWith"} && $interface->extendedAttr
ibutes->{"CallWith"} eq "ScriptExecutionContext") { | 2269 if ($interface->extendedAttributes->{"CallWith"} && $interface->extendedAttr
ibutes->{"CallWith"} eq "ScriptExecutionContext") { |
| 2270 push(@beforeArgumentList, "context"); | 2270 push(@beforeArgumentList, "context"); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2505 | 2505 |
| 2506 // Make sure the document is added to the DOM Node map. Otherwise, the ${int
erfaceName} instance | 2506 // Make sure the document is added to the DOM Node map. Otherwise, the ${int
erfaceName} instance |
| 2507 // may end up being the only node in the map and get garbage-collected prema
turely. | 2507 // may end up being the only node in the map and get garbage-collected prema
turely. |
| 2508 toV8(document, args.Holder(), args.GetIsolate()); | 2508 toV8(document, args.Holder(), args.GetIsolate()); |
| 2509 | 2509 |
| 2510 END | 2510 END |
| 2511 | 2511 |
| 2512 $code .= GenerateArgumentsCountCheck($function, $interface); | 2512 $code .= GenerateArgumentsCountCheck($function, $interface); |
| 2513 | 2513 |
| 2514 if ($raisesExceptions) { | 2514 if ($raisesExceptions) { |
| 2515 AddToImplIncludes("ExceptionCode.h"); | 2515 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| 2516 $code .= "\n"; | 2516 $code .= "\n"; |
| 2517 $code .= " ExceptionCode ec = 0;\n"; | 2517 $code .= " ExceptionCode ec = 0;\n"; |
| 2518 } | 2518 } |
| 2519 | 2519 |
| 2520 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interfaceName); | 2520 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interfaceName); |
| 2521 $code .= $parameterCheckString; | 2521 $code .= $parameterCheckString; |
| 2522 | 2522 |
| 2523 push(@beforeArgumentList, "document"); | 2523 push(@beforeArgumentList, "document"); |
| 2524 | 2524 |
| 2525 if ($interface->extendedAttributes->{"RaisesException"}) { | 2525 if ($interface->extendedAttributes->{"RaisesException"}) { |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3058 my $v8InterfaceName = "V8$interfaceName"; | 3058 my $v8InterfaceName = "V8$interfaceName"; |
| 3059 my $nativeType = GetNativeTypeForConversions($interface); | 3059 my $nativeType = GetNativeTypeForConversions($interface); |
| 3060 my $vtableNameGnu = GetGnuVTableNameForInterface($interface); | 3060 my $vtableNameGnu = GetGnuVTableNameForInterface($interface); |
| 3061 my $vtableRefGnu = GetGnuVTableRefForInterface($interface); | 3061 my $vtableRefGnu = GetGnuVTableRefForInterface($interface); |
| 3062 my $vtableRefWin = GetWinVTableRefForInterface($interface); | 3062 my $vtableRefWin = GetWinVTableRefForInterface($interface); |
| 3063 | 3063 |
| 3064 # - Add default header template | 3064 # - Add default header template |
| 3065 push(@implContentHeader, GenerateImplementationContentHeader($interface)); | 3065 push(@implContentHeader, GenerateImplementationContentHeader($interface)); |
| 3066 | 3066 |
| 3067 AddToImplIncludes("BindingState.h"); | 3067 AddToImplIncludes("BindingState.h"); |
| 3068 AddToImplIncludes("ContextFeatures.h"); | 3068 AddToImplIncludes("core/dom/ContextFeatures.h"); |
| 3069 AddToImplIncludes("V8Binding.h"); | 3069 AddToImplIncludes("V8Binding.h"); |
| 3070 AddToImplIncludes("V8DOMWrapper.h"); | 3070 AddToImplIncludes("V8DOMWrapper.h"); |
| 3071 AddToImplIncludes("core/page/RuntimeEnabledFeatures.h"); | 3071 AddToImplIncludes("core/page/RuntimeEnabledFeatures.h"); |
| 3072 | 3072 |
| 3073 AddIncludesForType($interfaceName); | 3073 AddIncludesForType($interfaceName); |
| 3074 | 3074 |
| 3075 my $toActiveDOMObject = $codeGenerator->InheritsExtendedAttribute($interface
, "ActiveDOMObject") ? "${v8InterfaceName}::toActiveDOMObject" : "0"; | 3075 my $toActiveDOMObject = $codeGenerator->InheritsExtendedAttribute($interface
, "ActiveDOMObject") ? "${v8InterfaceName}::toActiveDOMObject" : "0"; |
| 3076 my $toEventTarget = $codeGenerator->InheritsExtendedAttribute($interface, "E
ventTarget") ? "${v8InterfaceName}::toEventTarget" : "0"; | 3076 my $toEventTarget = $codeGenerator->InheritsExtendedAttribute($interface, "E
ventTarget") ? "${v8InterfaceName}::toEventTarget" : "0"; |
| 3077 my $rootForGC = NeedsCustomOpaqueRootForGC($interface) ? "${v8InterfaceName}
::opaqueRootForGC" : "0"; | 3077 my $rootForGC = NeedsCustomOpaqueRootForGC($interface) ? "${v8InterfaceName}
::opaqueRootForGC" : "0"; |
| 3078 | 3078 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3883 sub GenerateCallbackImplementation | 3883 sub GenerateCallbackImplementation |
| 3884 { | 3884 { |
| 3885 my $object = shift; | 3885 my $object = shift; |
| 3886 my $interface = shift; | 3886 my $interface = shift; |
| 3887 my $interfaceName = $interface->name; | 3887 my $interfaceName = $interface->name; |
| 3888 my $v8InterfaceName = "V8$interfaceName"; | 3888 my $v8InterfaceName = "V8$interfaceName"; |
| 3889 | 3889 |
| 3890 # - Add default header template | 3890 # - Add default header template |
| 3891 push(@implContentHeader, GenerateImplementationContentHeader($interface)); | 3891 push(@implContentHeader, GenerateImplementationContentHeader($interface)); |
| 3892 | 3892 |
| 3893 AddToImplIncludes("ScriptExecutionContext.h"); | 3893 AddToImplIncludes("core/dom/ScriptExecutionContext.h"); |
| 3894 AddToImplIncludes("V8Binding.h"); | 3894 AddToImplIncludes("V8Binding.h"); |
| 3895 AddToImplIncludes("V8Callback.h"); | 3895 AddToImplIncludes("V8Callback.h"); |
| 3896 | 3896 |
| 3897 AddToImplContent("#include <wtf/Assertions.h>\n\n"); | 3897 AddToImplContent("#include <wtf/Assertions.h>\n\n"); |
| 3898 AddToImplContent("namespace WebCore {\n\n"); | 3898 AddToImplContent("namespace WebCore {\n\n"); |
| 3899 | 3899 |
| 3900 AddToImplContent(<<END); | 3900 AddToImplContent(<<END); |
| 3901 ${v8InterfaceName}::${v8InterfaceName}(v8::Handle<v8::Object> callback, ScriptEx
ecutionContext* context) | 3901 ${v8InterfaceName}::${v8InterfaceName}(v8::Handle<v8::Object> callback, ScriptEx
ecutionContext* context) |
| 3902 : ActiveDOMCallback(context) | 3902 : ActiveDOMCallback(context) |
| 3903 , m_callback(callback) | 3903 , m_callback(callback) |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4427 | 4427 |
| 4428 # Callbacks use raw pointers, so pass isParameter = 1 | 4428 # Callbacks use raw pointers, so pass isParameter = 1 |
| 4429 return GetNativeType($type, 1); | 4429 return GetNativeType($type, 1); |
| 4430 } | 4430 } |
| 4431 | 4431 |
| 4432 sub TypeCanFailConversion | 4432 sub TypeCanFailConversion |
| 4433 { | 4433 { |
| 4434 my $signature = shift; | 4434 my $signature = shift; |
| 4435 my $type = $signature->type; | 4435 my $type = $signature->type; |
| 4436 | 4436 |
| 4437 AddToImplIncludes("ExceptionCode.h") if $type eq "Attr"; | 4437 AddToImplIncludes("core/dom/ExceptionCode.h") if $type eq "Attr"; |
| 4438 return 1 if $type eq "Attr"; | 4438 return 1 if $type eq "Attr"; |
| 4439 return 0; | 4439 return 0; |
| 4440 } | 4440 } |
| 4441 | 4441 |
| 4442 sub JSValueToNative | 4442 sub JSValueToNative |
| 4443 { | 4443 { |
| 4444 my $signature = shift; | 4444 my $signature = shift; |
| 4445 my $value = shift; | 4445 my $value = shift; |
| 4446 my $getIsolate = shift; | 4446 my $getIsolate = shift; |
| 4447 | 4447 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4522 AddIncludesForType($type); | 4522 AddIncludesForType($type); |
| 4523 | 4523 |
| 4524 AddToImplIncludes("V8${type}.h"); | 4524 AddToImplIncludes("V8${type}.h"); |
| 4525 return "V8${type}::HasInstance($value, $getIsolate, worldType($getIsolate))
? V8${type}::toNative(v8::Handle<v8::Object>::Cast($value)) : 0"; | 4525 return "V8${type}::HasInstance($value, $getIsolate, worldType($getIsolate))
? V8${type}::toNative(v8::Handle<v8::Object>::Cast($value)) : 0"; |
| 4526 } | 4526 } |
| 4527 | 4527 |
| 4528 sub GetV8HeaderName | 4528 sub GetV8HeaderName |
| 4529 { | 4529 { |
| 4530 my $type = shift; | 4530 my $type = shift; |
| 4531 return "V8Event.h" if $type eq "DOMTimeStamp"; | 4531 return "V8Event.h" if $type eq "DOMTimeStamp"; |
| 4532 return "EventListener.h" if $type eq "EventListener"; | 4532 return "core/dom/EventListener.h" if $type eq "EventListener"; |
| 4533 return "SerializedScriptValue.h" if $type eq "SerializedScriptValue"; | 4533 return "SerializedScriptValue.h" if $type eq "SerializedScriptValue"; |
| 4534 return "ScriptValue.h" if $type eq "any"; | 4534 return "ScriptValue.h" if $type eq "any"; |
| 4535 return "V8${type}.h"; | 4535 return "V8${type}.h"; |
| 4536 } | 4536 } |
| 4537 | 4537 |
| 4538 sub CreateCustomSignature | 4538 sub CreateCustomSignature |
| 4539 { | 4539 { |
| 4540 my $function = shift; | 4540 my $function = shift; |
| 4541 my $count = @{$function->parameters}; | 4541 my $count = @{$function->parameters}; |
| 4542 my $name = $function->signature->name; | 4542 my $name = $function->signature->name; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4554 } else { | 4554 } else { |
| 4555 my $type = $parameter->type; | 4555 my $type = $parameter->type; |
| 4556 | 4556 |
| 4557 my $arrayType = $codeGenerator->GetArrayType($type); | 4557 my $arrayType = $codeGenerator->GetArrayType($type); |
| 4558 my $sequenceType = $codeGenerator->GetSequenceType($type); | 4558 my $sequenceType = $codeGenerator->GetSequenceType($type); |
| 4559 my $arrayOrSequenceType = $arrayType || $sequenceType; | 4559 my $arrayOrSequenceType = $arrayType || $sequenceType; |
| 4560 | 4560 |
| 4561 if ($arrayOrSequenceType) { | 4561 if ($arrayOrSequenceType) { |
| 4562 if ($arrayType eq "DOMString") { | 4562 if ($arrayType eq "DOMString") { |
| 4563 AddToImplIncludes("V8DOMStringList.h"); | 4563 AddToImplIncludes("V8DOMStringList.h"); |
| 4564 AddToImplIncludes("DOMStringList.h"); | 4564 AddToImplIncludes("core/dom/DOMStringList.h"); |
| 4565 | 4565 |
| 4566 } elsif ($codeGenerator->IsRefPtrType($arrayOrSequenceType))
{ | 4566 } elsif ($codeGenerator->IsRefPtrType($arrayOrSequenceType))
{ |
| 4567 AddToImplIncludes(GetV8HeaderName($arrayOrSequenceType))
; | 4567 AddToImplIncludes(GetV8HeaderName($arrayOrSequenceType))
; |
| 4568 AddToImplIncludes("${arrayOrSequenceType}.h"); | 4568 AddToImplIncludes("${arrayOrSequenceType}.h"); |
| 4569 } else { | 4569 } else { |
| 4570 $code .= "v8::Handle<v8::FunctionTemplate>()"; | 4570 $code .= "v8::Handle<v8::FunctionTemplate>()"; |
| 4571 next; | 4571 next; |
| 4572 } | 4572 } |
| 4573 } else { | 4573 } else { |
| 4574 AddToImplIncludes(GetV8HeaderName($type)); | 4574 AddToImplIncludes(GetV8HeaderName($type)); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4756 return "v8String($value, $getIsolate$returnHandleTypeArg)"; | 4756 return "v8String($value, $getIsolate$returnHandleTypeArg)"; |
| 4757 } | 4757 } |
| 4758 | 4758 |
| 4759 my $arrayType = $codeGenerator->GetArrayType($type); | 4759 my $arrayType = $codeGenerator->GetArrayType($type); |
| 4760 my $sequenceType = $codeGenerator->GetSequenceType($type); | 4760 my $sequenceType = $codeGenerator->GetSequenceType($type); |
| 4761 my $arrayOrSequenceType = $arrayType || $sequenceType; | 4761 my $arrayOrSequenceType = $arrayType || $sequenceType; |
| 4762 | 4762 |
| 4763 if ($arrayOrSequenceType) { | 4763 if ($arrayOrSequenceType) { |
| 4764 if ($arrayType eq "DOMString") { | 4764 if ($arrayType eq "DOMString") { |
| 4765 AddToImplIncludes("V8DOMStringList.h"); | 4765 AddToImplIncludes("V8DOMStringList.h"); |
| 4766 AddToImplIncludes("DOMStringList.h"); | 4766 AddToImplIncludes("core/dom/DOMStringList.h"); |
| 4767 | 4767 |
| 4768 } elsif ($codeGenerator->IsRefPtrType($arrayOrSequenceType)) { | 4768 } elsif ($codeGenerator->IsRefPtrType($arrayOrSequenceType)) { |
| 4769 AddToImplIncludes(GetV8HeaderName($arrayOrSequenceType)); | 4769 AddToImplIncludes(GetV8HeaderName($arrayOrSequenceType)); |
| 4770 AddToImplIncludes("${arrayOrSequenceType}.h"); | 4770 AddToImplIncludes("${arrayOrSequenceType}.h"); |
| 4771 } | 4771 } |
| 4772 return "v8Array($value, $getIsolate)"; | 4772 return "v8Array($value, $getIsolate)"; |
| 4773 } | 4773 } |
| 4774 | 4774 |
| 4775 AddIncludesForType($type); | 4775 AddIncludesForType($type); |
| 4776 | 4776 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4907 | 4907 |
| 4908 sub GetPassRefPtrType | 4908 sub GetPassRefPtrType |
| 4909 { | 4909 { |
| 4910 my $v8InterfaceName = shift; | 4910 my $v8InterfaceName = shift; |
| 4911 | 4911 |
| 4912 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; | 4912 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; |
| 4913 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; | 4913 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; |
| 4914 } | 4914 } |
| 4915 | 4915 |
| 4916 1; | 4916 1; |
| OLD | NEW |