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

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

Issue 149993003: IDL compiler: [Custom=PropertyEnumerator] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 my $namedGetterFunction = GetNamedGetterFunction($interface); 1094 my $namedGetterFunction = GetNamedGetterFunction($interface);
1095 my $hasCustomNamedGetter = $namedGetterFunction && HasCustomPropertyGetter($ namedGetterFunction->extendedAttributes); 1095 my $hasCustomNamedGetter = $namedGetterFunction && HasCustomPropertyGetter($ namedGetterFunction->extendedAttributes);
1096 1096
1097 my $namedSetterFunction = GetNamedSetterFunction($interface); 1097 my $namedSetterFunction = GetNamedSetterFunction($interface);
1098 my $hasCustomNamedSetter = $namedSetterFunction && $namedSetterFunction->ext endedAttributes->{"Custom"}; 1098 my $hasCustomNamedSetter = $namedSetterFunction && $namedSetterFunction->ext endedAttributes->{"Custom"};
1099 1099
1100 my $namedDeleterFunction = GetNamedDeleterFunction($interface); 1100 my $namedDeleterFunction = GetNamedDeleterFunction($interface);
1101 my $hasCustomNamedDeleter = $namedDeleterFunction && $namedDeleterFunction-> extendedAttributes->{"Custom"}; 1101 my $hasCustomNamedDeleter = $namedDeleterFunction && $namedDeleterFunction-> extendedAttributes->{"Custom"};
1102 1102
1103 my $namedEnumeratorFunction = $namedGetterFunction && !$namedGetterFunction- >extendedAttributes->{"NotEnumerable"}; 1103 my $namedEnumeratorFunction = $namedGetterFunction && !$namedGetterFunction- >extendedAttributes->{"NotEnumerable"};
1104 my $hasCustomNamedEnumerator = $namedGetterFunction && ExtendedAttributeCont ains($namedGetterFunction->extendedAttributes->{"Custom"}, "PropertyEnumerator") ; 1104 my $hasCustomNamedEnumerator = $namedEnumeratorFunction && ExtendedAttribute Contains($namedGetterFunction->extendedAttributes->{"Custom"}, "PropertyEnumerat or");
Nils Barth (inactive) 2014/01/30 04:42:41 Typo fix: should ask for Enumerator, not Getter.
1105 my $hasCustomNamedQuery = $namedEnumeratorFunction && ExtendedAttributeConta ins($namedGetterFunction->extendedAttributes->{"Custom"}, "PropertyQuery");
1105 1106
1106 if ($hasCustomIndexedGetter) { 1107 if ($hasCustomIndexedGetter) {
1107 $header{classPublic}->add(" static void indexedPropertyGetterCustom(u int32_t, const v8::PropertyCallbackInfo<v8::Value>&);\n"); 1108 $header{classPublic}->add(" static void indexedPropertyGetterCustom(u int32_t, const v8::PropertyCallbackInfo<v8::Value>&);\n");
1108 } 1109 }
1109 1110
1110 if ($hasCustomIndexedSetter) { 1111 if ($hasCustomIndexedSetter) {
1111 $header{classPublic}->add(" static void indexedPropertySetterCustom(u int32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);\n"); 1112 $header{classPublic}->add(" static void indexedPropertySetterCustom(u int32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);\n");
1112 } 1113 }
1113 1114
1114 if ($hasCustomIndexedDeleters) { 1115 if ($hasCustomIndexedDeleters) {
1115 $header{classPublic}->add(" static void indexedPropertyDeleterCustom( uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&);\n"); 1116 $header{classPublic}->add(" static void indexedPropertyDeleterCustom( uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&);\n");
1116 } 1117 }
1117 1118
1118 if ($hasCustomNamedGetter) { 1119 if ($hasCustomNamedGetter) {
1119 $header{classPublic}->add(" static void namedPropertyGetterCustom(v8: :Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&);\n"); 1120 $header{classPublic}->add(" static void namedPropertyGetterCustom(v8: :Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&);\n");
1120 } 1121 }
1121 1122
1122 if ($hasCustomNamedSetter) { 1123 if ($hasCustomNamedSetter) {
1123 $header{classPublic}->add(" static void namedPropertySetterCustom(v8: :Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Val ue>&);\n"); 1124 $header{classPublic}->add(" static void namedPropertySetterCustom(v8: :Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Val ue>&);\n");
1124 } 1125 }
1125 1126
1127 if ($hasCustomNamedQuery) {
1128 $header{classPublic}->add(" static void namedPropertyQueryCustom(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer>&);\n");
1129 }
1130
1126 if ($hasCustomNamedDeleter) { 1131 if ($hasCustomNamedDeleter) {
1127 $header{classPublic}->add(" static void namedPropertyDeleterCustom(v8 ::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean>&);\n"); 1132 $header{classPublic}->add(" static void namedPropertyDeleterCustom(v8 ::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean>&);\n");
1128 } 1133 }
1129 1134
1130 if ($hasCustomNamedEnumerator) { 1135 if ($hasCustomNamedEnumerator) {
1131 $header{classPublic}->add(" static void namedPropertyEnumeratorCustom (const v8::PropertyCallbackInfo<v8::Array>&);\n"); 1136 $header{classPublic}->add(" static void namedPropertyEnumeratorCustom (const v8::PropertyCallbackInfo<v8::Array>&);\n");
1132 $header{classPublic}->add(" static void namedPropertyQueryCustom(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer>&);\n");
1133 } 1137 }
1134 } 1138 }
1135 1139
1136 sub GenerateHeaderLegacyCallAsFunction 1140 sub GenerateHeaderLegacyCallAsFunction
1137 { 1141 {
1138 my $interface = shift; 1142 my $interface = shift;
1139 1143
1140 if (ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "L egacyCallAsFunction")) { 1144 if (ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "L egacyCallAsFunction")) {
1141 $header{classPublic}->add(" static void legacyCallCustom(const v8::Fu nctionCallbackInfo<v8::Value>&);\n"); 1145 $header{classPublic}->add(" static void legacyCallCustom(const v8::Fu nctionCallbackInfo<v8::Value>&);\n");
1142 } 1146 }
(...skipping 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 3816
3813 sub GenerateImplementationNamedPropertyAccessors 3817 sub GenerateImplementationNamedPropertyAccessors
3814 { 3818 {
3815 my $interface = shift; 3819 my $interface = shift;
3816 3820
3817 my $interfaceName = $interface->name; 3821 my $interfaceName = $interface->name;
3818 my $implClassName = GetImplName($interface); 3822 my $implClassName = GetImplName($interface);
3819 my $v8ClassName = GetV8ClassName($interface); 3823 my $v8ClassName = GetV8ClassName($interface);
3820 3824
3821 my $namedGetterFunction = GetNamedGetterFunction($interface); 3825 my $namedGetterFunction = GetNamedGetterFunction($interface);
3826 my $namedEnumeratorFunction = $namedGetterFunction && !$namedGetterFunction- >extendedAttributes->{"NotEnumerable"};
3827
3822 if ($namedGetterFunction) { 3828 if ($namedGetterFunction) {
3823 # includes for return type even if custom 3829 # includes for return type even if custom
3824 my $returnType = $namedGetterFunction->type; 3830 my $returnType = $namedGetterFunction->type;
3825 AddIncludesForType($returnType); 3831 AddIncludesForType($returnType);
3826 if (IsRefPtrType($returnType)) { 3832 if (IsRefPtrType($returnType)) {
3827 AddToImplIncludes("wtf/RefPtr.h"); 3833 AddToImplIncludes("wtf/RefPtr.h");
3828 AddToImplIncludes("wtf/GetPtr.h"); 3834 AddToImplIncludes("wtf/GetPtr.h");
3829 } 3835 }
3830 my $hasCustomNamedGetter = HasCustomPropertyGetter($namedGetterFunction- >extendedAttributes); 3836 my $hasCustomNamedGetter = HasCustomPropertyGetter($namedGetterFunction- >extendedAttributes);
3831 if (!$hasCustomNamedGetter) { 3837 if (!$hasCustomNamedGetter) {
3832 GenerateImplementationNamedPropertyGetter($interface, $namedGetterFu nction); 3838 GenerateImplementationNamedPropertyGetter($interface, $namedGetterFu nction);
3833 } 3839 }
3834 GenerateImplementationNamedPropertyGetterCallback($interface, $hasCustom NamedGetter); 3840 GenerateImplementationNamedPropertyGetterCallback($interface, $hasCustom NamedGetter);
3835 } 3841 }
3836 3842
3837 my $namedSetterFunction = GetNamedSetterFunction($interface); 3843 my $namedSetterFunction = GetNamedSetterFunction($interface);
3838 if ($namedSetterFunction) { 3844 if ($namedSetterFunction) {
3839 AddIncludesForType($namedSetterFunction->parameters->[1]->type); # incl udes for argument type even if custom 3845 AddIncludesForType($namedSetterFunction->parameters->[1]->type); # incl udes for argument type even if custom
3840 my $hasCustomNamedSetter = $namedSetterFunction->extendedAttributes->{"C ustom"}; 3846 my $hasCustomNamedSetter = $namedSetterFunction->extendedAttributes->{"C ustom"};
3841 if (!$hasCustomNamedSetter) { 3847 if (!$hasCustomNamedSetter) {
3842 GenerateImplementationNamedPropertySetter($interface, $namedSetterFu nction); 3848 GenerateImplementationNamedPropertySetter($interface, $namedSetterFu nction);
3843 } 3849 }
3844 GenerateImplementationNamedPropertySetterCallback($interface, $hasCustom NamedSetter); 3850 GenerateImplementationNamedPropertySetterCallback($interface, $hasCustom NamedSetter);
3845 } 3851 }
3846 3852
3853 if ($namedEnumeratorFunction) {
3854 my $hasCustomNamedQuery = ExtendedAttributeContains($namedGetterFunction ->extendedAttributes->{"Custom"}, "PropertyQuery");
3855 if (!$hasCustomNamedQuery) {
3856 GenerateImplementationNamedPropertyQuery($interface);
3857 }
3858 GenerateImplementationNamedPropertyQueryCallback($interface, $hasCustomN amedQuery);
3859 }
3860
3847 my $namedDeleterFunction = GetNamedDeleterFunction($interface); 3861 my $namedDeleterFunction = GetNamedDeleterFunction($interface);
3848 if ($namedDeleterFunction) { 3862 if ($namedDeleterFunction) {
3849 my $hasCustomNamedDeleter = $namedDeleterFunction->extendedAttributes->{ "Custom"}; 3863 my $hasCustomNamedDeleter = $namedDeleterFunction->extendedAttributes->{ "Custom"};
3850 if (!$hasCustomNamedDeleter) { 3864 if (!$hasCustomNamedDeleter) {
3851 GenerateImplementationNamedPropertyDeleter($interface, $namedDeleter Function); 3865 GenerateImplementationNamedPropertyDeleter($interface, $namedDeleter Function);
3852 } 3866 }
3853 GenerateImplementationNamedPropertyDeleterCallback($interface, $hasCusto mNamedDeleter); 3867 GenerateImplementationNamedPropertyDeleterCallback($interface, $hasCusto mNamedDeleter);
3854 } 3868 }
3855 3869
3856 my $namedEnumeratorFunction = $namedGetterFunction && !$namedGetterFunction- >extendedAttributes->{"NotEnumerable"};
3857 if ($namedEnumeratorFunction) { 3870 if ($namedEnumeratorFunction) {
3858 my $hasCustomNamedEnumerator = ExtendedAttributeContains($namedGetterFun ction->extendedAttributes->{"Custom"}, "PropertyEnumerator"); 3871 my $hasCustomNamedEnumerator = ExtendedAttributeContains($namedGetterFun ction->extendedAttributes->{"Custom"}, "PropertyEnumerator");
3859 if (!$hasCustomNamedEnumerator) { 3872 if (!$hasCustomNamedEnumerator) {
3860 GenerateImplementationNamedPropertyQuery($interface);
3861 }
3862 GenerateImplementationNamedPropertyQueryCallback($interface, $hasCustomN amedEnumerator);
3863 if (!$hasCustomNamedEnumerator) {
3864 GenerateImplementationNamedPropertyEnumerator($interface); 3873 GenerateImplementationNamedPropertyEnumerator($interface);
3865 } 3874 }
3866 GenerateImplementationNamedPropertyEnumeratorCallback($interface, $hasCu stomNamedEnumerator); 3875 GenerateImplementationNamedPropertyEnumeratorCallback($interface, $hasCu stomNamedEnumerator);
3867 } 3876 }
3868 3877
3869 my $subCode = ""; 3878 my $subCode = "";
3870 if ($namedGetterFunction || $namedSetterFunction || $namedDeleterFunction || $namedEnumeratorFunction) { 3879 if ($namedGetterFunction || $namedSetterFunction || $namedDeleterFunction || $namedEnumeratorFunction) {
3871 my $setOn = "Instance"; 3880 my $setOn = "Instance";
3872 3881
3873 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa llbacks) and it's used on Window 3882 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa llbacks) and it's used on Window
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after
6427 if ($parameter->type eq "SerializedScriptValue") { 6436 if ($parameter->type eq "SerializedScriptValue") {
6428 return 1; 6437 return 1;
6429 } elsif (IsIntegerType($parameter->type)) { 6438 } elsif (IsIntegerType($parameter->type)) {
6430 return 1; 6439 return 1;
6431 } 6440 }
6432 } 6441 }
6433 return 0; 6442 return 0;
6434 } 6443 }
6435 6444
6436 1; 6445 1;
OLDNEW
« no previous file with comments | « Source/bindings/IDLExtendedAttributes.txt ('k') | Source/bindings/scripts/unstable/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698