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

Side by Side Diff: Source/core/scripts/make_names.pl

Issue 23717043: Implement Custom Elements 'extends' option. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
« no previous file with comments | « Source/core/dom/CustomElementRegistry.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 2
3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org>
5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob ile.com/) 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob ile.com/)
6 # Copyright (C) 2011 Ericsson AB. All rights reserved. 6 # Copyright (C) 2011 Ericsson AB. All rights reserved.
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions 9 # modification, are permitted provided that the following conditions
10 # are met: 10 # are met:
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 print F <<END 1137 print F <<END
1138 return V8SVGElement::createWrapper(element, creationContext, isolate); 1138 return V8SVGElement::createWrapper(element, creationContext, isolate);
1139 END 1139 END
1140 ; 1140 ;
1141 } else { 1141 } else {
1142 print F <<END 1142 print F <<END
1143 return wrap(to$parameters{fallbackInterfaceName}(element), creationContext, isolate); 1143 return wrap(to$parameters{fallbackInterfaceName}(element), creationContext, isolate);
1144 END 1144 END
1145 ; 1145 ;
1146 } 1146 }
1147
1148 my $fallbackWrapper = $parameters{fallbackInterfaceName};
1149 if ($parameters{namespace} eq "SVG") {
1150 $fallbackWrapper = "SVGElement";
1151 }
1152
1147 print F <<END 1153 print F <<END
1148 } 1154 }
1149 1155
1150 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const WrapperType Info* type) 1156 WrapperTypeInfo* findWrapperTypeFor$parameters{namespace}TagName(const AtomicStr ing& name)
1151 { 1157 {
1152 typedef HashMap<const WrapperTypeInfo*, const QualifiedName*> TypeNameMap; 1158 typedef HashMap<WTF::StringImpl*, WrapperTypeInfo*> NameTypeMap;
1153 DEFINE_STATIC_LOCAL(TypeNameMap, map, ()); 1159 DEFINE_STATIC_LOCAL(NameTypeMap, map, ());
1154 if (map.isEmpty()) { 1160 if (map.isEmpty()) {
1155 END 1161 END
1156 ; 1162 ;
1157 1163
1158 for my $tagName (sort keys %enabledTags) { 1164 for my $tagName (sort keys %enabledTags) {
1159 if (!usesDefaultJSWrapper($tagName)) { 1165 if (!usesDefaultJSWrapper($tagName)) {
1160 my $conditional = $enabledTags{$tagName}{conditional}; 1166 my $conditional = $enabledTags{$tagName}{conditional};
1161 if ($conditional) { 1167 if ($conditional) {
1162 my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/ &/, $conditional)) . ")"; 1168 my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/ &/, $conditional)) . ")";
1163 print F "#if ${conditionalString}\n"; 1169 print F "#if ${conditionalString}\n";
1164 } 1170 }
1165 1171
1166 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName}; 1172 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
1167 print F " map.set(WrapperTypeTraits<${JSInterfaceName}>::info( ), &${tagName}Tag);\n"; 1173 print F " map.set(${tagName}Tag.localName().impl(), WrapperTyp eTraits<${JSInterfaceName}>::info());\n";
1168 1174
1169 if ($conditional) { 1175 if ($conditional) {
1170 print F "#endif\n"; 1176 print F "#endif\n";
1171 } 1177 }
1172 } 1178 }
1173 } 1179 }
1174 1180
1175 print F <<END 1181 print F <<END
1176 } 1182 }
1177 1183
1178 return map.get(type); 1184 if (WrapperTypeInfo* result = map.get(name.impl()))
1185 return result;
1186
1187 return WrapperTypeTraits<$fallbackWrapper>::info();
1179 } 1188 }
1180 1189
1181 END 1190 END
1182 ; 1191 ;
1183 1192
1184 print F "}\n\n"; 1193 print F "}\n\n";
1185 print F "#endif\n" if $parameters{guardFactoryWith}; 1194 print F "#endif\n" if $parameters{guardFactoryWith};
1186 1195
1187 close F; 1196 close F;
1188 } 1197 }
(...skipping 14 matching lines...) Expand all
1203 1212
1204 print F <<END 1213 print F <<END
1205 #include <V8$parameters{namespace}Element.h> 1214 #include <V8$parameters{namespace}Element.h>
1206 #include <V8$parameters{fallbackJSInterfaceName}.h> 1215 #include <V8$parameters{fallbackJSInterfaceName}.h>
1207 #include <v8.h> 1216 #include <v8.h>
1208 1217
1209 namespace WebCore { 1218 namespace WebCore {
1210 1219
1211 class $parameters{namespace}Element; 1220 class $parameters{namespace}Element;
1212 1221
1213 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const Wrapper TypeInfo*); 1222 WrapperTypeInfo* findWrapperTypeFor$parameters{namespace}TagName(const Atomi cString& name);
1223
1214 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*); 1224 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
1215 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate) 1225 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate)
1216 { 1226 {
1217 return V8$parameters{namespace}Element::createWrapper(element, creationC ontext, isolate); 1227 return V8$parameters{namespace}Element::createWrapper(element, creationC ontext, isolate);
1218 } 1228 }
1219 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper( $parameters{fallbackJSInterfaceName}* element, v8::Handle<v8::Object> creationCo ntext, v8::Isolate* isolate) 1229 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper( $parameters{fallbackJSInterfaceName}* element, v8::Handle<v8::Object> creationCo ntext, v8::Isolate* isolate)
1220 { 1230 {
1221 return V8$parameters{fallbackJSInterfaceName}::createWrapper(element, cr eationContext, isolate); 1231 return V8$parameters{fallbackJSInterfaceName}::createWrapper(element, cr eationContext, isolate);
1222 } 1232 }
1223 } 1233 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 print F StaticString::GenerateStringImpls(\%parameters); 1283 print F StaticString::GenerateStringImpls(\%parameters);
1274 1284
1275 while ( my ($name, $identifier) = each %parameters ) { 1285 while ( my ($name, $identifier) = each %parameters ) {
1276 print F " new ((void*)&$name) AtomicString(${name}Impl);\n"; 1286 print F " new ((void*)&$name) AtomicString(${name}Impl);\n";
1277 } 1287 }
1278 1288
1279 print F "}\n}\n}\n"; 1289 print F "}\n}\n}\n";
1280 close F; 1290 close F;
1281 exit 0; 1291 exit 0;
1282 } 1292 }
OLDNEW
« no previous file with comments | « Source/core/dom/CustomElementRegistry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698