+2012-01-24 Kentaro Hara <haraken@chromium.org>
+
+ [Refactoring] Makes finish() of CodeGeneratorV8.pm empty
+ https://bugs.webkit.org/show_bug.cgi?id=76841
+
+ Reviewed by Adam Barth.
+
+ This is one of steps to stop rebuilding .h/.cpp files
+ generated by unchanged IDLs (bug 76836).
+
+ As refactoring, we are planning to remove finish() from
+ all CodeGenerators. This patch makes finish() of
+ CodeGeneratorV8.pm empty.
+
+ No new tests. No change in behavior.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (finish): Made it empty. We will remove finish() after
+ making finish() of all CodeGenerators empty.
+ (GenerateInterface): Modified to call WriteData().
+ (WriteData): Simple code refactoring.
+ Removed if(defined $IMPL).
+ Removed if(defined $HEADER).
+ $IMPL -> IMPL.
+ $HEADER -> HEADER.
+
2012-01-24 Mario Sanchez Prada <msanchez@igalia.com>
Unreviewed build fix for GTK after r105698.
use constant FileNamePrefix => "V8";
-my ($codeGenerator, $IMPL, $HEADER);
+my ($codeGenerator);
my $module = "";
my $outputDir = "";
return $reference;
}
+# FIXME(haraken): finish() will be soon removed from all CodeGenerators.
sub finish
{
my $object = shift;
-
- # Commit changes!
- $object->WriteData();
}
# Params: 'domClass' struct
$object->GenerateImplementation($dataNode);
}
- my $name = $dataNode->name;
-
- # Open files for writing
- my $prefix = FileNamePrefix;
- my $headerFileName = "$outputHeadersDir/$prefix$name.h";
- my $implFileName = "$outputDir/$prefix$name.cpp";
-
- open($IMPL, ">$implFileName") || die "Couldn't open file $implFileName";
- open($HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName";
+ $object->WriteData($dataNode);
}
# Params: 'idlDocument' struct
# Internal helper
sub WriteData
{
- if (defined($IMPL)) {
- # Write content to file.
- print $IMPL @implContentHeader;
+ my $object = shift;
+ my $dataNode = shift;
- print $IMPL @implFixedHeader;
+ my $name = $dataNode->name;
+ my $prefix = FileNamePrefix;
+ my $headerFileName = "$outputHeadersDir/$prefix$name.h";
+ my $implFileName = "$outputDir/$prefix$name.cpp";
- my @includes = ();
- my %implIncludeConditions = ();
- foreach my $include (keys %implIncludes) {
- my $condition = $implIncludes{$include};
- my $checkType = $include;
- $checkType =~ s/\.h//;
- next if $codeGenerator->IsSVGAnimatedType($checkType);
+ open(IMPL, ">$implFileName") || die "Couldn't open file $implFileName";
- if ($include =~ /wtf/) {
- $include = "\<$include\>";
- } else {
- $include = "\"$include\"";
- }
+ # Write content to file.
+ print IMPL @implContentHeader;
+ print IMPL @implFixedHeader;
- if ($condition eq 1) {
- push @includes, $include;
- } else {
- push @{$implIncludeConditions{$condition}}, $include;
- }
+ my @includes = ();
+ my %implIncludeConditions = ();
+ foreach my $include (keys %implIncludes) {
+ my $condition = $implIncludes{$include};
+ my $checkType = $include;
+ $checkType =~ s/\.h//;
+ next if $codeGenerator->IsSVGAnimatedType($checkType);
+
+ if ($include =~ /wtf/) {
+ $include = "\<$include\>";
+ } else {
+ $include = "\"$include\"";
}
- foreach my $include (sort @includes) {
- print $IMPL "#include $include\n";
+
+ if ($condition eq 1) {
+ push @includes, $include;
+ } else {
+ push @{$implIncludeConditions{$condition}}, $include;
}
- foreach my $condition (sort keys %implIncludeConditions) {
- print $IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
- foreach my $include (sort @{$implIncludeConditions{$condition}}) {
- print $IMPL "#include $include\n";
- }
- print $IMPL "#endif\n";
+ }
+ foreach my $include (sort @includes) {
+ print IMPL "#include $include\n";
+ }
+ foreach my $condition (sort keys %implIncludeConditions) {
+ print IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
+ foreach my $include (sort @{$implIncludeConditions{$condition}}) {
+ print IMPL "#include $include\n";
}
+ print IMPL "#endif\n";
+ }
- print $IMPL "\n";
- print $IMPL @implContentDecls;
- print $IMPL @implContent;
- close($IMPL);
- undef($IMPL);
+ print IMPL "\n";
+ print IMPL @implContentDecls;
+ print IMPL @implContent;
+ close(IMPL);
- %implIncludes = ();
- @implFixedHeader = ();
- @implContentDecls = ();
- @implContent = ();
- }
+ %implIncludes = ();
+ @implFixedHeader = ();
+ @implContentDecls = ();
+ @implContent = ();
- if (defined($HEADER)) {
- # Write content to file.
- print $HEADER @headerContent;
- close($HEADER);
- undef($HEADER);
+ # Write content to file.
+ open(HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName";
+ print HEADER @headerContent;
+ close(HEADER);
- @headerContent = ();
- }
+ @headerContent = ();
}
sub GetVisibleInterfaceName