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

Side by Side Diff: Source/bindings/scripts/generate-bindings.pl

Issue 17035010: Revert "Rename DOMWindow interface to Window" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/CodeGeneratorV8.pm ('k') | Source/bindings/scripts/preprocess_idls.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 # 2 #
3 # Copyright (C) 2005 Apple Computer, Inc. 3 # Copyright (C) 2005 Apple Computer, Inc.
4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
5 # 5 #
6 # This file is part of WebKit 6 # This file is part of WebKit
7 # 7 #
8 # This library is free software; you can redistribute it and/or 8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Library General Public 9 # modify it under the terms of the GNU Library General Public
10 # License as published by the Free Software Foundation; either 10 # License as published by the Free Software Foundation; either
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 if ($verbose) { 77 if ($verbose) {
78 print "$targetIdlFile\n"; 78 print "$targetIdlFile\n";
79 } 79 }
80 my $targetInterfaceName = fileparse(basename($targetIdlFile), ".idl"); 80 my $targetInterfaceName = fileparse(basename($targetIdlFile), ".idl");
81 81
82 my $idlFound = 0; 82 my $idlFound = 0;
83 my @supplementedIdlFiles; 83 my @supplementedIdlFiles;
84 if ($supplementalDependencyFile) { 84 if ($supplementalDependencyFile) {
85 # The format of a supplemental dependency file: 85 # The format of a supplemental dependency file:
86 # 86 #
87 # Window.idl P.idl Q.idl R.idl 87 # DOMWindow.idl P.idl Q.idl R.idl
88 # Document.idl S.idl 88 # Document.idl S.idl
89 # Event.idl 89 # Event.idl
90 # ... 90 # ...
91 # 91 #
92 # The above indicates that Window.idl is supplemented by P.idl, Q.idl and R. idl, 92 # The above indicates that DOMWindow.idl is supplemented by P.idl, Q.idl and R.idl,
93 # Document.idl is supplemented by S.idl, and Event.idl is supplemented by no IDLs. 93 # Document.idl is supplemented by S.idl, and Event.idl is supplemented by no IDLs.
94 # The IDL that supplements another IDL (e.g. P.idl) never appears in the dep endency file. 94 # The IDL that supplements another IDL (e.g. P.idl) never appears in the dep endency file.
95 open FH, "< $supplementalDependencyFile" or die "Cannot open $supplementalDe pendencyFile\n"; 95 open FH, "< $supplementalDependencyFile" or die "Cannot open $supplementalDe pendencyFile\n";
96 while (my $line = <FH>) { 96 while (my $line = <FH>) {
97 my ($idlFile, @followingIdlFiles) = split(/\s+/, $line); 97 my ($idlFile, @followingIdlFiles) = split(/\s+/, $line);
98 if ($idlFile and basename($idlFile) eq basename($targetIdlFile)) { 98 if ($idlFile and basename($idlFile) eq basename($targetIdlFile)) {
99 $idlFound = 1; 99 $idlFound = 1;
100 @supplementedIdlFiles = @followingIdlFiles; 100 @supplementedIdlFiles = @followingIdlFiles;
101 } 101 }
102 } 102 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 } 144 }
145 die "Not found an interface ${targetInterfaceName} in ${targetInterf aceName}.idl." unless defined $targetDataNode; 145 die "Not found an interface ${targetInterfaceName} in ${targetInterf aceName}.idl." unless defined $targetDataNode;
146 146
147 # Support for attributes of partial interfaces. 147 # Support for attributes of partial interfaces.
148 foreach my $attribute (@{$interface->attributes}) { 148 foreach my $attribute (@{$interface->attributes}) {
149 # Record that this attribute is implemented by $interfaceName. 149 # Record that this attribute is implemented by $interfaceName.
150 $attribute->signature->extendedAttributes->{"ImplementedBy"} = $ interfaceName; 150 $attribute->signature->extendedAttributes->{"ImplementedBy"} = $ interfaceName;
151 151
152 # Add interface-wide extended attributes to each attribute. 152 # Add interface-wide extended attributes to each attribute.
153 applyInterfaceExtendedAttributes($interface, $attribute->signatu re->extendedAttributes); 153 foreach my $extendedAttributeName (keys %{$interface->extendedAt tributes}) {
154 154 $attribute->signature->extendedAttributes->{$extendedAttribu teName} = $interface->extendedAttributes->{$extendedAttributeName};
155 }
155 push(@{$targetDataNode->attributes}, $attribute); 156 push(@{$targetDataNode->attributes}, $attribute);
156 } 157 }
157 158
158 # Support for methods of partial interfaces. 159 # Support for methods of partial interfaces.
159 foreach my $function (@{$interface->functions}) { 160 foreach my $function (@{$interface->functions}) {
160 # Record that this method is implemented by $interfaceName. 161 # Record that this method is implemented by $interfaceName.
161 $function->signature->extendedAttributes->{"ImplementedBy"} = $i nterfaceName; 162 $function->signature->extendedAttributes->{"ImplementedBy"} = $i nterfaceName;
162 163
163 # Add interface-wide extended attributes to each method. 164 # Add interface-wide extended attributes to each method.
164 applyInterfaceExtendedAttributes($interface, $function->signatur e->extendedAttributes); 165 foreach my $extendedAttributeName (keys %{$interface->extendedAt tributes}) {
165 166 $function->signature->extendedAttributes->{$extendedAttribut eName} = $interface->extendedAttributes->{$extendedAttributeName};
167 }
166 push(@{$targetDataNode->functions}, $function); 168 push(@{$targetDataNode->functions}, $function);
167 } 169 }
168 170
169 # Support for constants of partial interfaces. 171 # Support for constants of partial interfaces.
170 foreach my $constant (@{$interface->constants}) { 172 foreach my $constant (@{$interface->constants}) {
171 # Record that this constant is implemented by $interfaceName. 173 # Record that this constant is implemented by $interfaceName.
172 $constant->extendedAttributes->{"ImplementedBy"} = $interfaceNam e; 174 $constant->extendedAttributes->{"ImplementedBy"} = $interfaceNam e;
173 175
174 # Add interface-wide extended attributes to each constant. 176 # Add interface-wide extended attributes to each constant.
175 applyInterfaceExtendedAttributes($interface, $constant->extended Attributes); 177 foreach my $extendedAttributeName (keys %{$interface->extendedAt tributes}) {
176 178 $constant->extendedAttributes->{$extendedAttributeName} = $i nterface->extendedAttributes->{$extendedAttributeName};
179 }
177 push(@{$targetDataNode->constants}, $constant); 180 push(@{$targetDataNode->constants}, $constant);
178 } 181 }
179 } else { 182 } else {
180 die "$idlFile is not a supplemental dependency of $targetIdlFile. Th ere maybe a bug in the the supplemental dependency generator (preprocess_idls.py ).\n"; 183 die "$idlFile is not a supplemental dependency of $targetIdlFile. Th ere maybe a bug in the the supplemental dependency generator (preprocess_idls.py ).\n";
181 } 184 }
182 } 185 }
183 } 186 }
184 187
185 # FIXME: This code will be removed once IDLParser.pm and CodeGeneratorV8.pm 188 # FIXME: This code will be removed once IDLParser.pm and CodeGeneratorV8.pm
186 # are connected via JSON files. See http://crbug.com/242795 189 # are connected via JSON files. See http://crbug.com/242795
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 268
266 foreach my $function (@{$interface->functions}) { 269 foreach my $function (@{$interface->functions}) {
267 checkIfIDLAttributesExists($idlAttributes, $function->signature->ext endedAttributes, $idlFile); 270 checkIfIDLAttributesExists($idlAttributes, $function->signature->ext endedAttributes, $idlFile);
268 foreach my $parameter (@{$function->parameters}) { 271 foreach my $parameter (@{$function->parameters}) {
269 checkIfIDLAttributesExists($idlAttributes, $parameter->extendedA ttributes, $idlFile); 272 checkIfIDLAttributesExists($idlAttributes, $parameter->extendedA ttributes, $idlFile);
270 } 273 }
271 } 274 }
272 } 275 }
273 } 276 }
274 277
275 sub applyInterfaceExtendedAttributes
276 {
277 my $interface = shift;
278 my $extendedAttributes = shift;
279
280 foreach my $extendedAttributeName (keys %{$interface->extendedAttributes}) {
281 next if $extendedAttributeName eq "ImplementedAs";
282 $extendedAttributes->{$extendedAttributeName} = $interface->extendedAttr ibutes->{$extendedAttributeName};
283 }
284 }
285
286 sub checkIfIDLAttributesExists 278 sub checkIfIDLAttributesExists
287 { 279 {
288 my $idlAttributes = shift; 280 my $idlAttributes = shift;
289 my $extendedAttributes = shift; 281 my $extendedAttributes = shift;
290 my $idlFile = shift; 282 my $idlFile = shift;
291 283
292 my $error; 284 my $error;
293 OUTER: for my $name (keys %$extendedAttributes) { 285 OUTER: for my $name (keys %$extendedAttributes) {
294 if (!exists $idlAttributes->{$name}) { 286 if (!exists $idlAttributes->{$name}) {
295 $error = "Unknown IDL attribute [$name] is found at $idlFile."; 287 $error = "Unknown IDL attribute [$name] is found at $idlFile.";
296 last OUTER; 288 last OUTER;
297 } 289 }
298 if ($idlAttributes->{$name}{"*"}) { 290 if ($idlAttributes->{$name}{"*"}) {
299 next; 291 next;
300 } 292 }
301 for my $rightValue (split /\s*\|\s*/, $extendedAttributes->{$name}) { 293 for my $rightValue (split /\s*\|\s*/, $extendedAttributes->{$name}) {
302 if (!exists $idlAttributes->{$name}{$rightValue}) { 294 if (!exists $idlAttributes->{$name}{$rightValue}) {
303 $error = "Unknown IDL attribute [$name=" . $extendedAttributes-> {$name} . "] is found at $idlFile."; 295 $error = "Unknown IDL attribute [$name=" . $extendedAttributes-> {$name} . "] is found at $idlFile.";
304 last OUTER; 296 last OUTER;
305 } 297 }
306 } 298 }
307 } 299 }
308 if ($error) { 300 if ($error) {
309 die "IDL ATTRIBUTE CHECKER ERROR: $error 301 die "IDL ATTRIBUTE CHECKER ERROR: $error
310 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I DLAttributes.txt and add explanations to the Blink IDL document (http://chromium .org/blink/webidl). 302 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I DLAttributes.txt and add explanations to the Blink IDL document (http://chromium .org/blink/webidl).
311 "; 303 ";
312 } 304 }
313 } 305 }
OLDNEW
« no previous file with comments | « Source/bindings/scripts/CodeGeneratorV8.pm ('k') | Source/bindings/scripts/preprocess_idls.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698