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

Side by Side 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 unified diff | Download patch
OLDNEW
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3135 if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttr ibutes->{"Unforgeable"}) { 3135 if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttr ibutes->{"Unforgeable"}) {
3136 push(@disallowsShadowing, $attribute); 3136 push(@disallowsShadowing, $attribute);
3137 } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"} ) { 3137 } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"} ) {
3138 push(@enabledAtRuntimeAttributes, $attribute); 3138 push(@enabledAtRuntimeAttributes, $attribute);
3139 } elsif ($attribute->signature->extendedAttributes->{"EnabledPerContext" }) { 3139 } elsif ($attribute->signature->extendedAttributes->{"EnabledPerContext" }) {
3140 push(@enabledPerContextAttributes, $attribute); 3140 push(@enabledPerContextAttributes, $attribute);
3141 } else { 3141 } else {
3142 push(@normalAttributes, $attribute); 3142 push(@normalAttributes, $attribute);
3143 } 3143 }
3144 } 3144 }
3145
3146 # Generate DOMWindow Constructor attributes.
3147 if ($interfaceName eq "DOMWindow") {
3148 foreach my $otherInterface ($codeGenerator->GetAllInterfaces()) {
3149 my $otherInterfaceName = $otherInterface->name;
3150 if ($otherInterface->extendedAttributes->{"NoInterfaceObject"}) {
3151 next;
3152 }
3153 my $attribute = domAttribute->new();
3154 $attribute->type("attribute");
3155 $attribute->signature(domSignature->new());
3156 $attribute->signature->type("${otherInterfaceName}Constructor");
3157
3158 if ($otherInterface->extendedAttributes->{"InterfaceName"}) {
3159 $attribute->signature->name($otherInterface->extendedAttributes- >{"InterfaceName"});
3160 } else {
3161 $attribute->signature->name($otherInterfaceName);
3162 }
3163
3164 # In addition to the regular property, for every [NamedConstructor] extended attribute on an interface,
3165 # a corresponding property MUST exist on the ECMAScript global objec t.
3166 my $namedConstructorAttribute;
3167 if ($otherInterface->extendedAttributes->{"NamedConstructor"}) {
3168 $namedConstructorAttribute = domAttribute->new();
3169 $namedConstructorAttribute->type("attribute");
3170 $namedConstructorAttribute->signature(domSignature->new());
3171 $namedConstructorAttribute->signature->type("${otherInterfaceNam e}ConstructorConstructor");
3172 $namedConstructorAttribute->signature->name(@{$otherInterface->c onstructors}[0]->signature->extendedAttributes->{"NamedConstructor"});
3173 }
3174
3175 my $attrExtendedAttributeList = {};
3176 if ($otherInterface->extendedAttributes->{"Conditional"}) {
3177 $attrExtendedAttributeList->{"Conditional"} = $otherInterface->e xtendedAttributes->{"Conditional"};
3178 }
3179 if ($otherInterface->extendedAttributes->{"EnabledAtRuntime"}) {
3180 $attrExtendedAttributeList->{"EnabledAtRuntime"} = $otherInterfa ce->extendedAttributes->{"EnabledAtRuntime"};
3181 push(@enabledAtRuntimeAttributes, $attribute);
3182 push(@enabledAtRuntimeAttributes, $namedConstructorAttribute) if $namedConstructorAttribute;
3183 } elsif ($otherInterface->extendedAttributes->{"EnabledPerContext"}) {
3184 $attrExtendedAttributeList->{"EnabledPerContext"} = $otherInterf ace->extendedAttributes->{"EnabledPerContext"};
3185 push(@enabledPerContextAttributes, $attribute);
3186 push(@enabledPerContextAttributes, $namedConstructorAttribute) i f $namedConstructorAttribute;
3187 } else {
3188 push(@normalAttributes, $attribute);
3189 push(@normalAttributes, $namedConstructorAttribute) if $namedCon structorAttribute;
3190 }
3191 $attribute->signature->extendedAttributes($attrExtendedAttributeList );
3192 $namedConstructorAttribute->signature->extendedAttributes($attrExten dedAttributeList) if $namedConstructorAttribute;
3193 }
3194 }
3195
3145 $attributes = \@normalAttributes; 3196 $attributes = \@normalAttributes;
3146 # Put the attributes that disallow shadowing on the shadow object. 3197 # Put the attributes that disallow shadowing on the shadow object.
3147 if (@disallowsShadowing) { 3198 if (@disallowsShadowing) {
3148 my $code = ""; 3199 my $code = "";
3149 $code .= "static const V8DOMConfiguration::BatchedAttribute shadowAttrs[ ] = {\n"; 3200 $code .= "static const V8DOMConfiguration::BatchedAttribute shadowAttrs[ ] = {\n";
3150 $code .= GenerateBatchedAttributeData($interface, \@disallowsShadowing); 3201 $code .= GenerateBatchedAttributeData($interface, \@disallowsShadowing);
3151 $code .= "};\n\n"; 3202 $code .= "};\n\n";
3152 AddToImplContent($code); 3203 AddToImplContent($code);
3153 } 3204 }
3154 3205
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
4732 4783
4733 sub GetPassRefPtrType 4784 sub GetPassRefPtrType
4734 { 4785 {
4735 my $v8InterfaceName = shift; 4786 my $v8InterfaceName = shift;
4736 4787
4737 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; 4788 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : "";
4738 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; 4789 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>";
4739 } 4790 }
4740 4791
4741 1; 4792 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698