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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 my $verbose; | 122 my $verbose; |
123 my $dependentIdlFiles; | 123 my $dependentIdlFiles; |
124 my $writeFileOnlyIfChanged; | 124 my $writeFileOnlyIfChanged; |
125 my $sourceRoot; | 125 my $sourceRoot; |
126 | 126 |
127 # Cache of IDL file pathnames. | 127 # Cache of IDL file pathnames. |
128 my $idlFiles; | 128 my $idlFiles; |
129 my $cachedInterfaces = {}; | 129 my $cachedInterfaces = {}; |
130 | 130 |
131 my %implIncludes = (); | 131 my %implIncludes = (); |
132 my %headerIncludeFiles = (); | 132 my %headerIncludes = (); |
133 | 133 |
134 # Header code structure: | 134 # Header code structure: |
135 # Root ... Copyright, include duplication check | 135 # Root ... Copyright, include duplication check |
136 # Conditional ... #if FEATURE ... #endif (to be removed soon) | 136 # Conditional ... #if FEATURE ... #endif (to be removed soon) |
137 # Includes | 137 # Includes |
138 # NameSpaceWebCore | 138 # NameSpaceWebCore |
139 # Class | 139 # Class |
140 # ClassPublic | 140 # ClassPublic |
141 # ClassPrivate | 141 # ClassPrivate |
142 my %header; | 142 my %header; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 my $wanted = sub { | 258 my $wanted = sub { |
259 $idlFiles->{$1} = $File::Find::name if /^([A-Z].*)\.idl$/; | 259 $idlFiles->{$1} = $File::Find::name if /^([A-Z].*)\.idl$/; |
260 $File::Find::prune = 1 if /^\../; | 260 $File::Find::prune = 1 if /^\../; |
261 }; | 261 }; |
262 find($wanted, @directories); | 262 find($wanted, @directories); |
263 } | 263 } |
264 | 264 |
265 return $idlFiles->{$interfaceName}; | 265 return $idlFiles->{$interfaceName}; |
266 } | 266 } |
267 | 267 |
268 sub HeaderFileForInterface | |
269 { | |
270 my $interfaceName = shift; | |
271 my $implClassName = shift || $interfaceName; | |
272 | |
273 my $idlFilename = IDLFileForInterface($interfaceName) | |
274 or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n"); | |
275 | |
276 my $idlRelPath= "bindings/" . File::Spec->abs2rel($idlFilename, $sourceRoot)
; | |
277 return dirname($idlRelPath) . "/" . $implClassName . ".h"; | |
278 } | |
279 | |
280 sub ParseInterface | 268 sub ParseInterface |
281 { | 269 { |
282 my $interfaceName = shift; | 270 my $interfaceName = shift; |
283 | 271 |
284 return undef if $interfaceName eq 'Object'; | 272 return undef if $interfaceName eq 'Object'; |
285 | 273 |
286 if (exists $cachedInterfaces->{$interfaceName}) { | 274 if (exists $cachedInterfaces->{$interfaceName}) { |
287 return $cachedInterfaces->{$interfaceName}; | 275 return $cachedInterfaces->{$interfaceName}; |
288 } | 276 } |
289 | 277 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 foreach my $condition (split(/\|/, $oldValue)) { | 386 foreach my $condition (split(/\|/, $oldValue)) { |
399 $newValue{$condition} = 1; | 387 $newValue{$condition} = 1; |
400 } | 388 } |
401 $implIncludes{$header} = join("|", sort keys %newValue); | 389 $implIncludes{$header} = join("|", sort keys %newValue); |
402 } | 390 } |
403 } | 391 } |
404 } | 392 } |
405 | 393 |
406 sub AddToHeaderIncludes | 394 sub AddToHeaderIncludes |
407 { | 395 { |
408 my $header = shift; | 396 my @includes = @_; |
409 $headerIncludeFiles{$header} = 1; | 397 |
| 398 for my $include (@includes) { |
| 399 $headerIncludes{$include} = 1; |
| 400 } |
410 } | 401 } |
411 | 402 |
412 sub SkipIncludeHeader | 403 sub SkipIncludeHeader |
413 { | 404 { |
414 my $type = shift; | 405 my $type = shift; |
415 | 406 |
416 return 1 if IsPrimitiveType($type); | 407 return 1 if IsPrimitiveType($type); |
417 return 1 if IsEnumType($type); | 408 return 1 if IsEnumType($type); |
418 return 1 if $type eq "DOMString"; | 409 return 1 if $type eq "DOMString"; |
419 | 410 |
(...skipping 18 matching lines...) Expand all Loading... |
438 } else { | 429 } else { |
439 AddToImplIncludes("V8${type}.h"); | 430 AddToImplIncludes("V8${type}.h"); |
440 } | 431 } |
441 | 432 |
442 # Additional includes | 433 # Additional includes |
443 if ($type eq "CSSStyleSheet") { | 434 if ($type eq "CSSStyleSheet") { |
444 AddToImplIncludes("core/css/CSSImportRule.h"); | 435 AddToImplIncludes("core/css/CSSImportRule.h"); |
445 } | 436 } |
446 } | 437 } |
447 | 438 |
| 439 sub HeaderFilesForInterface |
| 440 { |
| 441 my $interfaceName = shift; |
| 442 my $implClassName = shift; |
| 443 |
| 444 my @includes = (); |
| 445 if (IsTypedArrayType($interfaceName)) { |
| 446 push(@includes, "wtf/${interfaceName}.h"); |
| 447 } elsif ($interfaceName =~ /SVGPathSeg/) { |
| 448 $interfaceName =~ s/Abs|Rel//; |
| 449 push(@includes, "core/svg/${interfaceName}.h"); |
| 450 } elsif (!SkipIncludeHeader($interfaceName)) { |
| 451 my $idlFilename = IDLFileForInterface($interfaceName) or die("Could NOT
find IDL file for interface \"$interfaceName\" $!\n"); |
| 452 my $idlRelPath= "bindings/" . File::Spec->abs2rel($idlFilename, $sourceR
oot); |
| 453 push(@includes, dirname($idlRelPath) . "/" . $implClassName . ".h"); |
| 454 } |
| 455 return @includes; |
| 456 } |
| 457 |
448 sub NeedsCustomOpaqueRootForGC | 458 sub NeedsCustomOpaqueRootForGC |
449 { | 459 { |
450 my $interface = shift; | 460 my $interface = shift; |
451 return GetGenerateIsReachable($interface) || GetCustomIsReachable($interface
); | 461 return GetGenerateIsReachable($interface) || GetCustomIsReachable($interface
); |
452 } | 462 } |
453 | 463 |
454 sub GetGenerateIsReachable | 464 sub GetGenerateIsReachable |
455 { | 465 { |
456 my $interface = shift; | 466 my $interface = shift; |
457 return $interface->extendedAttributes->{"GenerateIsReachable"} || "" | 467 return $interface->extendedAttributes->{"GenerateIsReachable"} || "" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 $svgNativeType = GetSVGTypeNeedingTearOff($implType); | 529 $svgNativeType = GetSVGTypeNeedingTearOff($implType); |
520 return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgN
ativeType; | 530 return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgN
ativeType; |
521 | 531 |
522 # Append space to avoid compilation errors when using PassRefPtr<$svgNative
Type> | 532 # Append space to avoid compilation errors when using PassRefPtr<$svgNative
Type> |
523 $svgNativeType = "$svgNativeType "; | 533 $svgNativeType = "$svgNativeType "; |
524 | 534 |
525 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($implType); | 535 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($implType); |
526 if ($svgNativeType =~ /SVGPropertyTearOff/) { | 536 if ($svgNativeType =~ /SVGPropertyTearOff/) { |
527 $svgPropertyType = $svgWrappedNativeType; | 537 $svgPropertyType = $svgWrappedNativeType; |
528 AddToImplIncludes("core/svg/properties/SVGAnimatedPropertyTearOff.h"); | 538 AddToImplIncludes("core/svg/properties/SVGAnimatedPropertyTearOff.h"); |
529 } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SV
GStaticListPropertyTearOff/) { | 539 } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SV
GStaticListPropertyTearOff/ or $svgNativeType =~ /SVGTransformListPropertyTearOf
f/) { |
530 $svgListPropertyType = $svgWrappedNativeType; | 540 $svgListPropertyType = $svgWrappedNativeType; |
531 AddToHeaderIncludes("core/svg/properties/SVGAnimatedListPropertyTearOff.
h"); | 541 AddToHeaderIncludes("core/svg/properties/SVGAnimatedListPropertyTearOff.
h"); |
532 AddToHeaderIncludes("core/svg/properties/SVGStaticListPropertyTearOff.h"
); | |
533 } elsif ($svgNativeType =~ /SVGTransformListPropertyTearOff/) { | |
534 $svgListPropertyType = $svgWrappedNativeType; | |
535 AddToHeaderIncludes("core/svg/properties/SVGAnimatedListPropertyTearOff.
h"); | |
536 AddToHeaderIncludes("core/svg/properties/SVGTransformListPropertyTearOff
.h"); | |
537 } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) { | 542 } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) { |
538 $svgListPropertyType = $svgWrappedNativeType; | 543 $svgListPropertyType = $svgWrappedNativeType; |
539 AddToHeaderIncludes("core/svg/properties/SVGPathSegListPropertyTearOff.h
"); | 544 AddToHeaderIncludes("core/svg/properties/SVGPathSegListPropertyTearOff.h
"); |
540 } | 545 } |
541 | 546 |
542 if ($svgPropertyType) { | 547 if ($svgPropertyType) { |
543 $svgPropertyType = "SVGPoint" if $svgPropertyType eq "FloatPoint"; | 548 $svgPropertyType = "SVGPoint" if $svgPropertyType eq "FloatPoint"; |
544 } | 549 } |
545 | 550 |
546 return ($svgPropertyType, $svgListPropertyType, $svgNativeType); | 551 return ($svgPropertyType, $svgListPropertyType, $svgNativeType); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 my $v8ClassName = GetV8ClassName($interface); | 606 my $v8ClassName = GetV8ClassName($interface); |
602 | 607 |
603 # Copy contents of parent interfaces except the first parent. | 608 # Copy contents of parent interfaces except the first parent. |
604 my @parents; | 609 my @parents; |
605 AddMethodsConstantsAndAttributesFromParentInterfaces($interface, \@parents,
1); | 610 AddMethodsConstantsAndAttributesFromParentInterfaces($interface, \@parents,
1); |
606 LinkOverloadedFunctions($interface); | 611 LinkOverloadedFunctions($interface); |
607 | 612 |
608 # Ensure the IsDOMNodeType function is in sync. | 613 # Ensure the IsDOMNodeType function is in sync. |
609 die("IsDOMNodeType is out of date with respect to $interfaceName") if IsDOMN
odeType($interfaceName) != InheritsInterface($interface, "Node"); | 614 die("IsDOMNodeType is out of date with respect to $interfaceName") if IsDOMN
odeType($interfaceName) != InheritsInterface($interface, "Node"); |
610 | 615 |
| 616 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); |
| 617 |
611 my $hasDependentLifetime = $interface->extendedAttributes->{"DependentLifeti
me"} || InheritsExtendedAttribute($interface, "ActiveDOMObject") || GetGenerateI
sReachable($interface) || $v8ClassName =~ /SVG/; | 618 my $hasDependentLifetime = $interface->extendedAttributes->{"DependentLifeti
me"} || InheritsExtendedAttribute($interface, "ActiveDOMObject") || GetGenerateI
sReachable($interface) || $v8ClassName =~ /SVG/; |
612 if (!$hasDependentLifetime) { | 619 if (!$hasDependentLifetime) { |
613 foreach (@{$interface->parents}) { | 620 foreach (@{$interface->parents}) { |
614 my $parent = $_; | 621 my $parent = $_; |
615 AddToHeaderIncludes("V8${parent}.h"); | 622 AddToHeaderIncludes("V8${parent}.h"); |
616 } | 623 } |
617 } | 624 } |
618 | 625 |
619 AddToHeaderIncludes("bindings/v8/WrapperTypeInfo.h"); | 626 AddToHeaderIncludes("bindings/v8/WrapperTypeInfo.h"); |
620 AddToHeaderIncludes("bindings/v8/V8Binding.h"); | 627 AddToHeaderIncludes("bindings/v8/V8Binding.h"); |
621 AddToHeaderIncludes("bindings/v8/V8DOMWrapper.h"); | 628 AddToHeaderIncludes("bindings/v8/V8DOMWrapper.h"); |
622 AddToHeaderIncludes("v8.h"); | 629 AddToHeaderIncludes(HeaderFilesForInterface($interfaceName, $implClassName))
; |
623 AddToHeaderIncludes("wtf/HashMap.h"); | 630 foreach my $headerInclude (sort keys(%headerIncludes)) { |
624 AddToHeaderIncludes("wtf/text/StringHash.h"); | 631 $header{includes}->add("#include \"${headerInclude}\"\n"); |
625 | |
626 my $headerClassInclude = GetHeaderClassInclude($interfaceName, $implClassNam
e); | |
627 AddToHeaderIncludes($headerClassInclude) if $headerClassInclude; | |
628 | |
629 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); | |
630 | |
631 foreach my $headerInclude (sort keys(%headerIncludeFiles)) { | |
632 $header{includes}->add("#include \"${headerInclude}\"\n") unless $header
Include =~ /v8\.h/; | |
633 } | 632 } |
634 $header{includes}->add("#include \<v8.h\>\n") if $headerIncludeFiles{"v8.h"}
; | |
635 | 633 |
636 $header{nameSpaceWebCore}->addHeader("\ntemplate<typename PropertyType> clas
s SVGPropertyTearOff;\n") if $svgPropertyType; | 634 $header{nameSpaceWebCore}->addHeader("\ntemplate<typename PropertyType> clas
s SVGPropertyTearOff;\n") if $svgPropertyType; |
637 if ($svgNativeType) { | 635 if ($svgNativeType) { |
638 if ($svgNativeType =~ /SVGStaticListPropertyTearOff/) { | 636 if ($svgNativeType =~ /SVGStaticListPropertyTearOff/) { |
639 $header{nameSpaceWebCore}->addHeader("\ntemplate<typename PropertyTy
pe> class SVGStaticListPropertyTearOff;\n"); | 637 $header{nameSpaceWebCore}->addHeader("\ntemplate<typename PropertyTy
pe> class SVGStaticListPropertyTearOff;\n"); |
640 } else { | 638 } else { |
641 $header{nameSpaceWebCore}->addHeader("\ntemplate<typename PropertyTy
pe> class SVGListPropertyTearOff;\n"); | 639 $header{nameSpaceWebCore}->addHeader("\ntemplate<typename PropertyTy
pe> class SVGListPropertyTearOff;\n"); |
642 } | 640 } |
643 } | 641 } |
644 | 642 |
(...skipping 18 matching lines...) Expand all Loading... |
663 my $code = ""; | 661 my $code = ""; |
664 $code .= " static const bool hasDependentLifetime = "; | 662 $code .= " static const bool hasDependentLifetime = "; |
665 if ($hasDependentLifetime) { | 663 if ($hasDependentLifetime) { |
666 $code .= "true;\n"; | 664 $code .= "true;\n"; |
667 } elsif (@{$interface->parents}) { | 665 } elsif (@{$interface->parents}) { |
668 # Even if this type doesn't have the [DependentLifetime] attribute its p
arents may. | 666 # Even if this type doesn't have the [DependentLifetime] attribute its p
arents may. |
669 # Let the compiler statically determine this for us. | 667 # Let the compiler statically determine this for us. |
670 my $separator = ""; | 668 my $separator = ""; |
671 foreach (@{$interface->parents}) { | 669 foreach (@{$interface->parents}) { |
672 my $parent = $_; | 670 my $parent = $_; |
673 AddToHeaderIncludes("V8${parent}.h"); | |
674 $code .= "${separator}V8${parent}::hasDependentLifetime"; | 671 $code .= "${separator}V8${parent}::hasDependentLifetime"; |
675 $separator = " || "; | 672 $separator = " || "; |
676 } | 673 } |
677 $code .= ";\n"; | 674 $code .= ";\n"; |
678 } else { | 675 } else { |
679 $code .= "false;\n"; | 676 $code .= "false;\n"; |
680 } | 677 } |
681 $header{classPublic}->add($code); | 678 $header{classPublic}->add($code); |
682 | 679 |
683 my $fromFunctionOpening = ""; | 680 my $fromFunctionOpening = ""; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 | 976 |
980 my @customInternalFields = (); | 977 my @customInternalFields = (); |
981 # Event listeners on DOM nodes are explicitly supported in the GC controller
. | 978 # Event listeners on DOM nodes are explicitly supported in the GC controller
. |
982 if (!InheritsInterface($interface, "Node") && | 979 if (!InheritsInterface($interface, "Node") && |
983 InheritsExtendedAttribute($interface, "EventTarget")) { | 980 InheritsExtendedAttribute($interface, "EventTarget")) { |
984 push(@customInternalFields, "eventListenerCacheIndex"); | 981 push(@customInternalFields, "eventListenerCacheIndex"); |
985 } | 982 } |
986 return @customInternalFields; | 983 return @customInternalFields; |
987 } | 984 } |
988 | 985 |
989 sub GetHeaderClassInclude | |
990 { | |
991 my $interfaceName = shift; | |
992 my $implClassName = shift; | |
993 | |
994 if ($interfaceName =~ /SVGPathSeg/) { | |
995 $interfaceName =~ s/Abs|Rel//; | |
996 return "core/svg/${interfaceName}.h"; | |
997 } | |
998 return "wtf/${interfaceName}.h" if IsTypedArrayType($interfaceName); | |
999 return "" if (SkipIncludeHeader($interfaceName)); | |
1000 return HeaderFileForInterface($interfaceName, $implClassName); | |
1001 } | |
1002 | |
1003 sub GenerateHeaderCustomInternalFieldIndices | 986 sub GenerateHeaderCustomInternalFieldIndices |
1004 { | 987 { |
1005 my $interface = shift; | 988 my $interface = shift; |
1006 my @customInternalFields = GetInternalFields($interface); | 989 my @customInternalFields = GetInternalFields($interface); |
1007 my $customFieldCounter = 0; | 990 my $customFieldCounter = 0; |
1008 foreach my $customInternalField (@customInternalFields) { | 991 foreach my $customInternalField (@customInternalFields) { |
1009 $header{classPublic}->add(<<END); | 992 $header{classPublic}->add(<<END); |
1010 static const int ${customInternalField} = v8DefaultWrapperInternalFieldCount
+ ${customFieldCounter}; | 993 static const int ${customInternalField} = v8DefaultWrapperInternalFieldCount
+ ${customFieldCounter}; |
1011 END | 994 END |
1012 $customFieldCounter++; | 995 $customFieldCounter++; |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1441 |
1459 my $returnType = $attribute->signature->type; | 1442 my $returnType = $attribute->signature->type; |
1460 my $getterString; | 1443 my $getterString; |
1461 | 1444 |
1462 if ($getterStringUsesImp) { | 1445 if ($getterStringUsesImp) { |
1463 my ($functionName, @arguments) = GetterExpression(\%implIncludes, $inter
faceName, $attribute); | 1446 my ($functionName, @arguments) = GetterExpression(\%implIncludes, $inter
faceName, $attribute); |
1464 push(@arguments, "isNull") if $isNullable; | 1447 push(@arguments, "isNull") if $isNullable; |
1465 push(@arguments, "ec") if $useExceptions; | 1448 push(@arguments, "ec") if $useExceptions; |
1466 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { | 1449 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { |
1467 my $implementedBy = $attribute->signature->extendedAttributes->{"Imp
lementedBy"}; | 1450 my $implementedBy = $attribute->signature->extendedAttributes->{"Imp
lementedBy"}; |
1468 AddToImplIncludes(HeaderFileForInterface($implementedBy)); | 1451 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edBy)); |
1469 unshift(@arguments, "imp") if !$attribute->isStatic; | 1452 unshift(@arguments, "imp") if !$attribute->isStatic; |
1470 $functionName = "${implementedBy}::${functionName}"; | 1453 $functionName = "${implementedBy}::${functionName}"; |
1471 } elsif ($attribute->isStatic) { | 1454 } elsif ($attribute->isStatic) { |
1472 $functionName = "${implClassName}::${functionName}"; | 1455 $functionName = "${implClassName}::${functionName}"; |
1473 } else { | 1456 } else { |
1474 $functionName = "imp->${functionName}"; | 1457 $functionName = "imp->${functionName}"; |
1475 } | 1458 } |
1476 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extendedAt
tributes->{"CallWith"}, " ", 0); | 1459 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extendedAt
tributes->{"CallWith"}, " ", 0); |
1477 $code .= $subCode; | 1460 $code .= $subCode; |
1478 unshift(@arguments, @$arg); | 1461 unshift(@arguments, @$arg); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate)"; | 1880 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate)"; |
1898 } | 1881 } |
1899 $code .= ", ec" if $useExceptions; | 1882 $code .= ", ec" if $useExceptions; |
1900 $code .= ");\n"; | 1883 $code .= ");\n"; |
1901 } else { | 1884 } else { |
1902 my ($functionName, @arguments) = SetterExpression(\%implIncludes, $i
nterfaceName, $attribute); | 1885 my ($functionName, @arguments) = SetterExpression(\%implIncludes, $i
nterfaceName, $attribute); |
1903 push(@arguments, $expression); | 1886 push(@arguments, $expression); |
1904 push(@arguments, "ec") if $useExceptions; | 1887 push(@arguments, "ec") if $useExceptions; |
1905 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { | 1888 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { |
1906 my $implementedBy = $attribute->signature->extendedAttributes->{
"ImplementedBy"}; | 1889 my $implementedBy = $attribute->signature->extendedAttributes->{
"ImplementedBy"}; |
1907 AddToImplIncludes(HeaderFileForInterface($implementedBy)); | 1890 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $imple
mentedBy)); |
1908 unshift(@arguments, "imp") if !$attribute->isStatic; | 1891 unshift(@arguments, "imp") if !$attribute->isStatic; |
1909 $functionName = "${implementedBy}::${functionName}"; | 1892 $functionName = "${implementedBy}::${functionName}"; |
1910 } elsif ($attribute->isStatic) { | 1893 } elsif ($attribute->isStatic) { |
1911 $functionName = "${implClassName}::${functionName}"; | 1894 $functionName = "${implClassName}::${functionName}"; |
1912 } else { | 1895 } else { |
1913 $functionName = "imp->${functionName}"; | 1896 $functionName = "imp->${functionName}"; |
1914 } | 1897 } |
1915 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extend
edAttributes->{"CallWith"}, " ", 1); | 1898 my ($arg, $subCode) = GenerateCallWith($attribute->signature->extend
edAttributes->{"CallWith"}, " ", 1); |
1916 $code .= $subCode; | 1899 $code .= $subCode; |
1917 unshift(@arguments, @$arg); | 1900 unshift(@arguments, @$arg); |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3572 if (@{$interface->constants}) { | 3555 if (@{$interface->constants}) { |
3573 $has_constants = 1; | 3556 $has_constants = 1; |
3574 $code .= "static const V8DOMConfiguration::BatchedConstant ${v8ClassName
}Consts[] = {\n"; | 3557 $code .= "static const V8DOMConfiguration::BatchedConstant ${v8ClassName
}Consts[] = {\n"; |
3575 } | 3558 } |
3576 foreach my $constant (@{$interface->constants}) { | 3559 foreach my $constant (@{$interface->constants}) { |
3577 my $name = $constant->name; | 3560 my $name = $constant->name; |
3578 my $value = $constant->value; | 3561 my $value = $constant->value; |
3579 my $attrExt = $constant->extendedAttributes; | 3562 my $attrExt = $constant->extendedAttributes; |
3580 my $implementedBy = $attrExt->{"ImplementedBy"}; | 3563 my $implementedBy = $attrExt->{"ImplementedBy"}; |
3581 if ($implementedBy) { | 3564 if ($implementedBy) { |
3582 AddToImplIncludes(HeaderFileForInterface($implementedBy)); | 3565 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edBy)); |
3583 } | 3566 } |
3584 if ($attrExt->{"EnabledAtRuntime"}) { | 3567 if ($attrExt->{"EnabledAtRuntime"}) { |
3585 push(@constantsEnabledAtRuntime, $constant); | 3568 push(@constantsEnabledAtRuntime, $constant); |
3586 } else { | 3569 } else { |
3587 my $conditionalString = GenerateConditionalString($constant); | 3570 my $conditionalString = GenerateConditionalString($constant); |
3588 $code .= "#if ${conditionalString}\n" if $conditionalString; | 3571 $code .= "#if ${conditionalString}\n" if $conditionalString; |
3589 # If the value we're dealing with is a hex number, preprocess it int
o a signed integer | 3572 # If the value we're dealing with is a hex number, preprocess it int
o a signed integer |
3590 # here, rather than running static_cast<signed int> in the generated
code. | 3573 # here, rather than running static_cast<signed int> in the generated
code. |
3591 if (substr($value, 0, 2) eq "0x") { | 3574 if (substr($value, 0, 2) eq "0x") { |
3592 $value = unpack('i', pack('I', hex($value))); | 3575 $value = unpack('i', pack('I', hex($value))); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3983 { | 3966 { |
3984 my $object = shift; | 3967 my $object = shift; |
3985 my $interface = shift; | 3968 my $interface = shift; |
3986 | 3969 |
3987 my $interfaceName = $interface->name; | 3970 my $interfaceName = $interface->name; |
3988 my $implClassName = GetImplClassName($interface); | 3971 my $implClassName = GetImplClassName($interface); |
3989 my $v8ClassName = GetV8ClassName($interface); | 3972 my $v8ClassName = GetV8ClassName($interface); |
3990 | 3973 |
3991 $header{root}->addFooter("\n"); | 3974 $header{root}->addFooter("\n"); |
3992 | 3975 |
3993 my @unsortedIncludes = (); | 3976 my @includes = (); |
3994 push(@unsortedIncludes, "#include \"bindings/v8/ActiveDOMCallback.h\""); | 3977 push(@includes, "bindings/v8/ActiveDOMCallback.h"); |
3995 push(@unsortedIncludes, "#include \"bindings/v8/DOMWrapperWorld.h\""); | 3978 push(@includes, "bindings/v8/DOMWrapperWorld.h"); |
3996 push(@unsortedIncludes, "#include \"bindings/v8/ScopedPersistent.h\""); | 3979 push(@includes, "bindings/v8/ScopedPersistent.h"); |
3997 my $interfaceHeader = HeaderFileForInterface($interfaceName, $implClassName)
; | 3980 push(@includes, HeaderFilesForInterface($interfaceName, $implClassName)); |
3998 push(@unsortedIncludes, "#include \"$interfaceHeader\""); | 3981 for my $include (sort @includes) { |
3999 push(@unsortedIncludes, "#include <v8.h>"); | 3982 $header{includes}->add("#include \"$include\"\n"); |
4000 push(@unsortedIncludes, "#include \"wtf/Forward.h\""); | 3983 } |
4001 $header{includes}->add(join("\n", sort @unsortedIncludes)); | 3984 $header{nameSpaceWebCore}->addHeader("\nclass ScriptExecutionContext;\n\n"); |
4002 unshift(@{$header{nameSpaceWebCore}->{header}}, "\n"); | |
4003 $header{nameSpaceWebCore}->addHeader("class ScriptExecutionContext;\n\n"); | |
4004 $header{class}->addHeader("class $v8ClassName : public $implClassName, publi
c ActiveDOMCallback {"); | 3985 $header{class}->addHeader("class $v8ClassName : public $implClassName, publi
c ActiveDOMCallback {"); |
4005 $header{class}->addFooter("};\n"); | 3986 $header{class}->addFooter("};\n"); |
4006 | 3987 |
4007 $header{classPublic}->add(<<END); | 3988 $header{classPublic}->add(<<END); |
4008 static PassRefPtr<${v8ClassName}> create(v8::Handle<v8::Value> value, Script
ExecutionContext* context) | 3989 static PassRefPtr<${v8ClassName}> create(v8::Handle<v8::Value> value, Script
ExecutionContext* context) |
4009 { | 3990 { |
4010 ASSERT(value->IsObject()); | 3991 ASSERT(value->IsObject()); |
4011 ASSERT(context); | 3992 ASSERT(context); |
4012 return adoptRef(new ${v8ClassName}(v8::Handle<v8::Object>::Cast(value),
context)); | 3993 return adoptRef(new ${v8ClassName}(v8::Handle<v8::Object>::Cast(value),
context)); |
4013 } | 3994 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4272 if ($function->signature->extendedAttributes->{"ImplementedAs"}) { | 4253 if ($function->signature->extendedAttributes->{"ImplementedAs"}) { |
4273 $name = $function->signature->extendedAttributes->{"ImplementedAs"}; | 4254 $name = $function->signature->extendedAttributes->{"ImplementedAs"}; |
4274 } | 4255 } |
4275 | 4256 |
4276 my $index = 0; | 4257 my $index = 0; |
4277 | 4258 |
4278 my @arguments; | 4259 my @arguments; |
4279 my $functionName; | 4260 my $functionName; |
4280 my $implementedBy = $function->signature->extendedAttributes->{"ImplementedB
y"}; | 4261 my $implementedBy = $function->signature->extendedAttributes->{"ImplementedB
y"}; |
4281 if ($implementedBy) { | 4262 if ($implementedBy) { |
4282 AddToImplIncludes(HeaderFileForInterface($implementedBy)); | 4263 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy
)); |
4283 unshift(@arguments, "imp") if !$function->isStatic; | 4264 unshift(@arguments, "imp") if !$function->isStatic; |
4284 $functionName = "${implementedBy}::${name}"; | 4265 $functionName = "${implementedBy}::${name}"; |
4285 } elsif ($function->isStatic) { | 4266 } elsif ($function->isStatic) { |
4286 $functionName = "${implClassName}::${name}"; | 4267 $functionName = "${implClassName}::${name}"; |
4287 } else { | 4268 } else { |
4288 $functionName = "imp->${name}"; | 4269 $functionName = "imp->${name}"; |
4289 } | 4270 } |
4290 | 4271 |
4291 my $callWith = $function->signature->extendedAttributes->{"CallWith"}; | 4272 my $callWith = $function->signature->extendedAttributes->{"CallWith"}; |
4292 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 0, $func
tion); | 4273 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 0, $func
tion); |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5459 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 5440 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
5460 $found = 1; | 5441 $found = 1; |
5461 } | 5442 } |
5462 return 1 if $found; | 5443 return 1 if $found; |
5463 }, 0); | 5444 }, 0); |
5464 | 5445 |
5465 return $found; | 5446 return $found; |
5466 } | 5447 } |
5467 | 5448 |
5468 1; | 5449 1; |
OLD | NEW |