| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 my $filename = IDLFileForInterface($interfaceName) | 308 my $filename = IDLFileForInterface($interfaceName) |
| 309 or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n"); | 309 or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n"); |
| 310 | 310 |
| 311 print " | |> Parsing parent IDL \"$filename\" for interface \"$interfaceN
ame\"\n" if $verbose; | 311 print " | |> Parsing parent IDL \"$filename\" for interface \"$interfaceN
ame\"\n" if $verbose; |
| 312 | 312 |
| 313 # Step #2: Parse the found IDL file (in quiet mode). | 313 # Step #2: Parse the found IDL file (in quiet mode). |
| 314 my $parser = IDLParser->new(1); | 314 my $parser = IDLParser->new(1); |
| 315 my $document = $parser->Parse($filename, $defines, $preprocessor); | 315 my $document = $parser->Parse($filename, $defines, $preprocessor); |
| 316 | 316 |
| 317 foreach my $interface (@{$document->interfaces}) { | 317 foreach my $interface (@{$document->interfaces}) { |
| 318 if ($interface->name eq $interfaceName or $interface->isPartial) { | 318 if ($interface->name eq $interfaceName) { |
| 319 $cachedInterfaces->{$interfaceName} = $interface; | 319 $cachedInterfaces->{$interfaceName} = $interface; |
| 320 return $interface; | 320 return $interface; |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 | 323 |
| 324 die("Could NOT find interface definition for $interfaceName in $filename"); | 324 die("Could NOT find interface definition for $interfaceName in $filename"); |
| 325 } | 325 } |
| 326 | 326 |
| 327 sub GenerateInterface | 327 sub GenerateInterface |
| 328 { | 328 { |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } | 684 } |
| 685 | 685 |
| 686 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { | 686 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { |
| 687 $header{classPublic}->add(" static ActiveDOMObject* toActiveDOMObject
(v8::Handle<v8::Object>);\n"); | 687 $header{classPublic}->add(" static ActiveDOMObject* toActiveDOMObject
(v8::Handle<v8::Object>);\n"); |
| 688 } | 688 } |
| 689 | 689 |
| 690 if (InheritsExtendedAttribute($interface, "EventTarget")) { | 690 if (InheritsExtendedAttribute($interface, "EventTarget")) { |
| 691 $header{classPublic}->add(" static EventTarget* toEventTarget(v8::Han
dle<v8::Object>);\n"); | 691 $header{classPublic}->add(" static EventTarget* toEventTarget(v8::Han
dle<v8::Object>);\n"); |
| 692 } | 692 } |
| 693 | 693 |
| 694 if ($interfaceName eq "Window") { | 694 if ($interfaceName eq "DOMWindow") { |
| 695 $header{classPublic}->add(<<END); | 695 $header{classPublic}->add(<<END); |
| 696 static v8::Handle<v8::ObjectTemplate> GetShadowObjectTemplate(v8::Isolate*,
WrapperWorldType); | 696 static v8::Handle<v8::ObjectTemplate> GetShadowObjectTemplate(v8::Isolate*,
WrapperWorldType); |
| 697 END | 697 END |
| 698 } | 698 } |
| 699 | 699 |
| 700 my @enabledPerContextFunctions; | 700 my @enabledPerContextFunctions; |
| 701 foreach my $function (@{$interface->functions}) { | 701 foreach my $function (@{$interface->functions}) { |
| 702 my $name = $function->signature->name; | 702 my $name = $function->signature->name; |
| 703 next if $name eq ""; | 703 next if $name eq ""; |
| 704 my $attrExt = $function->signature->extendedAttributes; | 704 my $attrExt = $function->signature->extendedAttributes; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 } | 745 } |
| 746 if ($attrExt->{"EnabledPerContext"}) { | 746 if ($attrExt->{"EnabledPerContext"}) { |
| 747 push(@enabledPerContextAttributes, $attribute); | 747 push(@enabledPerContextAttributes, $attribute); |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 | 750 |
| 751 GenerateHeaderNamedAndIndexedPropertyAccessors($interface); | 751 GenerateHeaderNamedAndIndexedPropertyAccessors($interface); |
| 752 GenerateHeaderLegacyCall($interface); | 752 GenerateHeaderLegacyCall($interface); |
| 753 GenerateHeaderCustomInternalFieldIndices($interface); | 753 GenerateHeaderCustomInternalFieldIndices($interface); |
| 754 | 754 |
| 755 if ($interface->name eq "Window") { | 755 if ($interface->name eq "DOMWindow") { |
| 756 $header{classPublic}->add(<<END); | 756 $header{classPublic}->add(<<END); |
| 757 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v
8::Value> key, v8::AccessType, v8::Local<v8::Value> data); | 757 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v
8::Value> key, v8::AccessType, v8::Local<v8::Value> data); |
| 758 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t
index, v8::AccessType, v8::Local<v8::Value> data); | 758 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t
index, v8::AccessType, v8::Local<v8::Value> data); |
| 759 END | 759 END |
| 760 } | 760 } |
| 761 | 761 |
| 762 if (@enabledPerContextAttributes) { | 762 if (@enabledPerContextAttributes) { |
| 763 $header{classPublic}->add(<<END); | 763 $header{classPublic}->add(<<END); |
| 764 static void installPerContextProperties(v8::Handle<v8::Object>, ${nativeType
}*, v8::Isolate*); | 764 static void installPerContextProperties(v8::Handle<v8::Object>, ${nativeType
}*, v8::Isolate*); |
| 765 END | 765 END |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 my $interface = shift; | 1112 my $interface = shift; |
| 1113 return "V8" . $interface->name; | 1113 return "V8" . $interface->name; |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 sub GetImplName | 1116 sub GetImplName |
| 1117 { | 1117 { |
| 1118 my $interfaceOrSignature = shift; | 1118 my $interfaceOrSignature = shift; |
| 1119 return $interfaceOrSignature->extendedAttributes->{"ImplementedAs"} || $inte
rfaceOrSignature->name; | 1119 return $interfaceOrSignature->extendedAttributes->{"ImplementedAs"} || $inte
rfaceOrSignature->name; |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 sub GetImplNameFromImplementedBy | |
| 1123 { | |
| 1124 my $implementedBy = shift; | |
| 1125 | |
| 1126 my $interface = ParseInterface($implementedBy); | |
| 1127 return $interface->extendedAttributes->{"ImplementedAs"} || $implementedBy; | |
| 1128 } | |
| 1129 | |
| 1130 sub GenerateDomainSafeFunctionGetter | 1122 sub GenerateDomainSafeFunctionGetter |
| 1131 { | 1123 { |
| 1132 my $function = shift; | 1124 my $function = shift; |
| 1133 my $interface = shift; | 1125 my $interface = shift; |
| 1134 | 1126 |
| 1135 my $implClassName = GetImplName($interface); | 1127 my $implClassName = GetImplName($interface); |
| 1136 my $v8ClassName = GetV8ClassName($interface); | 1128 my $v8ClassName = GetV8ClassName($interface); |
| 1137 my $funcName = $function->signature->name; | 1129 my $funcName = $function->signature->name; |
| 1138 | 1130 |
| 1139 my $functionLength = GetFunctionLength($function); | 1131 my $functionLength = GetFunctionLength($function); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 $svgNativeType* wrapper = ${v8ClassName}::toNative(info.Holder()); | 1361 $svgNativeType* wrapper = ${v8ClassName}::toNative(info.Holder()); |
| 1370 $svgWrappedNativeType& impInstance = wrapper->propertyReference(); | 1362 $svgWrappedNativeType& impInstance = wrapper->propertyReference(); |
| 1371 END | 1363 END |
| 1372 if ($getterStringUsesImp) { | 1364 if ($getterStringUsesImp) { |
| 1373 $code .= <<END; | 1365 $code .= <<END; |
| 1374 $svgWrappedNativeType* imp = &impInstance; | 1366 $svgWrappedNativeType* imp = &impInstance; |
| 1375 END | 1367 END |
| 1376 } | 1368 } |
| 1377 } | 1369 } |
| 1378 } elsif ($attrExt->{"OnProto"} || $attrExt->{"Unforgeable"}) { | 1370 } elsif ($attrExt->{"OnProto"} || $attrExt->{"Unforgeable"}) { |
| 1379 if ($interfaceName eq "Window") { | 1371 if ($interfaceName eq "DOMWindow") { |
| 1380 $code .= <<END; | 1372 $code .= <<END; |
| 1381 v8::Handle<v8::Object> holder = info.Holder(); | 1373 v8::Handle<v8::Object> holder = info.Holder(); |
| 1382 END | 1374 END |
| 1383 } else { | 1375 } else { |
| 1384 # perform lookup first | 1376 # perform lookup first |
| 1385 $code .= <<END; | 1377 $code .= <<END; |
| 1386 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${
v8ClassName}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); | 1378 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${
v8ClassName}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); |
| 1387 if (holder.IsEmpty()) | 1379 if (holder.IsEmpty()) |
| 1388 return; | 1380 return; |
| 1389 END | 1381 END |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 | 1437 |
| 1446 my $returnType = $attribute->signature->type; | 1438 my $returnType = $attribute->signature->type; |
| 1447 my $getterString; | 1439 my $getterString; |
| 1448 | 1440 |
| 1449 if ($getterStringUsesImp) { | 1441 if ($getterStringUsesImp) { |
| 1450 my ($functionName, @arguments) = GetterExpression($interfaceName, $attri
bute); | 1442 my ($functionName, @arguments) = GetterExpression($interfaceName, $attri
bute); |
| 1451 push(@arguments, "isNull") if $isNullable; | 1443 push(@arguments, "isNull") if $isNullable; |
| 1452 push(@arguments, "ec") if $useExceptions; | 1444 push(@arguments, "ec") if $useExceptions; |
| 1453 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { | 1445 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { |
| 1454 my $implementedBy = $attribute->signature->extendedAttributes->{"Imp
lementedBy"}; | 1446 my $implementedBy = $attribute->signature->extendedAttributes->{"Imp
lementedBy"}; |
| 1455 my $implementedByImplName = GetImplNameFromImplementedBy($implemente
dBy); | 1447 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edBy)); |
| 1456 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edByImplName)); | |
| 1457 unshift(@arguments, "imp") if !$attribute->isStatic; | 1448 unshift(@arguments, "imp") if !$attribute->isStatic; |
| 1458 $functionName = "${implementedByImplName}::${functionName}"; | 1449 $functionName = "${implementedBy}::${functionName}"; |
| 1459 } elsif ($attribute->isStatic) { | 1450 } elsif ($attribute->isStatic) { |
| 1460 $functionName = "${implClassName}::${functionName}"; | 1451 $functionName = "${implClassName}::${functionName}"; |
| 1461 } else { | 1452 } else { |
| 1462 $functionName = "imp->${functionName}"; | 1453 $functionName = "imp->${functionName}"; |
| 1463 } | 1454 } |
| 1464 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extendedAt
tributes->{"CallWith"}, " ", 0); | 1455 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extendedAt
tributes->{"CallWith"}, " ", 0); |
| 1465 $code .= $subCode; | 1456 $code .= $subCode; |
| 1466 unshift(@arguments, @$arg); | 1457 unshift(@arguments, @$arg); |
| 1467 $getterString = "${functionName}(" . join(", ", @arguments) . ")"; | 1458 $getterString = "${functionName}(" . join(", ", @arguments) . ")"; |
| 1468 } else { | 1459 } else { |
| 1469 $getterString = "impInstance"; | 1460 $getterString = "impInstance"; |
| 1470 } | 1461 } |
| 1471 | 1462 |
| 1472 my $expression; | 1463 my $expression; |
| 1473 if ($attribute->signature->type eq "EventListener" && $interface->name eq "W
indow") { | 1464 if ($attribute->signature->type eq "EventListener" && $interface->name eq "D
OMWindow") { |
| 1474 $code .= " if (!imp->document())\n"; | 1465 $code .= " if (!imp->document())\n"; |
| 1475 $code .= " return;\n"; | 1466 $code .= " return;\n"; |
| 1476 } | 1467 } |
| 1477 | 1468 |
| 1478 if ($useExceptions || $isNullable) { | 1469 if ($useExceptions || $isNullable) { |
| 1479 if ($nativeType =~ /^V8StringResource/) { | 1470 if ($nativeType =~ /^V8StringResource/) { |
| 1480 $code .= " " . ConvertToV8StringResource($attribute->signature, $
nativeType, "v", $getterString) . ";\n"; | 1471 $code .= " " . ConvertToV8StringResource($attribute->signature, $
nativeType, "v", $getterString) . ";\n"; |
| 1481 } else { | 1472 } else { |
| 1482 $code .= " $nativeType v = $getterString;\n"; | 1473 $code .= " $nativeType v = $getterString;\n"; |
| 1483 } | 1474 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 return 0 if IsDOMNodeType($returnType); | 1630 return 0 if IsDOMNodeType($returnType); |
| 1640 | 1631 |
| 1641 # To avoid adding a reference to itself. | 1632 # To avoid adding a reference to itself. |
| 1642 # FIXME: Introduce [DoNotKeepAttributeAliveForGC] and remove this hack | 1633 # FIXME: Introduce [DoNotKeepAttributeAliveForGC] and remove this hack |
| 1643 # depending on the attribute name. | 1634 # depending on the attribute name. |
| 1644 return 0 if $attrName eq "self"; | 1635 return 0 if $attrName eq "self"; |
| 1645 | 1636 |
| 1646 # FIXME: Remove these hard-coded hacks. | 1637 # FIXME: Remove these hard-coded hacks. |
| 1647 return 0 if $returnType eq "EventTarget"; | 1638 return 0 if $returnType eq "EventTarget"; |
| 1648 return 0 if $returnType eq "SerializedScriptValue"; | 1639 return 0 if $returnType eq "SerializedScriptValue"; |
| 1649 return 0 if $returnType eq "Window"; | 1640 return 0 if $returnType eq "DOMWindow"; |
| 1650 return 0 if $returnType =~ /SVG/; | 1641 return 0 if $returnType =~ /SVG/; |
| 1651 return 0 if $returnType =~ /HTML/; | 1642 return 0 if $returnType =~ /HTML/; |
| 1652 | 1643 |
| 1653 return 1; | 1644 return 1; |
| 1654 } | 1645 } |
| 1655 | 1646 |
| 1656 sub GenerateReplaceableAttrSetterCallback | 1647 sub GenerateReplaceableAttrSetterCallback |
| 1657 { | 1648 { |
| 1658 my $interface = shift; | 1649 my $interface = shift; |
| 1659 my $implClassName = GetImplName($interface); | 1650 my $implClassName = GetImplName($interface); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 | 1820 |
| 1830 if (!$attribute->isStatic) { | 1821 if (!$attribute->isStatic) { |
| 1831 $code .= <<END; | 1822 $code .= <<END; |
| 1832 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 1823 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
| 1833 END | 1824 END |
| 1834 } | 1825 } |
| 1835 } | 1826 } |
| 1836 | 1827 |
| 1837 my $nativeType = GetNativeTypeFromSignature($attribute->signature, 0); | 1828 my $nativeType = GetNativeTypeFromSignature($attribute->signature, 0); |
| 1838 if ($attribute->signature->type eq "EventListener") { | 1829 if ($attribute->signature->type eq "EventListener") { |
| 1839 if ($interface->name eq "Window") { | 1830 if ($interface->name eq "DOMWindow") { |
| 1840 $code .= " if (!imp->document())\n"; | 1831 $code .= " if (!imp->document())\n"; |
| 1841 $code .= " return;\n"; | 1832 $code .= " return;\n"; |
| 1842 } | 1833 } |
| 1843 } else { | 1834 } else { |
| 1844 my $value = JSValueToNative($attribute->signature->type, $attribute->sig
nature->extendedAttributes, "value", "info.GetIsolate()"); | 1835 my $value = JSValueToNative($attribute->signature->type, $attribute->sig
nature->extendedAttributes, "value", "info.GetIsolate()"); |
| 1845 my $arrayType = GetArrayType($nativeType); | 1836 my $arrayType = GetArrayType($nativeType); |
| 1846 | 1837 |
| 1847 if ($nativeType =~ /^V8StringResource/) { | 1838 if ($nativeType =~ /^V8StringResource/) { |
| 1848 $code .= " " . ConvertToV8StringResource($attribute->signature, $
nativeType, "v", $value) . "\n"; | 1839 $code .= " " . ConvertToV8StringResource($attribute->signature, $
nativeType, "v", $value) . "\n"; |
| 1849 } elsif ($arrayType) { | 1840 } elsif ($arrayType) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 $code .= " *imp = $expression;\n"; | 1880 $code .= " *imp = $expression;\n"; |
| 1890 } else { | 1881 } else { |
| 1891 if ($attribute->signature->type eq "EventListener") { | 1882 if ($attribute->signature->type eq "EventListener") { |
| 1892 my $implSetterFunctionName = FirstLetterToUpperCase($attrName); | 1883 my $implSetterFunctionName = FirstLetterToUpperCase($attrName); |
| 1893 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); | 1884 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); |
| 1894 if (!InheritsInterface($interface, "Node")) { | 1885 if (!InheritsInterface($interface, "Node")) { |
| 1895 my $attrImplName = GetImplName($attribute->signature); | 1886 my $attrImplName = GetImplName($attribute->signature); |
| 1896 $code .= " transferHiddenDependency(info.Holder(), imp->${att
rImplName}(isolatedWorldForIsolate(info.GetIsolate())), value, ${v8ClassName}::e
ventListenerCacheIndex, info.GetIsolate());\n"; | 1887 $code .= " transferHiddenDependency(info.Holder(), imp->${att
rImplName}(isolatedWorldForIsolate(info.GetIsolate())), value, ${v8ClassName}::e
ventListenerCacheIndex, info.GetIsolate());\n"; |
| 1897 } | 1888 } |
| 1898 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 1889 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
| 1899 if (($interfaceName eq "Window" or $interfaceName eq "WorkerContext"
) and $attribute->signature->name eq "onerror") { | 1890 if (($interfaceName eq "DOMWindow" or $interfaceName eq "WorkerConte
xt") and $attribute->signature->name eq "onerror") { |
| 1900 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); | 1891 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); |
| 1901 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::findOrCreateWrapper<V8ErrorHandler>(value, true), isolatedWorldForIsolate(inf
o.GetIsolate()));\n"; | 1892 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::findOrCreateWrapper<V8ErrorHandler>(value, true), isolatedWorldForIsolate(inf
o.GetIsolate()));\n"; |
| 1902 } else { | 1893 } else { |
| 1903 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(
info.GetIsolate()));\n"; | 1894 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(
info.GetIsolate()));\n"; |
| 1904 } | 1895 } |
| 1905 } else { | 1896 } else { |
| 1906 my ($functionName, @arguments) = SetterExpression($interfaceName, $a
ttribute); | 1897 my ($functionName, @arguments) = SetterExpression($interfaceName, $a
ttribute); |
| 1907 push(@arguments, $expression); | 1898 push(@arguments, $expression); |
| 1908 push(@arguments, "ec") if $useExceptions; | 1899 push(@arguments, "ec") if $useExceptions; |
| 1909 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { | 1900 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { |
| 1910 my $implementedBy = $attribute->signature->extendedAttributes->{
"ImplementedBy"}; | 1901 my $implementedBy = $attribute->signature->extendedAttributes->{
"ImplementedBy"}; |
| 1911 my $implementedByImplName = GetImplNameFromImplementedBy($implem
entedBy); | 1902 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $imple
mentedBy)); |
| 1912 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $imple
mentedByImplName)); | |
| 1913 unshift(@arguments, "imp") if !$attribute->isStatic; | 1903 unshift(@arguments, "imp") if !$attribute->isStatic; |
| 1914 $functionName = "${implementedByImplName}::${functionName}"; | 1904 $functionName = "${implementedBy}::${functionName}"; |
| 1915 } elsif ($attribute->isStatic) { | 1905 } elsif ($attribute->isStatic) { |
| 1916 $functionName = "${implClassName}::${functionName}"; | 1906 $functionName = "${implClassName}::${functionName}"; |
| 1917 } else { | 1907 } else { |
| 1918 $functionName = "imp->${functionName}"; | 1908 $functionName = "imp->${functionName}"; |
| 1919 } | 1909 } |
| 1920 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extend
edAttributes->{"SetterCallWith"} || $attribute->signature->extendedAttributes->{
"CallWith"}, " ", 1); | 1910 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extend
edAttributes->{"SetterCallWith"} || $attribute->signature->extendedAttributes->{
"CallWith"}, " ", 1); |
| 1921 $code .= $subCode; | 1911 $code .= $subCode; |
| 1922 unshift(@arguments, @$arg); | 1912 unshift(@arguments, @$arg); |
| 1923 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n"; | 1913 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n"; |
| 1924 } | 1914 } |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3012 my $function = shift; | 3002 my $function = shift; |
| 3013 | 3003 |
| 3014 my $interfaceName = $interface->name; | 3004 my $interfaceName = $interface->name; |
| 3015 my $attrExt = $function->signature->extendedAttributes; | 3005 my $attrExt = $function->signature->extendedAttributes; |
| 3016 return 0 if $attrExt->{"Unforgeable"}; | 3006 return 0 if $attrExt->{"Unforgeable"}; |
| 3017 return 0 if $function->isStatic; | 3007 return 0 if $function->isStatic; |
| 3018 return 0 if $attrExt->{"EnabledAtRuntime"}; | 3008 return 0 if $attrExt->{"EnabledAtRuntime"}; |
| 3019 return 0 if $attrExt->{"EnabledPerContext"}; | 3009 return 0 if $attrExt->{"EnabledPerContext"}; |
| 3020 return 0 if RequiresCustomSignature($function); | 3010 return 0 if RequiresCustomSignature($function); |
| 3021 return 0 if $attrExt->{"DoNotCheckSignature"}; | 3011 return 0 if $attrExt->{"DoNotCheckSignature"}; |
| 3022 return 0 if ($attrExt->{"DoNotCheckSecurity"} && ($interface->extendedAttrib
utes->{"CheckSecurity"} || $interfaceName eq "Window")); | 3012 return 0 if ($attrExt->{"DoNotCheckSecurity"} && ($interface->extendedAttrib
utes->{"CheckSecurity"} || $interfaceName eq "DOMWindow")); |
| 3023 return 0 if $attrExt->{"NotEnumerable"}; | 3013 return 0 if $attrExt->{"NotEnumerable"}; |
| 3024 return 0 if $attrExt->{"ReadOnly"}; | 3014 return 0 if $attrExt->{"ReadOnly"}; |
| 3025 return 1; | 3015 return 1; |
| 3026 } | 3016 } |
| 3027 | 3017 |
| 3028 sub GenerateNonStandardFunction | 3018 sub GenerateNonStandardFunction |
| 3029 { | 3019 { |
| 3030 my $interface = shift; | 3020 my $interface = shift; |
| 3031 my $function = shift; | 3021 my $function = shift; |
| 3032 my $code = ""; | 3022 my $code = ""; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 my $indexedEnumeratorFunction = $indexedGetterFunction; | 3183 my $indexedEnumeratorFunction = $indexedGetterFunction; |
| 3194 $indexedEnumeratorFunction = 0 if $indexedGetterFunction && $indexedGetterFu
nction->signature->extendedAttributes->{"NotEnumerable"}; | 3184 $indexedEnumeratorFunction = 0 if $indexedGetterFunction && $indexedGetterFu
nction->signature->extendedAttributes->{"NotEnumerable"}; |
| 3195 | 3185 |
| 3196 # FIXME: Support generated named query bindings. | 3186 # FIXME: Support generated named query bindings. |
| 3197 my $indexedQueryFunction = 0; | 3187 my $indexedQueryFunction = 0; |
| 3198 # If there is an enumerator, there MUST be a query method to properly commun
icate property attributes. | 3188 # If there is an enumerator, there MUST be a query method to properly commun
icate property attributes. |
| 3199 my $hasQuery = $indexedQueryFunction || $indexedEnumeratorFunction; | 3189 my $hasQuery = $indexedQueryFunction || $indexedEnumeratorFunction; |
| 3200 | 3190 |
| 3201 my $setOn = "Instance"; | 3191 my $setOn = "Instance"; |
| 3202 | 3192 |
| 3203 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallba
cks) and it's used on Window | 3193 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallba
cks) and it's used on DOMWindow |
| 3204 # instead of deleters or enumerators. In addition, the getter should be set
on prototype template, to | 3194 # instead of deleters or enumerators. In addition, the getter should be set
on prototype template, to |
| 3205 # get implementation straight out of the Window prototype regardless of what
prototype is actually set | 3195 # get implementation straight out of the DOMWindow prototype regardless of w
hat prototype is actually set |
| 3206 # on the object. | 3196 # on the object. |
| 3207 if ($interfaceName eq "Window") { | 3197 if ($interfaceName eq "DOMWindow") { |
| 3208 $setOn = "Prototype"; | 3198 $setOn = "Prototype"; |
| 3209 } | 3199 } |
| 3210 | 3200 |
| 3211 my $code = ""; | 3201 my $code = ""; |
| 3212 if ($indexedGetterFunction || $indexedSetterFunction || $indexedDeleterFunct
ion || $indexedEnumeratorFunction || $hasQuery) { | 3202 if ($indexedGetterFunction || $indexedSetterFunction || $indexedDeleterFunct
ion || $indexedEnumeratorFunction || $hasQuery) { |
| 3213 $code .= " desc->${setOn}Template()->SetIndexedPropertyHandler(${v8Cl
assName}::indexedPropertyGetter"; | 3203 $code .= " desc->${setOn}Template()->SetIndexedPropertyHandler(${v8Cl
assName}::indexedPropertyGetter"; |
| 3214 $code .= $indexedSetterFunction ? ", ${v8ClassName}::indexedPropertySett
er" : ", 0"; | 3204 $code .= $indexedSetterFunction ? ", ${v8ClassName}::indexedPropertySett
er" : ", 0"; |
| 3215 $code .= ", 0"; # IndexedPropertyQuery -- not being used at the moment. | 3205 $code .= ", 0"; # IndexedPropertyQuery -- not being used at the moment. |
| 3216 $code .= $indexedDeleterFunction ? ", ${v8ClassName}::indexedPropertyDel
eter" : ", 0"; | 3206 $code .= $indexedDeleterFunction ? ", ${v8ClassName}::indexedPropertyDel
eter" : ", 0"; |
| 3217 $code .= ", nodeCollectionIndexedPropertyEnumerator<${implClassName}>" i
f $indexedEnumeratorFunction; | 3207 $code .= ", nodeCollectionIndexedPropertyEnumerator<${implClassName}>" i
f $indexedEnumeratorFunction; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3353 | 3343 |
| 3354 # FIXME: Support generated named query bindings. | 3344 # FIXME: Support generated named query bindings. |
| 3355 my $namedQueryFunction = 0; | 3345 my $namedQueryFunction = 0; |
| 3356 # If there is an enumerator, there MUST be a query method to properly commun
icate property attributes. | 3346 # If there is an enumerator, there MUST be a query method to properly commun
icate property attributes. |
| 3357 my $hasQuery = $namedQueryFunction || $namedEnumeratorFunction; | 3347 my $hasQuery = $namedQueryFunction || $namedEnumeratorFunction; |
| 3358 | 3348 |
| 3359 my $subCode = ""; | 3349 my $subCode = ""; |
| 3360 if ($namedGetterFunction || $namedSetterFunction || $namedDeleterFunction ||
$namedEnumeratorFunction || $hasQuery) { | 3350 if ($namedGetterFunction || $namedSetterFunction || $namedDeleterFunction ||
$namedEnumeratorFunction || $hasQuery) { |
| 3361 my $setOn = "Instance"; | 3351 my $setOn = "Instance"; |
| 3362 | 3352 |
| 3363 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa
llbacks) and it's used on Window | 3353 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa
llbacks) and it's used on DOMWindow |
| 3364 # instead of deleters or enumerators. In addition, the getter should be
set on prototype template, to | 3354 # instead of deleters or enumerators. In addition, the getter should be
set on prototype template, to |
| 3365 # get implementation straight out of the Window prototype regardless of
what prototype is actually set | 3355 # get implementation straight out of the DOMWindow prototype regardless
of what prototype is actually set |
| 3366 # on the object. | 3356 # on the object. |
| 3367 if ($interfaceName eq "Window") { | 3357 if ($interfaceName eq "DOMWindow") { |
| 3368 $setOn = "Prototype"; | 3358 $setOn = "Prototype"; |
| 3369 } | 3359 } |
| 3370 | 3360 |
| 3371 $subCode .= " desc->${setOn}Template()->SetNamedPropertyHandler("; | 3361 $subCode .= " desc->${setOn}Template()->SetNamedPropertyHandler("; |
| 3372 $subCode .= $namedGetterFunction ? "${v8ClassName}::namedPropertyGetter,
" : "0, "; | 3362 $subCode .= $namedGetterFunction ? "${v8ClassName}::namedPropertyGetter,
" : "0, "; |
| 3373 $subCode .= $namedSetterFunction ? "${v8ClassName}::namedPropertySetter,
" : "0, "; | 3363 $subCode .= $namedSetterFunction ? "${v8ClassName}::namedPropertySetter,
" : "0, "; |
| 3374 $subCode .= $hasQuery ? "${v8ClassName}::namedPropertyQuery, " : "0, "; | 3364 $subCode .= $hasQuery ? "${v8ClassName}::namedPropertyQuery, " : "0, "; |
| 3375 $subCode .= $hasDeleter ? "${v8ClassName}::namedPropertyDeleter, " : "0,
"; | 3365 $subCode .= $hasDeleter ? "${v8ClassName}::namedPropertyDeleter, " : "0,
"; |
| 3376 $subCode .= $namedEnumeratorFunction ? "${v8ClassName}::namedPropertyEnu
merator" : "0"; | 3366 $subCode .= $namedEnumeratorFunction ? "${v8ClassName}::namedPropertyEnu
merator" : "0"; |
| 3377 $subCode .= ");\n"; | 3367 $subCode .= ");\n"; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3754 my $attrExt = $attribute->signature->extendedAttributes; | 3744 my $attrExt = $attribute->signature->extendedAttributes; |
| 3755 | 3745 |
| 3756 # Generate special code for the constructor attributes. | 3746 # Generate special code for the constructor attributes. |
| 3757 if ($attrType =~ /Constructor$/) { | 3747 if ($attrType =~ /Constructor$/) { |
| 3758 if (!HasCustomGetter($attrExt)) { | 3748 if (!HasCustomGetter($attrExt)) { |
| 3759 $hasConstructors = 1; | 3749 $hasConstructors = 1; |
| 3760 } | 3750 } |
| 3761 next; | 3751 next; |
| 3762 } | 3752 } |
| 3763 | 3753 |
| 3764 if ($attrType eq "EventListener" && $interfaceName eq "Window") { | 3754 if ($attrType eq "EventListener" && $interfaceName eq "DOMWindow") { |
| 3765 $attrExt->{"OnProto"} = 1; | 3755 $attrExt->{"OnProto"} = 1; |
| 3766 } | 3756 } |
| 3767 | 3757 |
| 3768 if ($attrType eq "SerializedScriptValue") { | 3758 if ($attrType eq "SerializedScriptValue") { |
| 3769 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); | 3759 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); |
| 3770 } | 3760 } |
| 3771 | 3761 |
| 3772 GenerateNormalAttrGetter($attribute, $interface, ""); | 3762 GenerateNormalAttrGetter($attribute, $interface, ""); |
| 3773 GenerateNormalAttrGetterCallback($attribute, $interface, ""); | 3763 GenerateNormalAttrGetterCallback($attribute, $interface, ""); |
| 3774 if ($attrExt->{"PerWorldBindings"}) { | 3764 if ($attrExt->{"PerWorldBindings"}) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3793 | 3783 |
| 3794 if ($hasConstructors || $hasReplaceable) { | 3784 if ($hasConstructors || $hasReplaceable) { |
| 3795 GenerateReplaceableAttrSetter($interface); | 3785 GenerateReplaceableAttrSetter($interface); |
| 3796 GenerateReplaceableAttrSetterCallback($interface); | 3786 GenerateReplaceableAttrSetterCallback($interface); |
| 3797 } | 3787 } |
| 3798 | 3788 |
| 3799 if (NeedsOpaqueRootForGC($interface)) { | 3789 if (NeedsOpaqueRootForGC($interface)) { |
| 3800 GenerateOpaqueRootForGC($interface); | 3790 GenerateOpaqueRootForGC($interface); |
| 3801 } | 3791 } |
| 3802 | 3792 |
| 3803 if ($interface->extendedAttributes->{"CheckSecurity"} && $interface->name ne
"Window") { | 3793 if ($interface->extendedAttributes->{"CheckSecurity"} && $interface->name ne
"DOMWindow") { |
| 3804 GenerateSecurityCheckFunctions($interface); | 3794 GenerateSecurityCheckFunctions($interface); |
| 3805 } | 3795 } |
| 3806 | 3796 |
| 3807 if (IsConstructorTemplate($interface, "TypedArray")) { | 3797 if (IsConstructorTemplate($interface, "TypedArray")) { |
| 3808 my ($nativeType, $arrayType) = GetNativeTypeOfTypedArray($interface); | 3798 my ($nativeType, $arrayType) = GetNativeTypeOfTypedArray($interface); |
| 3809 $implementation{nameSpaceWebCore}->add(<<END); | 3799 $implementation{nameSpaceWebCore}->add(<<END); |
| 3810 v8::Handle<v8::Object> wrap($implClassName* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) | 3800 v8::Handle<v8::Object> wrap($implClassName* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) |
| 3811 { | 3801 { |
| 3812 ASSERT(impl); | 3802 ASSERT(impl); |
| 3813 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio
nContext, isolate); | 3803 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio
nContext, isolate); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3862 } | 3852 } |
| 3863 } | 3853 } |
| 3864 | 3854 |
| 3865 if ($needsDomainSafeFunctionSetter) { | 3855 if ($needsDomainSafeFunctionSetter) { |
| 3866 GenerateDomainSafeFunctionSetter($interface); | 3856 GenerateDomainSafeFunctionSetter($interface); |
| 3867 } | 3857 } |
| 3868 | 3858 |
| 3869 # Attributes | 3859 # Attributes |
| 3870 my $attributes = $interface->attributes; | 3860 my $attributes = $interface->attributes; |
| 3871 | 3861 |
| 3872 # For the Window interface we partition the attributes into the | 3862 # For the DOMWindow interface we partition the attributes into the |
| 3873 # ones that disallows shadowing and the rest. | 3863 # ones that disallows shadowing and the rest. |
| 3874 my @disallowsShadowing; | 3864 my @disallowsShadowing; |
| 3875 # Also separate out attributes that are enabled at runtime so we can process
them specially. | 3865 # Also separate out attributes that are enabled at runtime so we can process
them specially. |
| 3876 my @enabledAtRuntimeAttributes; | 3866 my @enabledAtRuntimeAttributes; |
| 3877 my @enabledPerContextAttributes; | 3867 my @enabledPerContextAttributes; |
| 3878 my @normalAttributes; | 3868 my @normalAttributes; |
| 3879 foreach my $attribute (@$attributes) { | 3869 foreach my $attribute (@$attributes) { |
| 3880 | 3870 |
| 3881 if ($interfaceName eq "Window" && $attribute->signature->extendedAttribu
tes->{"Unforgeable"}) { | 3871 if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttr
ibutes->{"Unforgeable"}) { |
| 3882 push(@disallowsShadowing, $attribute); | 3872 push(@disallowsShadowing, $attribute); |
| 3883 } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"}
|| $attribute->signature->extendedAttributes->{"EnabledPerContext"}) { | 3873 } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"}
|| $attribute->signature->extendedAttributes->{"EnabledPerContext"}) { |
| 3884 if ($attribute->signature->extendedAttributes->{"EnabledPerContext"}
) { | 3874 if ($attribute->signature->extendedAttributes->{"EnabledPerContext"}
) { |
| 3885 push(@enabledPerContextAttributes, $attribute); | 3875 push(@enabledPerContextAttributes, $attribute); |
| 3886 } | 3876 } |
| 3887 if ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"})
{ | 3877 if ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"})
{ |
| 3888 push(@enabledAtRuntimeAttributes, $attribute); | 3878 push(@enabledAtRuntimeAttributes, $attribute); |
| 3889 } | 3879 } |
| 3890 } else { | 3880 } else { |
| 3891 push(@normalAttributes, $attribute); | 3881 push(@normalAttributes, $attribute); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3950 if (@{$interface->constants}) { | 3940 if (@{$interface->constants}) { |
| 3951 $has_constants = 1; | 3941 $has_constants = 1; |
| 3952 $code .= "static const V8DOMConfiguration::BatchedConstant ${v8ClassName
}Consts[] = {\n"; | 3942 $code .= "static const V8DOMConfiguration::BatchedConstant ${v8ClassName
}Consts[] = {\n"; |
| 3953 } | 3943 } |
| 3954 foreach my $constant (@{$interface->constants}) { | 3944 foreach my $constant (@{$interface->constants}) { |
| 3955 my $name = $constant->name; | 3945 my $name = $constant->name; |
| 3956 my $value = $constant->value; | 3946 my $value = $constant->value; |
| 3957 my $attrExt = $constant->extendedAttributes; | 3947 my $attrExt = $constant->extendedAttributes; |
| 3958 my $implementedBy = $attrExt->{"ImplementedBy"}; | 3948 my $implementedBy = $attrExt->{"ImplementedBy"}; |
| 3959 if ($implementedBy) { | 3949 if ($implementedBy) { |
| 3960 my $implementedByImplName = GetImplNameFromImplementedBy($implemente
dBy); | 3950 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edBy)); |
| 3961 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edByImplName)); | |
| 3962 } | 3951 } |
| 3963 if ($attrExt->{"EnabledAtRuntime"}) { | 3952 if ($attrExt->{"EnabledAtRuntime"}) { |
| 3964 push(@constantsEnabledAtRuntime, $constant); | 3953 push(@constantsEnabledAtRuntime, $constant); |
| 3965 } else { | 3954 } else { |
| 3966 my $conditionalString = GenerateConditionalString($constant); | 3955 my $conditionalString = GenerateConditionalString($constant); |
| 3967 $code .= "#if ${conditionalString}\n" if $conditionalString; | 3956 $code .= "#if ${conditionalString}\n" if $conditionalString; |
| 3968 # If the value we're dealing with is a hex number, preprocess it int
o a signed integer | 3957 # If the value we're dealing with is a hex number, preprocess it int
o a signed integer |
| 3969 # here, rather than running static_cast<signed int> in the generated
code. | 3958 # here, rather than running static_cast<signed int> in the generated
code. |
| 3970 if (substr($value, 0, 2) eq "0x") { | 3959 if (substr($value, 0, 2) eq "0x") { |
| 3971 $value = unpack('i', pack('I', hex($value))); | 3960 $value = unpack('i', pack('I', hex($value))); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3991 GenerateEventConstructor($interface); | 3980 GenerateEventConstructor($interface); |
| 3992 } elsif (IsConstructorTemplate($interface, "TypedArray")) { | 3981 } elsif (IsConstructorTemplate($interface, "TypedArray")) { |
| 3993 GenerateTypedArrayConstructor($interface); | 3982 GenerateTypedArrayConstructor($interface); |
| 3994 } | 3983 } |
| 3995 } | 3984 } |
| 3996 if (IsConstructable($interface)) { | 3985 if (IsConstructable($interface)) { |
| 3997 GenerateConstructorCallback($interface); | 3986 GenerateConstructorCallback($interface); |
| 3998 } | 3987 } |
| 3999 | 3988 |
| 4000 my $access_check = ""; | 3989 my $access_check = ""; |
| 4001 if ($interface->extendedAttributes->{"CheckSecurity"} && $interfaceName ne "
Window") { | 3990 if ($interface->extendedAttributes->{"CheckSecurity"} && $interfaceName ne "
DOMWindow") { |
| 4002 $access_check = "instance->SetAccessCheckCallbacks(${implClassName}V8Int
ernal::namedSecurityCheck, ${implClassName}V8Internal::indexedSecurityCheck, v8:
:External::New(&${v8ClassName}::info));"; | 3991 $access_check = "instance->SetAccessCheckCallbacks(${implClassName}V8Int
ernal::namedSecurityCheck, ${implClassName}V8Internal::indexedSecurityCheck, v8:
:External::New(&${v8ClassName}::info));"; |
| 4003 } | 3992 } |
| 4004 | 3993 |
| 4005 # For the Window interface, generate the shadow object template | 3994 # For the DOMWindow interface, generate the shadow object template |
| 4006 # configuration method. | 3995 # configuration method. |
| 4007 if ($interfaceName eq "Window") { | 3996 if ($interfaceName eq "DOMWindow") { |
| 4008 $implementation{nameSpaceWebCore}->add(<<END); | 3997 $implementation{nameSpaceWebCore}->add(<<END); |
| 4009 static void ConfigureShadowObjectTemplate(v8::Handle<v8::ObjectTemplate> templ,
v8::Isolate* isolate, WrapperWorldType currentWorldType) | 3998 static void ConfigureShadowObjectTemplate(v8::Handle<v8::ObjectTemplate> templ,
v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 4010 { | 3999 { |
| 4011 V8DOMConfiguration::batchConfigureAttributes(templ, v8::Handle<v8::ObjectTem
plate>(), shadowAttrs, WTF_ARRAY_LENGTH(shadowAttrs), isolate, currentWorldType)
; | 4000 V8DOMConfiguration::batchConfigureAttributes(templ, v8::Handle<v8::ObjectTem
plate>(), shadowAttrs, WTF_ARRAY_LENGTH(shadowAttrs), isolate, currentWorldType)
; |
| 4012 | 4001 |
| 4013 // Install a security handler with V8. | 4002 // Install a security handler with V8. |
| 4014 templ->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom, V8Window:
:indexedSecurityCheckCustom, v8::External::New(&V8Window::info)); | 4003 templ->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheckCustom, V8DOMW
indow::indexedSecurityCheckCustom, v8::External::New(&V8DOMWindow::info)); |
| 4015 templ->SetInternalFieldCount(V8Window::internalFieldCount); | 4004 templ->SetInternalFieldCount(V8DOMWindow::internalFieldCount); |
| 4016 } | 4005 } |
| 4017 END | 4006 END |
| 4018 } | 4007 } |
| 4019 | 4008 |
| 4020 if (!$parentClassTemplate) { | 4009 if (!$parentClassTemplate) { |
| 4021 $parentClassTemplate = "v8::Local<v8::FunctionTemplate>()"; | 4010 $parentClassTemplate = "v8::Local<v8::FunctionTemplate>()"; |
| 4022 } | 4011 } |
| 4023 | 4012 |
| 4024 # Generate the template configuration method | 4013 # Generate the template configuration method |
| 4025 $code = <<END; | 4014 $code = <<END; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4137 | 4126 |
| 4138 die "Wrong number of callbacks generated for $interfaceName ($num_callbacks,
should be $total_functions)" if $num_callbacks != $total_functions; | 4127 die "Wrong number of callbacks generated for $interfaceName ($num_callbacks,
should be $total_functions)" if $num_callbacks != $total_functions; |
| 4139 | 4128 |
| 4140 if ($has_constants) { | 4129 if ($has_constants) { |
| 4141 $code .= <<END; | 4130 $code .= <<END; |
| 4142 V8DOMConfiguration::batchConfigureConstants(desc, proto, ${v8ClassName}Const
s, WTF_ARRAY_LENGTH(${v8ClassName}Consts), isolate); | 4131 V8DOMConfiguration::batchConfigureConstants(desc, proto, ${v8ClassName}Const
s, WTF_ARRAY_LENGTH(${v8ClassName}Consts), isolate); |
| 4143 END | 4132 END |
| 4144 } | 4133 } |
| 4145 | 4134 |
| 4146 # Special cases | 4135 # Special cases |
| 4147 if ($interfaceName eq "Window") { | 4136 if ($interfaceName eq "DOMWindow") { |
| 4148 $code .= <<END; | 4137 $code .= <<END; |
| 4149 | 4138 |
| 4150 proto->SetInternalFieldCount(V8Window::internalFieldCount); | 4139 proto->SetInternalFieldCount(V8DOMWindow::internalFieldCount); |
| 4151 desc->SetHiddenPrototype(true); | 4140 desc->SetHiddenPrototype(true); |
| 4152 instance->SetInternalFieldCount(V8Window::internalFieldCount); | 4141 instance->SetInternalFieldCount(V8DOMWindow::internalFieldCount); |
| 4153 // Set access check callbacks, but turned off initially. | 4142 // Set access check callbacks, but turned off initially. |
| 4154 // When a context is detached from a frame, turn on the access check. | 4143 // When a context is detached from a frame, turn on the access check. |
| 4155 // Turning on checks also invalidates inline caches of the object. | 4144 // Turning on checks also invalidates inline caches of the object. |
| 4156 instance->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom, V8Wind
ow::indexedSecurityCheckCustom, v8::External::New(&V8Window::info), false); | 4145 instance->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheckCustom, V8D
OMWindow::indexedSecurityCheckCustom, v8::External::New(&V8DOMWindow::info), fal
se); |
| 4157 END | 4146 END |
| 4158 } | 4147 } |
| 4159 if ($interfaceName eq "HTMLDocument" or $interfaceName eq "DedicatedWorkerCo
ntext" or $interfaceName eq "SharedWorkerContext") { | 4148 if ($interfaceName eq "HTMLDocument" or $interfaceName eq "DedicatedWorkerCo
ntext" or $interfaceName eq "SharedWorkerContext") { |
| 4160 $code .= <<END; | 4149 $code .= <<END; |
| 4161 desc->SetHiddenPrototype(true); | 4150 desc->SetHiddenPrototype(true); |
| 4162 END | 4151 END |
| 4163 } | 4152 } |
| 4164 | 4153 |
| 4165 $code .= <<END; | 4154 $code .= <<END; |
| 4166 | 4155 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4291 if (InheritsExtendedAttribute($interface, "EventTarget")) { | 4280 if (InheritsExtendedAttribute($interface, "EventTarget")) { |
| 4292 $implementation{nameSpaceWebCore}->add(<<END); | 4281 $implementation{nameSpaceWebCore}->add(<<END); |
| 4293 EventTarget* ${v8ClassName}::toEventTarget(v8::Handle<v8::Object> object) | 4282 EventTarget* ${v8ClassName}::toEventTarget(v8::Handle<v8::Object> object) |
| 4294 { | 4283 { |
| 4295 return toNative(object); | 4284 return toNative(object); |
| 4296 } | 4285 } |
| 4297 | 4286 |
| 4298 END | 4287 END |
| 4299 } | 4288 } |
| 4300 | 4289 |
| 4301 if ($interfaceName eq "Window") { | 4290 if ($interfaceName eq "DOMWindow") { |
| 4302 $implementation{nameSpaceWebCore}->add(<<END); | 4291 $implementation{nameSpaceWebCore}->add(<<END); |
| 4303 v8::Handle<v8::ObjectTemplate> V8Window::GetShadowObjectTemplate(v8::Isolate* is
olate, WrapperWorldType currentWorldType) | 4292 v8::Handle<v8::ObjectTemplate> V8DOMWindow::GetShadowObjectTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) |
| 4304 { | 4293 { |
| 4305 if (currentWorldType == MainWorld) { | 4294 if (currentWorldType == MainWorld) { |
| 4306 static v8::Persistent<v8::ObjectTemplate> V8WindowShadowObjectCacheForMa
inWorld; | 4295 static v8::Persistent<v8::ObjectTemplate> V8DOMWindowShadowObjectCacheFo
rMainWorld; |
| 4307 if (V8WindowShadowObjectCacheForMainWorld.IsEmpty()) { | 4296 if (V8DOMWindowShadowObjectCacheForMainWorld.IsEmpty()) { |
| 4308 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(); | 4297 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(); |
| 4309 ConfigureShadowObjectTemplate(templ, isolate, currentWorldType); | 4298 ConfigureShadowObjectTemplate(templ, isolate, currentWorldType); |
| 4310 V8WindowShadowObjectCacheForMainWorld.Reset(isolate, templ); | 4299 V8DOMWindowShadowObjectCacheForMainWorld.Reset(isolate, templ); |
| 4311 return templ; | 4300 return templ; |
| 4312 } | 4301 } |
| 4313 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForMainWorld); | 4302 return v8::Local<v8::ObjectTemplate>::New(isolate, V8DOMWindowShadowObje
ctCacheForMainWorld); |
| 4314 } else { | 4303 } else { |
| 4315 static v8::Persistent<v8::ObjectTemplate> V8WindowShadowObjectCacheForNo
nMainWorld; | 4304 static v8::Persistent<v8::ObjectTemplate> V8DOMWindowShadowObjectCacheFo
rNonMainWorld; |
| 4316 if (V8WindowShadowObjectCacheForNonMainWorld.IsEmpty()) { | 4305 if (V8DOMWindowShadowObjectCacheForNonMainWorld.IsEmpty()) { |
| 4317 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(); | 4306 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(); |
| 4318 ConfigureShadowObjectTemplate(templ, isolate, currentWorldType); | 4307 ConfigureShadowObjectTemplate(templ, isolate, currentWorldType); |
| 4319 V8WindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ); | 4308 V8DOMWindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ); |
| 4320 return templ; | 4309 return templ; |
| 4321 } | 4310 } |
| 4322 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForNonMainWorld); | 4311 return v8::Local<v8::ObjectTemplate>::New(isolate, V8DOMWindowShadowObje
ctCacheForNonMainWorld); |
| 4323 } | 4312 } |
| 4324 } | 4313 } |
| 4325 | 4314 |
| 4326 END | 4315 END |
| 4327 } | 4316 } |
| 4328 | 4317 |
| 4329 GenerateToV8Converters($interface, $v8ClassName, $nativeType); | 4318 GenerateToV8Converters($interface, $v8ClassName, $nativeType); |
| 4330 | 4319 |
| 4331 $implementation{nameSpaceWebCore}->add(<<END); | 4320 $implementation{nameSpaceWebCore}->add(<<END); |
| 4332 void ${v8ClassName}::derefObject(void* object) | 4321 void ${v8ClassName}::derefObject(void* object) |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4671 | 4660 |
| 4672 my $isSVGTearOffType = (IsSVGTypeNeedingTearOff($returnType) and not $interf
aceName =~ /List$/); | 4661 my $isSVGTearOffType = (IsSVGTypeNeedingTearOff($returnType) and not $interf
aceName =~ /List$/); |
| 4673 $nativeReturnType = GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTe
arOffType; | 4662 $nativeReturnType = GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTe
arOffType; |
| 4674 | 4663 |
| 4675 my $index = 0; | 4664 my $index = 0; |
| 4676 | 4665 |
| 4677 my @arguments; | 4666 my @arguments; |
| 4678 my $functionName; | 4667 my $functionName; |
| 4679 my $implementedBy = $function->signature->extendedAttributes->{"ImplementedB
y"}; | 4668 my $implementedBy = $function->signature->extendedAttributes->{"ImplementedB
y"}; |
| 4680 if ($implementedBy) { | 4669 if ($implementedBy) { |
| 4681 my $implementedByImplName = GetImplNameFromImplementedBy($implementedBy)
; | 4670 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy
)); |
| 4682 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy
ImplName)); | |
| 4683 unshift(@arguments, "imp") if !$function->isStatic; | 4671 unshift(@arguments, "imp") if !$function->isStatic; |
| 4684 $functionName = "${implementedByImplName}::${name}"; | 4672 $functionName = "${implementedBy}::${name}"; |
| 4685 } elsif ($function->isStatic) { | 4673 } elsif ($function->isStatic) { |
| 4686 $functionName = "${implClassName}::${name}"; | 4674 $functionName = "${implClassName}::${name}"; |
| 4687 } else { | 4675 } else { |
| 4688 $functionName = "imp->${name}"; | 4676 $functionName = "imp->${name}"; |
| 4689 } | 4677 } |
| 4690 | 4678 |
| 4691 my $callWith = $function->signature->extendedAttributes->{"CallWith"}; | 4679 my $callWith = $function->signature->extendedAttributes->{"CallWith"}; |
| 4692 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 1, $func
tion); | 4680 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 1, $func
tion); |
| 4693 $code .= $subCode; | 4681 $code .= $subCode; |
| 4694 unshift(@arguments, @$callWithArgs); | 4682 unshift(@arguments, @$callWithArgs); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4856 return "Dictionary" if $type eq "Dictionary"; | 4844 return "Dictionary" if $type eq "Dictionary"; |
| 4857 | 4845 |
| 4858 return "RefPtr<DOMStringList>" if $type eq "DOMStringList"; | 4846 return "RefPtr<DOMStringList>" if $type eq "DOMStringList"; |
| 4859 return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener"
; | 4847 return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener"
; |
| 4860 return "RefPtr<NodeFilter>" if $type eq "NodeFilter"; | 4848 return "RefPtr<NodeFilter>" if $type eq "NodeFilter"; |
| 4861 return "RefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue"; | 4849 return "RefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue"; |
| 4862 return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver"; | 4850 return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver"; |
| 4863 | 4851 |
| 4864 die "UnionType is not supported" if IsUnionType($type); | 4852 die "UnionType is not supported" if IsUnionType($type); |
| 4865 | 4853 |
| 4866 # We need to check [ImplementedAs] extended attribute for wrapper types. | 4854 # We need to check [ImplementedBy] extended attribute for wrapper types. |
| 4867 if (IsWrapperType($type)) { | 4855 if (IsWrapperType($type)) { |
| 4868 my $interface = ParseInterface($type); | 4856 my $interface = ParseInterface($type); |
| 4869 my $implClassName = GetImplName($interface); | 4857 my $implClassName = GetImplName($interface); |
| 4870 return $isParameter ? "${implClassName}*" : "RefPtr<${implClassName}>"; | 4858 return $isParameter ? "${implClassName}*" : "RefPtr<${implClassName}>"; |
| 4871 } | 4859 } |
| 4872 return "RefPtr<${type}>" if IsRefPtrType($type) and not $isParameter; | 4860 return "RefPtr<${type}>" if IsRefPtrType($type) and not $isParameter; |
| 4873 | 4861 |
| 4874 my $arrayOrSequenceType = GetArrayOrSequenceType($type); | 4862 my $arrayOrSequenceType = GetArrayOrSequenceType($type); |
| 4875 | 4863 |
| 4876 if ($arrayOrSequenceType) { | 4864 if ($arrayOrSequenceType) { |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5809 if (!$interface->extendedAttributes->{"DoNotCheckConstants"} && @{$interface
->constants}) { | 5797 if (!$interface->extendedAttributes->{"DoNotCheckConstants"} && @{$interface
->constants}) { |
| 5810 push(@checks, "\n"); | 5798 push(@checks, "\n"); |
| 5811 foreach my $constant (@{$interface->constants}) { | 5799 foreach my $constant (@{$interface->constants}) { |
| 5812 my $reflect = $constant->extendedAttributes->{"Reflect"}; | 5800 my $reflect = $constant->extendedAttributes->{"Reflect"}; |
| 5813 my $name = $reflect ? $reflect : $constant->name; | 5801 my $name = $reflect ? $reflect : $constant->name; |
| 5814 my $value = $constant->value; | 5802 my $value = $constant->value; |
| 5815 my $conditionalString = GenerateConditionalString($constant); | 5803 my $conditionalString = GenerateConditionalString($constant); |
| 5816 push(@checks, "#if ${conditionalString}\n") if $conditionalString; | 5804 push(@checks, "#if ${conditionalString}\n") if $conditionalString; |
| 5817 | 5805 |
| 5818 if ($constant->extendedAttributes->{"ImplementedBy"}) { | 5806 if ($constant->extendedAttributes->{"ImplementedBy"}) { |
| 5819 my $implementedByImplName = GetImplNameFromImplementedBy($consta
nt->extendedAttributes->{"ImplementedBy"}); | 5807 push(@checks, "COMPILE_ASSERT($value == " . $constant->extendedA
ttributes->{"ImplementedBy"} . "::$name, ${implClassName}Enum${name}IsWrongUseDo
NotCheckConstants);\n"); |
| 5820 push(@checks, "COMPILE_ASSERT($value == " . $implementedByImplNa
me . "::$name, ${implClassName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); | |
| 5821 } else { | 5808 } else { |
| 5822 push(@checks, "COMPILE_ASSERT($value == ${implClassName}::$name,
${implClassName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); | 5809 push(@checks, "COMPILE_ASSERT($value == ${implClassName}::$name,
${implClassName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); |
| 5823 } | 5810 } |
| 5824 | 5811 |
| 5825 push(@checks, "#endif\n") if $conditionalString; | 5812 push(@checks, "#endif\n") if $conditionalString; |
| 5826 } | 5813 } |
| 5827 push(@checks, "\n"); | 5814 push(@checks, "\n"); |
| 5828 } | 5815 } |
| 5829 return @checks; | 5816 return @checks; |
| 5830 } | 5817 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5878 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 5865 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 5879 $found = 1; | 5866 $found = 1; |
| 5880 } | 5867 } |
| 5881 return 1 if $found; | 5868 return 1 if $found; |
| 5882 }, 0); | 5869 }, 0); |
| 5883 | 5870 |
| 5884 return $found; | 5871 return $found; |
| 5885 } | 5872 } |
| 5886 | 5873 |
| 5887 1; | 5874 1; |
| OLD | NEW |