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

Side by Side Diff: Source/bindings/scripts/CodeGeneratorV8.pm

Issue 14447006: Global constructors should be configurable and not enumerable (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 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 # use the naming convension, interface + (capitalize) attr name 2610 # use the naming convension, interface + (capitalize) attr name
2611 $customAccessor = $interfaceName . "::" . $attrName; 2611 $customAccessor = $interfaceName . "::" . $attrName;
2612 } 2612 }
2613 2613
2614 my $getter; 2614 my $getter;
2615 my $setter; 2615 my $setter;
2616 my $getterForMainWorld; 2616 my $getterForMainWorld;
2617 my $setterForMainWorld; 2617 my $setterForMainWorld;
2618 my $propAttr = "v8::None"; 2618 my $propAttr = "v8::None";
2619 2619
2620 my $isConstructor = ($attribute->signature->type =~ /Constructor$/);
2621
2620 # Check attributes. 2622 # Check attributes.
2621 if ($attrExt->{"NotEnumerable"}) { 2623 # As per Web IDL specification, constructor properties on the ECMAScript glo bal object should be
2624 # configurable and should not be enumerable.
2625 if ($attrExt->{"NotEnumerable"} || $isConstructor) {
2622 $propAttr .= " | v8::DontEnum"; 2626 $propAttr .= " | v8::DontEnum";
2623 } 2627 }
2624 if ($attrExt->{"Unforgeable"}) { 2628 if ($attrExt->{"Unforgeable"} && !$isConstructor) {
2625 $propAttr .= " | v8::DontDelete"; 2629 $propAttr .= " | v8::DontDelete";
2626 } 2630 }
2627 2631
2628 my $on_proto = "0 /* on instance */"; 2632 my $on_proto = "0 /* on instance */";
2629 my $data = "0 /* no data */"; 2633 my $data = "0 /* no data */";
2630 2634
2631 # Constructor 2635 # Constructor
2632 if ($attribute->signature->type =~ /Constructor$/) { 2636 if ($isConstructor) {
2633 my $constructorType = $attribute->signature->type; 2637 my $constructorType = $attribute->signature->type;
2634 $constructorType =~ s/Constructor$//; 2638 $constructorType =~ s/Constructor$//;
2635 # $constructorType ~= /Constructor$/ indicates that it is NamedConstruct or. 2639 # $constructorType ~= /Constructor$/ indicates that it is NamedConstruct or.
2636 # We do not generate the header file for NamedConstructor of class XXXX, 2640 # We do not generate the header file for NamedConstructor of class XXXX,
2637 # since we generate the NamedConstructor declaration into the header fil e of class XXXX. 2641 # since we generate the NamedConstructor declaration into the header fil e of class XXXX.
2638 if ($constructorType !~ /Constructor$/ || $attribute->signature->extende dAttributes->{"CustomConstructor"}) { 2642 if ($constructorType !~ /Constructor$/ || $attribute->signature->extende dAttributes->{"CustomConstructor"}) {
2639 AddToImplIncludes("V8${constructorType}.h", $attribute->signature->e xtendedAttributes->{"Conditional"}); 2643 AddToImplIncludes("V8${constructorType}.h", $attribute->signature->e xtendedAttributes->{"Conditional"});
2640 } 2644 }
2641 $data = "&V8${constructorType}::info"; 2645 $data = "&V8${constructorType}::info";
2642 $getter = "${interfaceName}V8Internal::${interfaceName}ConstructorGetter "; 2646 $getter = "${interfaceName}V8Internal::${interfaceName}ConstructorGetter ";
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after
4861 4865
4862 sub GetPassRefPtrType 4866 sub GetPassRefPtrType
4863 { 4867 {
4864 my $v8InterfaceName = shift; 4868 my $v8InterfaceName = shift;
4865 4869
4866 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; 4870 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : "";
4867 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; 4871 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>";
4868 } 4872 }
4869 4873
4870 1; 4874 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698