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

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: Applied Kentaro's comments 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 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after
3257 if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttr ibutes->{"Unforgeable"}) { 3257 if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttr ibutes->{"Unforgeable"}) {
3258 push(@disallowsShadowing, $attribute); 3258 push(@disallowsShadowing, $attribute);
3259 } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"} ) { 3259 } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"} ) {
3260 push(@enabledAtRuntimeAttributes, $attribute); 3260 push(@enabledAtRuntimeAttributes, $attribute);
3261 } elsif ($attribute->signature->extendedAttributes->{"EnabledPerContext" }) { 3261 } elsif ($attribute->signature->extendedAttributes->{"EnabledPerContext" }) {
3262 push(@enabledPerContextAttributes, $attribute); 3262 push(@enabledPerContextAttributes, $attribute);
3263 } else { 3263 } else {
3264 push(@normalAttributes, $attribute); 3264 push(@normalAttributes, $attribute);
3265 } 3265 }
3266 } 3266 }
3267
3268 # Generate DOMWindow Constructor attributes.
3269 if ($interfaceName eq "DOMWindow") {
3270 foreach my $otherInterface ($codeGenerator->GetAllInterfaces()) {
3271 my $otherInterfaceName = $otherInterface->name;
3272 if ($otherInterface->extendedAttributes->{"NoInterfaceObject"}) {
3273 next;
3274 }
3275 my $attribute = domAttribute->new();
3276 $attribute->type("attribute");
3277 $attribute->signature(domSignature->new());
3278 $attribute->signature->type("${otherInterfaceName}Constructor");
3279
3280 if ($otherInterface->extendedAttributes->{"InterfaceName"}) {
3281 $attribute->signature->name($otherInterface->extendedAttributes- >{"InterfaceName"});
3282 } else {
3283 $attribute->signature->name($otherInterfaceName);
3284 }
3285
3286 # In addition to the regular property, for every [NamedConstructor] extended attribute on an interface,
3287 # a corresponding property MUST exist on the ECMAScript global objec t.
3288 my $namedConstructorAttribute;
3289 if ($otherInterface->extendedAttributes->{"NamedConstructor"}) {
3290 $namedConstructorAttribute = domAttribute->new();
3291 $namedConstructorAttribute->type("attribute");
3292 $namedConstructorAttribute->signature(domSignature->new());
3293 $namedConstructorAttribute->signature->type("${otherInterfaceNam e}ConstructorConstructor");
3294 $namedConstructorAttribute->signature->name(@{$otherInterface->c onstructors}[0]->signature->extendedAttributes->{"NamedConstructor"});
3295 }
3296
3297 my $attrExtendedAttributeList = {};
3298 if ($otherInterface->extendedAttributes->{"Conditional"}) {
3299 $attrExtendedAttributeList->{"Conditional"} = $otherInterface->e xtendedAttributes->{"Conditional"};
3300 }
3301 if ($otherInterface->extendedAttributes->{"EnabledAtRuntime"}) {
3302 $attrExtendedAttributeList->{"EnabledAtRuntime"} = $otherInterfa ce->extendedAttributes->{"EnabledAtRuntime"};
3303 push(@enabledAtRuntimeAttributes, $attribute);
3304 push(@enabledAtRuntimeAttributes, $namedConstructorAttribute) if $namedConstructorAttribute;
3305 } elsif ($otherInterface->extendedAttributes->{"EnabledPerContext"}) {
3306 $attrExtendedAttributeList->{"EnabledPerContext"} = $otherInterf ace->extendedAttributes->{"EnabledPerContext"};
3307 push(@enabledPerContextAttributes, $attribute);
3308 push(@enabledPerContextAttributes, $namedConstructorAttribute) i f $namedConstructorAttribute;
3309 } else {
3310 push(@normalAttributes, $attribute);
3311 push(@normalAttributes, $namedConstructorAttribute) if $namedCon structorAttribute;
3312 }
3313 $attribute->signature->extendedAttributes($attrExtendedAttributeList );
3314 $namedConstructorAttribute->signature->extendedAttributes($attrExten dedAttributeList) if $namedConstructorAttribute;
3315 }
3316 }
3317
3267 $attributes = \@normalAttributes; 3318 $attributes = \@normalAttributes;
3268 # Put the attributes that disallow shadowing on the shadow object. 3319 # Put the attributes that disallow shadowing on the shadow object.
3269 if (@disallowsShadowing) { 3320 if (@disallowsShadowing) {
3270 my $code = ""; 3321 my $code = "";
3271 $code .= "static const V8DOMConfiguration::BatchedAttribute shadowAttrs[ ] = {\n"; 3322 $code .= "static const V8DOMConfiguration::BatchedAttribute shadowAttrs[ ] = {\n";
3272 $code .= GenerateBatchedAttributeData($interface, \@disallowsShadowing); 3323 $code .= GenerateBatchedAttributeData($interface, \@disallowsShadowing);
3273 $code .= "};\n\n"; 3324 $code .= "};\n\n";
3274 AddToImplContent($code); 3325 AddToImplContent($code);
3275 } 3326 }
3276 3327
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4858 4909
4859 sub GetPassRefPtrType 4910 sub GetPassRefPtrType
4860 { 4911 {
4861 my $v8InterfaceName = shift; 4912 my $v8InterfaceName = shift;
4862 4913
4863 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; 4914 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : "";
4864 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; 4915 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>";
4865 } 4916 }
4866 4917
4867 1; 4918 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698