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

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

Issue 14179013: Add support for [NoInterfaceObject] extended attribute to bindings generator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
Index: Source/bindings/scripts/CodeGenerator.pm
diff --git a/Source/bindings/scripts/CodeGenerator.pm b/Source/bindings/scripts/CodeGenerator.pm
index 094b08125197c7c94570ffda2154e34257a27c83..b453193fad4515ecd34e272e06f179367ebc63bd 100644
--- a/Source/bindings/scripts/CodeGenerator.pm
+++ b/Source/bindings/scripts/CodeGenerator.pm
@@ -91,6 +91,7 @@ my %svgTypeWithWritablePropertiesNeedingTearOff = (
# Cache of IDL file pathnames.
my $idlFiles;
my $cachedInterfaces = {};
+my $didCacheAllInterfaces = 0;
# Default constructor
sub new
@@ -242,10 +243,8 @@ sub FindSuperMethod
return $indexer;
}
-sub IDLFileForInterface
-{
+sub PopulateIDLFiles {
my $object = shift;
- my $interfaceName = shift;
unless ($idlFiles) {
my $sourceRoot = $ENV{SOURCE_ROOT};
@@ -260,6 +259,36 @@ sub IDLFileForInterface
};
find($wanted, @directories);
}
+}
+
+sub GetAllInterfaces
+{
+ my $object = shift;
+
+ unless ($didCacheAllInterfaces) {
haraken 2013/04/22 11:44:50 GetAllInterfaces() is called only once (i.e. from
+ $object->PopulateIDLFiles();
+
+ foreach my $filename (values $idlFiles) {
+ my $parser = IDLParser->new(1);
+ my $document = $parser->Parse($filename, $defines, $preprocessor);
+
+ foreach my $interface (@{$document->interfaces}) {
+ $cachedInterfaces->{$interface->name} = $interface;
+ }
+ }
+
+ $didCacheAllInterfaces = 1;
+ }
+
+ return (values $cachedInterfaces);
+}
+
+sub IDLFileForInterface
+{
+ my $object = shift;
+ my $interfaceName = shift;
+
+ $object->PopulateIDLFiles();
return $idlFiles->{$interfaceName};
}

Powered by Google App Engine
This is Rietveld 408576698