Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: Source/bindings/scripts/idltopath.pm

Issue 14456006: Fixes to make scripts generate includes with paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to a newer chromium version Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/generate-bindings.pl ('k') | Source/bindings/scripts/idltopathgenerator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/idltopath.pm
diff --git a/Source/bindings/scripts/idltopath.pm b/Source/bindings/scripts/idltopath.pm
new file mode 100644
index 0000000000000000000000000000000000000000..4203f448604df790e74b80eebf16f5cf75979ac4
--- /dev/null
+++ b/Source/bindings/scripts/idltopath.pm
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Exporter;
+
+package idltopath;
+
+our @ISA = qw( Exporter );
+# These are exported by default.
+our @EXPORT = qw( initIdlToPath idlToPath );
+
+my %idlToPathHash;
+my $idlToPathFile;
+
+sub initIdlToPath
+{
+ $idlToPathFile = shift;
+ if (!%idlToPathHash) {
+ open(FILE, $idlToPathFile) || die "Could not find generated data file " . $idlToPathFile;
+ while (<FILE>)
+ {
+ my ($key, $val) = split /,/;
+ # Strip CRLF from val (chomp is picky and will often remove only half).
+ $val =~ s/\s*$//;
+ $idlToPathHash{$key} .= $val;
+ }
+
+ die if !%idlToPathHash;
+ }
+}
+
+
+sub idlToPath
+{
+ my $interface = shift;
+
+ if (!%idlToPathHash) {
+ die "idltopath is not initialized. Call initIdlToPath(datafile).";
+ }
+
+ if ($idlToPathHash{$interface}) {
+ return $idlToPathHash{$interface} . '/';
+ } elsif ($interface =~ /^SVGPath/ && $idlToPathHash{$interface . "Abs"}) {
+ return $idlToPathHash{$interface . "Abs"} . '/';
+ } elsif ($interface =~ /^WebKit/ && $idlToPathHash{substr($interface, 6)}) {
+ # WebKitAnimationEvent is in AnimationEvent.idl.
+ # WebKitNamedFlow is in NamedFlow.idl.
+ return $idlToPathHash{substr($interface, 6)} . '/';
+ } else {
+ my $caller_package;
+ my $caller_filename;
+ my $caller_line;
+ ($caller_package, $caller_filename, $caller_line) = caller;
+ die "Unknown interface '$interface'. Not found in $idlToPathFile. Called from $caller_filename:$caller_line.";
+ }
+}
+
+# A module must return a truth value.
+1;
« no previous file with comments | « Source/bindings/scripts/generate-bindings.pl ('k') | Source/bindings/scripts/idltopathgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698