Title: [90717] trunk/Source/WebCore
- Revision
- 90717
- Author
- [email protected]
- Date
- 2011-07-10 22:19:51 -0700 (Sun, 10 Jul 2011)
Log Message
Generate conditional include statements in CodeGeneratorJS
https://bugs.webkit.org/show_bug.cgi?id=64231
Reviewed by Brent Fulgham.
Suround headers with a correspondig #if ENABLE() line.
This allows us to generate bindings only of required IDL files.
Changing the current preprocessor statements to the Conditional attribute
in a next step helps in getting rid of calls to the preprocessor,
which causes so much pain on a natvie Windows environment.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(WriteData):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (90716 => 90717)
--- trunk/Source/WebCore/ChangeLog 2011-07-11 05:00:16 UTC (rev 90716)
+++ trunk/Source/WebCore/ChangeLog 2011-07-11 05:19:51 UTC (rev 90717)
@@ -1,5 +1,23 @@
2011-07-10 Patrick Gansterer <[email protected]>
+ Generate conditional include statements in CodeGeneratorJS
+ https://bugs.webkit.org/show_bug.cgi?id=64231
+
+ Reviewed by Brent Fulgham.
+
+ Suround headers with a correspondig #if ENABLE() line.
+ This allows us to generate bindings only of required IDL files.
+
+ Changing the current preprocessor statements to the Conditional attribute
+ in a next step helps in getting rid of calls to the preprocessor,
+ which causes so much pain on a natvie Windows environment.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ (WriteData):
+
+2011-07-10 Patrick Gansterer <[email protected]>
+
Remove array size from generated JSC binding tables
https://bugs.webkit.org/show_bug.cgi?id=64229
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (90716 => 90717)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-07-11 05:00:16 UTC (rev 90716)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-07-11 05:19:51 UTC (rev 90717)
@@ -7,6 +7,7 @@
# Copyright (C) 2009 Cameron McCormack <[email protected]>
# Copyright (C) Research In Motion Limited 2010. All rights reserved.
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+# Copyright (C) 2011 Patrick Gansterer <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -1751,7 +1752,23 @@
my $constructorType = $attribute->signature->type;
$constructorType =~ s/Constructor$//;
if ($constructorType ne "DOMObject") {
- $implIncludes{"JS" . $constructorType . ".h"} = 1;
+ my $header = "JS" . $constructorType . ".h";
+ my $conditional = $attribute->signature->extendedAttributes->{"Conditional"};
+ if (not $conditional) {
+ $implIncludes{$header} = 1;
+ } elsif (not exists($implIncludes{$header})) {
+ $implIncludes{$header} = $conditional;
+ } else {
+ my $oldValue = $implIncludes{$header};
+ if ($oldValue ne 1) {
+ my %newValue = ();
+ $newValue{$conditional} = 1;
+ foreach my $condition (split(/\|/, $oldValue)) {
+ $newValue{$condition} = 1;
+ }
+ $implIncludes{$header} = join("|", sort keys %newValue);
+ }
+ }
}
push(@implContent, " // Shadowing a built-in constructor\n");
if ($interfaceName eq "DOMWindow" && $className eq "JSblah") {
@@ -2926,17 +2943,31 @@
print $IMPL @implContentHeader;
my @includes = ();
+ my %implIncludeConditions = ();
foreach my $include (keys %implIncludes) {
+ my $condition = $implIncludes{$include};
my $checkType = $include;
$checkType =~ s/\.h//;
next if $codeGenerator->IsSVGAnimatedType($checkType);
$include = "\"$include\"" unless $include =~ /^["<]/; # "
- push @includes, $include;
+
+ if ($condition eq 1) {
+ push @includes, $include;
+ } else {
+ push @{$implIncludeConditions{$condition}}, $include;
+ }
}
foreach my $include (sort @includes) {
print $IMPL "#include $include\n";
}
+ foreach my $condition (sort keys %implIncludeConditions) {
+ print $IMPL "\n#if " . GenerateConditionalStringFromAttributeValue($condition) . "\n";
+ foreach my $include (sort @{$implIncludeConditions{$condition}}) {
+ print $IMPL "#include $include\n";
+ }
+ print $IMPL "#endif\n";
+ }
print $IMPL @implContent;
close($IMPL);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes