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