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

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

Issue 17214003: Remove [InterfaceName] IDL attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix try bot failures Created 7 years, 6 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 | « no previous file | Source/bindings/scripts/IDLAttributes.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 } 1253 }
1254 return ""; 1254 return "";
1255 } 1255 }
1256 1256
1257 sub GenerateActivityLogging 1257 sub GenerateActivityLogging
1258 { 1258 {
1259 my $accessType = shift; 1259 my $accessType = shift;
1260 my $interface = shift; 1260 my $interface = shift;
1261 my $propertyName = shift; 1261 my $propertyName = shift;
1262 1262
1263 my $visibleInterfaceName = GetVisibleInterfaceName($interface); 1263 my $interfaceName = $interface->name;
1264 1264
1265 AddToImplIncludes("bindings/v8/V8Binding.h"); 1265 AddToImplIncludes("bindings/v8/V8Binding.h");
1266 AddToImplIncludes("bindings/v8/V8DOMActivityLogger.h"); 1266 AddToImplIncludes("bindings/v8/V8DOMActivityLogger.h");
1267 AddToImplIncludes("wtf/Vector.h"); 1267 AddToImplIncludes("wtf/Vector.h");
1268 1268
1269 my $code = ""; 1269 my $code = "";
1270 if ($accessType eq "Method") { 1270 if ($accessType eq "Method") {
1271 $code .= <<END; 1271 $code .= <<END;
1272 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->Ge tCurrentContext()); 1272 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->Ge tCurrentContext());
1273 if (contextData && contextData->activityLogger()) { 1273 if (contextData && contextData->activityLogger()) {
1274 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); 1274 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args);
1275 contextData->activityLogger()->log("${visibleInterfaceName}.${propertyNa me}", args.Length(), loggerArgs.data(), "${accessType}"); 1275 contextData->activityLogger()->log("${interfaceName}.${propertyName}", a rgs.Length(), loggerArgs.data(), "${accessType}");
1276 } 1276 }
1277 END 1277 END
1278 } elsif ($accessType eq "Setter") { 1278 } elsif ($accessType eq "Setter") {
1279 $code .= <<END; 1279 $code .= <<END;
1280 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext()); 1280 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext());
1281 if (contextData && contextData->activityLogger()) { 1281 if (contextData && contextData->activityLogger()) {
1282 v8::Handle<v8::Value> loggerArg[] = { value }; 1282 v8::Handle<v8::Value> loggerArg[] = { value };
1283 contextData->activityLogger()->log("${visibleInterfaceName}.${propertyNa me}", 1, &loggerArg[0], "${accessType}"); 1283 contextData->activityLogger()->log("${interfaceName}.${propertyName}", 1 , &loggerArg[0], "${accessType}");
1284 } 1284 }
1285 END 1285 END
1286 } elsif ($accessType eq "Getter") { 1286 } elsif ($accessType eq "Getter") {
1287 $code .= <<END; 1287 $code .= <<END;
1288 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext()); 1288 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext());
1289 if (contextData && contextData->activityLogger()) 1289 if (contextData && contextData->activityLogger())
1290 contextData->activityLogger()->log("${visibleInterfaceName}.${propertyNa me}", 0, 0, "${accessType}"); 1290 contextData->activityLogger()->log("${interfaceName}.${propertyName}", 0 , 0, "${accessType}");
1291 END 1291 END
1292 } else { 1292 } else {
1293 die "Unrecognized activity logging access type"; 1293 die "Unrecognized activity logging access type";
1294 } 1294 }
1295 1295
1296 return $code; 1296 return $code;
1297 } 1297 }
1298 1298
1299 sub GenerateNormalAttrGetterCallback 1299 sub GenerateNormalAttrGetterCallback
1300 { 1300 {
(...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after
3666 $code .= " desc->InstanceTemplate()->MarkAsUndetectable();\n"; 3666 $code .= " desc->InstanceTemplate()->MarkAsUndetectable();\n";
3667 } 3667 }
3668 return $code; 3668 return $code;
3669 } 3669 }
3670 3670
3671 sub GenerateImplementation 3671 sub GenerateImplementation
3672 { 3672 {
3673 my $object = shift; 3673 my $object = shift;
3674 my $interface = shift; 3674 my $interface = shift;
3675 my $interfaceName = $interface->name; 3675 my $interfaceName = $interface->name;
3676 my $visibleInterfaceName = GetVisibleInterfaceName($interface);
3677 my $implClassName = GetImplName($interface); 3676 my $implClassName = GetImplName($interface);
3678 my $v8ClassName = GetV8ClassName($interface); 3677 my $v8ClassName = GetV8ClassName($interface);
3679 my $nativeType = GetNativeTypeForConversions($interface); 3678 my $nativeType = GetNativeTypeForConversions($interface);
3680 3679
3681 AddToImplIncludes("bindings/v8/V8Binding.h"); 3680 AddToImplIncludes("bindings/v8/V8Binding.h");
3682 AddToImplIncludes("bindings/v8/V8DOMWrapper.h"); 3681 AddToImplIncludes("bindings/v8/V8DOMWrapper.h");
3683 AddToImplIncludes("core/dom/ContextFeatures.h"); 3682 AddToImplIncludes("core/dom/ContextFeatures.h");
3684 AddToImplIncludes("core/dom/Document.h"); 3683 AddToImplIncludes("core/dom/Document.h");
3685 AddToImplIncludes("RuntimeEnabledFeatures.h"); 3684 AddToImplIncludes("RuntimeEnabledFeatures.h");
3686 3685
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
4031 END 4030 END
4032 if ($interface->extendedAttributes->{"EnabledAtRuntime"}) { 4031 if ($interface->extendedAttributes->{"EnabledAtRuntime"}) {
4033 my $enable_function = GetRuntimeEnableFunctionName($interface); 4032 my $enable_function = GetRuntimeEnableFunctionName($interface);
4034 $code .= <<END; 4033 $code .= <<END;
4035 if (!${enable_function}()) 4034 if (!${enable_function}())
4036 defaultSignature = V8DOMConfiguration::configureTemplate(desc, \"\", $pa rentClassTemplate, ${v8ClassName}::internalFieldCount, 0, 0, 0, 0, isolate, curr entWorldType); 4035 defaultSignature = V8DOMConfiguration::configureTemplate(desc, \"\", $pa rentClassTemplate, ${v8ClassName}::internalFieldCount, 0, 0, 0, 0, isolate, curr entWorldType);
4037 else 4036 else
4038 END 4037 END
4039 } 4038 }
4040 $code .= <<END; 4039 $code .= <<END;
4041 defaultSignature = V8DOMConfiguration::configureTemplate(desc, \"${visibleIn terfaceName}\", $parentClassTemplate, ${v8ClassName}::internalFieldCount, 4040 defaultSignature = V8DOMConfiguration::configureTemplate(desc, \"${interface Name}\", $parentClassTemplate, ${v8ClassName}::internalFieldCount,
4042 END 4041 END
4043 # Set up our attributes if we have them 4042 # Set up our attributes if we have them
4044 if ($has_attributes) { 4043 if ($has_attributes) {
4045 $code .= <<END; 4044 $code .= <<END;
4046 ${v8ClassName}Attrs, WTF_ARRAY_LENGTH(${v8ClassName}Attrs), 4045 ${v8ClassName}Attrs, WTF_ARRAY_LENGTH(${v8ClassName}Attrs),
4047 END 4046 END
4048 } else { 4047 } else {
4049 $code .= <<END; 4048 $code .= <<END;
4050 0, 0, 4049 0, 0,
4051 END 4050 END
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
5832 sub ExtendedAttributeContains 5831 sub ExtendedAttributeContains
5833 { 5832 {
5834 my $callWith = shift; 5833 my $callWith = shift;
5835 return 0 unless $callWith; 5834 return 0 unless $callWith;
5836 my $keyword = shift; 5835 my $keyword = shift;
5837 5836
5838 my @callWithKeywords = split /\s*\|\s*/, $callWith; 5837 my @callWithKeywords = split /\s*\|\s*/, $callWith;
5839 return grep { $_ eq $keyword } @callWithKeywords; 5838 return grep { $_ eq $keyword } @callWithKeywords;
5840 } 5839 }
5841 5840
5842 # FIXME: This is backwards. We currently name the interface and the IDL files wi th the implementation name. We
5843 # should use the real interface name in the IDL files and then use ImplementedAs to map this to the implementation name.
5844 sub GetVisibleInterfaceName
5845 {
5846 my $interface = shift;
5847 my $interfaceName = $interface->extendedAttributes->{"InterfaceName"};
5848 return $interfaceName ? $interfaceName : $interface->name;
5849 }
5850
5851 sub InheritsInterface 5841 sub InheritsInterface
5852 { 5842 {
5853 my $interface = shift; 5843 my $interface = shift;
5854 my $interfaceName = shift; 5844 my $interfaceName = shift;
5855 my $found = 0; 5845 my $found = 0;
5856 5846
5857 return 1 if $interfaceName eq $interface->name; 5847 return 1 if $interfaceName eq $interface->name;
5858 ForAllParents($interface, sub { 5848 ForAllParents($interface, sub {
5859 my $currentInterface = shift; 5849 my $currentInterface = shift;
5860 if ($currentInterface->name eq $interfaceName) { 5850 if ($currentInterface->name eq $interfaceName) {
(...skipping 17 matching lines...) Expand all
5878 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 5868 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
5879 $found = 1; 5869 $found = 1;
5880 } 5870 }
5881 return 1 if $found; 5871 return 1 if $found;
5882 }, 0); 5872 }, 0);
5883 5873
5884 return $found; 5874 return $found;
5885 } 5875 }
5886 5876
5887 1; 5877 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/IDLAttributes.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698