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

Unified Diff: Source/bindings/scripts/CodeGeneratorV8.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/CodeGeneratorV8.pm
diff --git a/Source/bindings/scripts/CodeGeneratorV8.pm b/Source/bindings/scripts/CodeGeneratorV8.pm
index 4b2fba9bcb8f636dbbde4691ee16de1d73d6e015..17d2a4a9e0ee8d4fb0d69138101c551b41a6541b 100644
--- a/Source/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/bindings/scripts/CodeGeneratorV8.pm
@@ -3142,6 +3142,57 @@ END
push(@normalAttributes, $attribute);
}
}
+
+ # Generate DOMWindow Constructor attributes.
+ if ($interfaceName eq "DOMWindow") {
+ foreach my $otherInterface ($codeGenerator->GetAllInterfaces()) {
+ my $otherInterfaceName = $otherInterface->name;
+ if ($otherInterface->extendedAttributes->{"NoInterfaceObject"}) {
+ next;
+ }
+ my $attribute = domAttribute->new();
+ $attribute->type("attribute");
+ $attribute->signature(domSignature->new());
+ $attribute->signature->type("${otherInterfaceName}Constructor");
+
+ if ($otherInterface->extendedAttributes->{"InterfaceName"}) {
+ $attribute->signature->name($otherInterface->extendedAttributes->{"InterfaceName"});
+ } else {
+ $attribute->signature->name($otherInterfaceName);
+ }
+
+ # In addition to the regular property, for every [NamedConstructor] extended attribute on an interface,
+ # a corresponding property MUST exist on the ECMAScript global object.
+ my $namedConstructorAttribute;
+ if ($otherInterface->extendedAttributes->{"NamedConstructor"}) {
+ $namedConstructorAttribute = domAttribute->new();
+ $namedConstructorAttribute->type("attribute");
+ $namedConstructorAttribute->signature(domSignature->new());
+ $namedConstructorAttribute->signature->type("${otherInterfaceName}ConstructorConstructor");
+ $namedConstructorAttribute->signature->name(@{$otherInterface->constructors}[0]->signature->extendedAttributes->{"NamedConstructor"});
+ }
+
+ my $attrExtendedAttributeList = {};
+ if ($otherInterface->extendedAttributes->{"Conditional"}) {
+ $attrExtendedAttributeList->{"Conditional"} = $otherInterface->extendedAttributes->{"Conditional"};
+ }
+ if ($otherInterface->extendedAttributes->{"EnabledAtRuntime"}) {
+ $attrExtendedAttributeList->{"EnabledAtRuntime"} = $otherInterface->extendedAttributes->{"EnabledAtRuntime"};
+ push(@enabledAtRuntimeAttributes, $attribute);
+ push(@enabledAtRuntimeAttributes, $namedConstructorAttribute) if $namedConstructorAttribute;
+ } elsif ($otherInterface->extendedAttributes->{"EnabledPerContext"}) {
+ $attrExtendedAttributeList->{"EnabledPerContext"} = $otherInterface->extendedAttributes->{"EnabledPerContext"};
+ push(@enabledPerContextAttributes, $attribute);
+ push(@enabledPerContextAttributes, $namedConstructorAttribute) if $namedConstructorAttribute;
+ } else {
+ push(@normalAttributes, $attribute);
+ push(@normalAttributes, $namedConstructorAttribute) if $namedConstructorAttribute;
+ }
+ $attribute->signature->extendedAttributes($attrExtendedAttributeList);
+ $namedConstructorAttribute->signature->extendedAttributes($attrExtendedAttributeList) if $namedConstructorAttribute;
+ }
+ }
+
$attributes = \@normalAttributes;
# Put the attributes that disallow shadowing on the shadow object.
if (@disallowsShadowing) {

Powered by Google App Engine
This is Rietveld 408576698