OLD | NEW |
---|---|
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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 if ($interface->extendedAttributes->{"CustomCall"}) { | 770 if ($interface->extendedAttributes->{"CustomCall"}) { |
771 push(@headerContent, " static v8::Handle<v8::Value> callAsFunctionCal lback(const v8::Arguments&);\n"); | 771 push(@headerContent, " static v8::Handle<v8::Value> callAsFunctionCal lback(const v8::Arguments&);\n"); |
772 } | 772 } |
773 if ($interface->name eq "Location") { | 773 if ($interface->name eq "Location") { |
774 push(@headerContent, " static v8::Handle<v8::Value> assignAttrGetterC ustom(v8::Local<v8::String> name, const v8::AccessorInfo&);\n"); | 774 push(@headerContent, " static v8::Handle<v8::Value> assignAttrGetterC ustom(v8::Local<v8::String> name, const v8::AccessorInfo&);\n"); |
775 push(@headerContent, " static v8::Handle<v8::Value> reloadAttrGetterC ustom(v8::Local<v8::String> name, const v8::AccessorInfo&);\n"); | 775 push(@headerContent, " static v8::Handle<v8::Value> reloadAttrGetterC ustom(v8::Local<v8::String> name, const v8::AccessorInfo&);\n"); |
776 push(@headerContent, " static v8::Handle<v8::Value> replaceAttrGetter Custom(v8::Local<v8::String> name, const v8::AccessorInfo&);\n"); | 776 push(@headerContent, " static v8::Handle<v8::Value> replaceAttrGetter Custom(v8::Local<v8::String> name, const v8::AccessorInfo&);\n"); |
777 } | 777 } |
778 } | 778 } |
779 | 779 |
780 sub HasActivityLogging | |
781 { | |
782 my $forMainWorldSuffix = shift; | |
783 my $attrExt = shift; | |
784 my $access = shift; | |
785 | |
786 if (!$attrExt->{"ActivityLog"}) { | |
787 return 0; | |
788 } | |
789 my $logAllAccess = ($attrExt->{"ActivityLog"} =~ /^Access/); | |
790 my $logGetter = ($attrExt->{"ActivityLog"} =~ /^Getter/); | |
791 my $logSetter = ($attrExt->{"ActivityLog"} =~ /^Setter/); | |
792 my $logOnlyIsolatedWorlds = ($attrExt->{"ActivityLog"} =~ /ForIsolatedWorlds $/); | |
793 | |
794 if ($logOnlyIsolatedWorlds && $forMainWorldSuffix eq "ForMainWorld") { | |
795 return 0; | |
796 } | |
797 return $logAllAccess || ($logGetter && $access eq "Getter") || ($logSetter & & $access eq "Setter"); | |
798 } | |
799 | |
780 sub IsConstructable | 800 sub IsConstructable |
781 { | 801 { |
782 my $interface = shift; | 802 my $interface = shift; |
783 | 803 |
784 return $interface->extendedAttributes->{"CustomConstructor"} || $interface-> extendedAttributes->{"Constructor"} || $interface->extendedAttributes->{"Constru ctorTemplate"}; | 804 return $interface->extendedAttributes->{"CustomConstructor"} || $interface-> extendedAttributes->{"Constructor"} || $interface->extendedAttributes->{"Constru ctorTemplate"}; |
785 } | 805 } |
786 | 806 |
787 sub HasCustomConstructor | 807 sub HasCustomConstructor |
788 { | 808 { |
789 my $interface = shift; | 809 my $interface = shift; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
913 my $measureAs = shift; | 933 my $measureAs = shift; |
914 | 934 |
915 if ($measureAs) { | 935 if ($measureAs) { |
916 AddToImplIncludes("FeatureObserver.h"); | 936 AddToImplIncludes("FeatureObserver.h"); |
917 return " FeatureObserver::observe(activeDOMWindow(BindingState::insta nce()), FeatureObserver::${measureAs});\n"; | 937 return " FeatureObserver::observe(activeDOMWindow(BindingState::insta nce()), FeatureObserver::${measureAs});\n"; |
918 } | 938 } |
919 | 939 |
920 return ""; | 940 return ""; |
921 } | 941 } |
922 | 942 |
943 sub GenerateActivityLogging | |
944 { | |
945 my $accessType = shift; | |
946 my $interface = shift; | |
947 my $propertyName = shift; | |
948 | |
949 my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interfac e); | |
950 | |
951 AddToImplIncludes("V8Binding.h"); | |
952 AddToImplIncludes("V8DOMActivityLogger.h"); | |
953 AddToImplIncludes("wtf/Vector.h"); | |
954 | |
955 my $content = ""; | |
haraken
2013/04/11 00:59:16
Nit: Remove this.
ulfar
2013/04/11 03:25:15
Done.
| |
956 if ($accessType eq "Method") { | |
957 push(@implContentInternals, <<END); | |
958 V8DOMActivityLogger* logger = V8PerContextData::from(v8::Context::GetCurrent ())->activityLogger(); | |
959 if (logger) { | |
960 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments<v8::Hand le<v8::Value> >(args); | |
961 logger->log("${visibleInterfaceName}.${propertyName}", args.Length(), lo ggerArgs.data(), "${accessType}"); | |
962 } | |
963 END | |
964 } elsif ($accessType eq "Setter") { | |
965 push(@implContentInternals, <<END); | |
966 V8DOMActivityLogger* logger = V8PerContextData::from(v8::Context::GetCurrent ())->activityLogger(); | |
967 if (logger) { | |
968 v8::Handle<v8::Value> loggerArg[] = { value }; | |
969 logger->log("${visibleInterfaceName}.${propertyName}", 1, &loggerArg[0], "${accessType}"); | |
970 } | |
971 END | |
972 } elsif ($accessType eq "Getter") { | |
973 push(@implContentInternals, <<END); | |
974 V8DOMActivityLogger* logger = V8PerContextData::from(v8::Context::GetCurrent ())->activityLogger(); | |
975 if (logger) | |
976 logger->log("${visibleInterfaceName}.${propertyName}", 0, 0, "${accessTy pe}"); | |
977 END | |
978 } else { | |
979 die "Unrecognized activity logging access type"; | |
980 } | |
981 } | |
982 | |
923 sub GenerateNormalAttrGetterCallback | 983 sub GenerateNormalAttrGetterCallback |
924 { | 984 { |
925 my $attribute = shift; | 985 my $attribute = shift; |
926 my $interface = shift; | 986 my $interface = shift; |
927 my $forMainWorldSuffix = shift; | 987 my $forMainWorldSuffix = shift; |
928 | 988 |
929 my $interfaceName = $interface->name; | 989 my $interfaceName = $interface->name; |
930 my $v8InterfaceName = "V8$interfaceName"; | 990 my $v8InterfaceName = "V8$interfaceName"; |
931 my $attrExt = $attribute->signature->extendedAttributes; | 991 my $attrExt = $attribute->signature->extendedAttributes; |
932 my $attrName = $attribute->signature->name; | 992 my $attrName = $attribute->signature->name; |
933 | 993 |
934 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute ->signature); | 994 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute ->signature); |
935 push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalS tring; | 995 push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalS tring; |
936 | 996 |
937 push(@implContentInternals, "static v8::Handle<v8::Value> ${attrName}AttrGet terCallback${forMainWorldSuffix}(v8::Local<v8::String> name, const v8::AccessorI nfo& info)\n"); | 997 push(@implContentInternals, "static v8::Handle<v8::Value> ${attrName}AttrGet terCallback${forMainWorldSuffix}(v8::Local<v8::String> name, const v8::AccessorI nfo& info)\n"); |
938 push(@implContentInternals, "{\n"); | 998 push(@implContentInternals, "{\n"); |
939 push(@implContentInternals, GenerateFeatureObservation($attrExt->{"MeasureAs "})); | 999 push(@implContentInternals, GenerateFeatureObservation($attrExt->{"MeasureAs "})); |
1000 if (HasActivityLogging($forMainWorldSuffix, $attrExt, "Getter")) { | |
1001 GenerateActivityLogging("Getter", $interface, "${attrName}"); | |
1002 } | |
940 if (HasCustomGetter($attrExt)) { | 1003 if (HasCustomGetter($attrExt)) { |
941 push(@implContentInternals, " return ${v8InterfaceName}::${attrName}A ttrGetterCustom(name, info);\n"); | 1004 push(@implContentInternals, " return ${v8InterfaceName}::${attrName}A ttrGetterCustom(name, info);\n"); |
942 } else { | 1005 } else { |
943 push(@implContentInternals, " return ${interfaceName}V8Internal::${at trName}AttrGetter${forMainWorldSuffix}(name, info);\n"); | 1006 push(@implContentInternals, " return ${interfaceName}V8Internal::${at trName}AttrGetter${forMainWorldSuffix}(name, info);\n"); |
944 } | 1007 } |
945 push(@implContentInternals, "}\n\n"); | 1008 push(@implContentInternals, "}\n\n"); |
946 push(@implContentInternals, "#endif // ${conditionalString}\n\n") if $condit ionalString; | 1009 push(@implContentInternals, "#endif // ${conditionalString}\n\n") if $condit ionalString; |
947 } | 1010 } |
948 | 1011 |
949 sub GenerateNormalAttrGetter | 1012 sub GenerateNormalAttrGetter |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1220 } | 1283 } |
1221 | 1284 |
1222 sub GenerateReplaceableAttrSetterCallback | 1285 sub GenerateReplaceableAttrSetterCallback |
1223 { | 1286 { |
1224 my $interface = shift; | 1287 my $interface = shift; |
1225 my $interfaceName = $interface->name; | 1288 my $interfaceName = $interface->name; |
1226 | 1289 |
1227 push(@implContentInternals, "static void ${interfaceName}ReplaceableAttrSett erCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::Acc essorInfo& info)\n"); | 1290 push(@implContentInternals, "static void ${interfaceName}ReplaceableAttrSett erCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::Acc essorInfo& info)\n"); |
1228 push(@implContentInternals, "{\n"); | 1291 push(@implContentInternals, "{\n"); |
1229 push(@implContentInternals, GenerateFeatureObservation($interface->extendedA ttributes->{"MeasureAs"})); | 1292 push(@implContentInternals, GenerateFeatureObservation($interface->extendedA ttributes->{"MeasureAs"})); |
1293 if (HasActivityLogging("", $interface->extendedAttributes, "Setter")) { | |
1294 die "IDL error: ActivityLog attribute cannot exist on a ReplacableAttrS etterCallback"; | |
1295 } | |
1230 push(@implContentInternals, " return ${interfaceName}V8Internal::${interf aceName}ReplaceableAttrSetter(name, value, info);\n"); | 1296 push(@implContentInternals, " return ${interfaceName}V8Internal::${interf aceName}ReplaceableAttrSetter(name, value, info);\n"); |
1231 push(@implContentInternals, "}\n\n"); | 1297 push(@implContentInternals, "}\n\n"); |
1232 } | 1298 } |
1233 | 1299 |
1234 sub GenerateReplaceableAttrSetter | 1300 sub GenerateReplaceableAttrSetter |
1235 { | 1301 { |
1236 my $interface = shift; | 1302 my $interface = shift; |
1237 my $interfaceName = $interface->name; | 1303 my $interfaceName = $interface->name; |
1238 | 1304 |
1239 push(@implContentInternals, <<END); | 1305 push(@implContentInternals, <<END); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1285 my $v8InterfaceName = "V8$interfaceName"; | 1351 my $v8InterfaceName = "V8$interfaceName"; |
1286 my $attrExt = $attribute->signature->extendedAttributes; | 1352 my $attrExt = $attribute->signature->extendedAttributes; |
1287 my $attrName = $attribute->signature->name; | 1353 my $attrName = $attribute->signature->name; |
1288 | 1354 |
1289 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute ->signature); | 1355 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute ->signature); |
1290 push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalS tring; | 1356 push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalS tring; |
1291 | 1357 |
1292 push(@implContentInternals, "static void ${attrName}AttrSetterCallback${forM ainWorldSuffix}(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8 ::AccessorInfo& info)\n"); | 1358 push(@implContentInternals, "static void ${attrName}AttrSetterCallback${forM ainWorldSuffix}(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8 ::AccessorInfo& info)\n"); |
1293 push(@implContentInternals, "{\n"); | 1359 push(@implContentInternals, "{\n"); |
1294 push(@implContentInternals, GenerateFeatureObservation($attrExt->{"MeasureAs "})); | 1360 push(@implContentInternals, GenerateFeatureObservation($attrExt->{"MeasureAs "})); |
1361 if (HasActivityLogging($forMainWorldSuffix, $attrExt, "Setter")) { | |
1362 GenerateActivityLogging("Setter", $interface, "${attrName}"); | |
1363 } | |
1295 if (HasCustomSetter($attrExt)) { | 1364 if (HasCustomSetter($attrExt)) { |
1296 push(@implContentInternals, " ${v8InterfaceName}::${attrName}AttrSett erCustom(name, value, info);\n"); | 1365 push(@implContentInternals, " ${v8InterfaceName}::${attrName}AttrSett erCustom(name, value, info);\n"); |
1297 } else { | 1366 } else { |
1298 push(@implContentInternals, " ${interfaceName}V8Internal::${attrName} AttrSetter${forMainWorldSuffix}(name, value, info);\n"); | 1367 push(@implContentInternals, " ${interfaceName}V8Internal::${attrName} AttrSetter${forMainWorldSuffix}(name, value, info);\n"); |
1299 } | 1368 } |
1300 push(@implContentInternals, "}\n\n"); | 1369 push(@implContentInternals, "}\n\n"); |
1301 push(@implContentInternals, "#endif // ${conditionalString}\n\n") if $condit ionalString; | 1370 push(@implContentInternals, "#endif // ${conditionalString}\n\n") if $condit ionalString; |
1302 } | 1371 } |
1303 | 1372 |
1304 sub GenerateNormalAttrSetter | 1373 sub GenerateNormalAttrSetter |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1625 my $v8InterfaceName = "V8$interfaceName"; | 1694 my $v8InterfaceName = "V8$interfaceName"; |
1626 my $name = $function->signature->name; | 1695 my $name = $function->signature->name; |
1627 | 1696 |
1628 my $conditionalString = $codeGenerator->GenerateConditionalString($function- >signature); | 1697 my $conditionalString = $codeGenerator->GenerateConditionalString($function- >signature); |
1629 push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalS tring; | 1698 push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalS tring; |
1630 push(@implContentInternals, <<END); | 1699 push(@implContentInternals, <<END); |
1631 static v8::Handle<v8::Value> ${name}MethodCallback${forMainWorldSuffix}(const v8 ::Arguments& args) | 1700 static v8::Handle<v8::Value> ${name}MethodCallback${forMainWorldSuffix}(const v8 ::Arguments& args) |
1632 { | 1701 { |
1633 END | 1702 END |
1634 push(@implContentInternals, GenerateFeatureObservation($function->signature- >extendedAttributes->{"MeasureAs"})); | 1703 push(@implContentInternals, GenerateFeatureObservation($function->signature- >extendedAttributes->{"MeasureAs"})); |
1704 if (HasActivityLogging($forMainWorldSuffix, $function->signature->extendedAt tributes, "Access")) { | |
haraken
2013/04/11 00:59:16
Nit: "Access" => "Method" (Just for readability. T
ulfar
2013/04/11 03:25:15
I'd rather not, since this is a bit awkward. Ther
| |
1705 GenerateActivityLogging("Method", $interface, "${name}"); | |
1706 } | |
1635 if (HasCustomMethod($function->signature->extendedAttributes)) { | 1707 if (HasCustomMethod($function->signature->extendedAttributes)) { |
1636 push(@implContentInternals, " return ${v8InterfaceName}::${name}Metho dCustom(args);\n"); | 1708 push(@implContentInternals, " return ${v8InterfaceName}::${name}Metho dCustom(args);\n"); |
1637 } else { | 1709 } else { |
1638 push(@implContentInternals, " return ${interfaceName}V8Internal::${na me}Method${forMainWorldSuffix}(args);\n"); | 1710 push(@implContentInternals, " return ${interfaceName}V8Internal::${na me}Method${forMainWorldSuffix}(args);\n"); |
1639 } | 1711 } |
1640 push(@implContentInternals, "}\n\n"); | 1712 push(@implContentInternals, "}\n\n"); |
1641 push(@implContentInternals, "#endif // ${conditionalString}\n\n") if $condit ionalString; | 1713 push(@implContentInternals, "#endif // ${conditionalString}\n\n") if $condit ionalString; |
1642 } | 1714 } |
1643 | 1715 |
1644 sub GenerateFunction | 1716 sub GenerateFunction |
(...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4598 | 4670 |
4599 sub GetPassRefPtrType | 4671 sub GetPassRefPtrType |
4600 { | 4672 { |
4601 my $v8InterfaceName = shift; | 4673 my $v8InterfaceName = shift; |
4602 | 4674 |
4603 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; | 4675 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; |
4604 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; | 4676 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; |
4605 } | 4677 } |
4606 | 4678 |
4607 1; | 4679 1; |
OLD | NEW |