Title: [206851] trunk
Revision
206851
Author
commit-qu...@webkit.org
Date
2016-10-05 23:45:34 -0700 (Wed, 05 Oct 2016)

Log Message

Reuse CodeGenerator::UpdateFile in Tools CodeGenerator
https://bugs.webkit.org/show_bug.cgi?id=162960

Patch by Youenn Fablet <you...@apple.com> on 2016-10-05
Reviewed by Alex Christensen.

Source/WebCore:

No change of behavior.

* bindings/scripts/CodeGenerator.pm:
(UpdateFile): Adding FIXME to enable lazy writing when feasible.

Tools:

* DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm:
(WriteData): Using CodeGenerator::UpdateFile to do lazy generated file update when it is made feasible.
* WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
(WriteData): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206850 => 206851)


--- trunk/Source/WebCore/ChangeLog	2016-10-06 06:39:14 UTC (rev 206850)
+++ trunk/Source/WebCore/ChangeLog	2016-10-06 06:45:34 UTC (rev 206851)
@@ -1,3 +1,15 @@
+2016-10-05  Youenn Fablet  <you...@apple.com>
+
+        Reuse CodeGenerator::UpdateFile in Tools CodeGenerator
+        https://bugs.webkit.org/show_bug.cgi?id=162960
+
+        Reviewed by Alex Christensen.
+
+        No change of behavior.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (UpdateFile): Adding FIXME to enable lazy writing when feasible.
+
 2016-10-05  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [SOUP] HostTLSCertificateSet should not use SHA-1 hashes to compare certificates

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (206850 => 206851)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2016-10-06 06:39:14 UTC (rev 206850)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2016-10-06 06:45:34 UTC (rev 206851)
@@ -219,6 +219,8 @@
     my $fileName = shift;
     my $contents = shift;
 
+    # FIXME: We should only write content if it is different from what is in the file.
+    # But that would mean running more often the binding generator, see https://bugs.webkit.org/show_bug.cgi?id=131756
     open FH, ">", $fileName or die "Couldn't open $fileName: $!\n";
     print FH $contents;
     close FH;

Modified: trunk/Tools/ChangeLog (206850 => 206851)


--- trunk/Tools/ChangeLog	2016-10-06 06:39:14 UTC (rev 206850)
+++ trunk/Tools/ChangeLog	2016-10-06 06:45:34 UTC (rev 206851)
@@ -1,3 +1,15 @@
+2016-10-05  Youenn Fablet  <you...@apple.com>
+
+        Reuse CodeGenerator::UpdateFile in Tools CodeGenerator
+        https://bugs.webkit.org/show_bug.cgi?id=162960
+
+        Reviewed by Alex Christensen.
+
+        * DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm:
+        (WriteData): Using CodeGenerator::UpdateFile to do lazy generated file update when it is made feasible.
+        * WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
+        (WriteData): Ditto.
+
 2016-10-05  Alex Christensen  <achristen...@webkit.org>
 
         URLParser should parse IPv4 addresses as the last two pieces of an IPv6 address

Modified: trunk/Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm (206850 => 206851)


--- trunk/Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm	2016-10-06 06:39:14 UTC (rev 206850)
+++ trunk/Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm	2016-10-06 06:45:34 UTC (rev 206851)
@@ -49,9 +49,7 @@
     my ($self, $interface, $outputDir) = @_;
 
     foreach my $file ($self->_generateHeaderFile($interface), $self->_generateImplementationFile($interface)) {
-        open(FILE, ">", File::Spec->catfile($outputDir, $$file{name})) or die "Failed to open $$file{name} for writing: $!";
-        print FILE @{$$file{contents}};
-        close(FILE) or die "Failed to close $$file{name} after writing: $!";
+        $$self{codeGenerator}->UpdateFile(File::Spec->catfile($outputDir, $$file{name}), join("", @{$$file{contents}}));
     }
 }
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm (206850 => 206851)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm	2016-10-06 06:39:14 UTC (rev 206850)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm	2016-10-06 06:45:34 UTC (rev 206851)
@@ -50,9 +50,7 @@
     my ($self, $interface, $outputDir) = @_;
 
     foreach my $file ($self->_generateHeaderFile($interface), $self->_generateImplementationFile($interface)) {
-        open(FILE, ">", File::Spec->catfile($outputDir, $$file{name})) or die "Failed to open $$file{name} for writing: $!";
-        print FILE @{$$file{contents}};
-        close(FILE) or die "Failed to close $$file{name} after writing: $!";
+        $$self{codeGenerator}->UpdateFile(File::Spec->catfile($outputDir, $$file{name}), join("", @{$$file{contents}}));
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to