| Index: Source/bindings/scripts/CodeGeneratorV8.pm
|
| diff --git a/Source/bindings/scripts/CodeGeneratorV8.pm b/Source/bindings/scripts/CodeGeneratorV8.pm
|
| index 1bbf3af35708283cbfc60e91d2d742b667354555..d5c0c3ade437766adfff6adad502395ab52c51bc 100644
|
| --- a/Source/bindings/scripts/CodeGeneratorV8.pm
|
| +++ b/Source/bindings/scripts/CodeGeneratorV8.pm
|
| @@ -798,6 +798,26 @@ sub GenerateHeaderCustomCall
|
| }
|
| }
|
|
|
| +sub HasActivityLogging
|
| +{
|
| + my $forMainWorldSuffix = shift;
|
| + my $attrExt = shift;
|
| + my $access = shift;
|
| +
|
| + if (!$attrExt->{"ActivityLog"}) {
|
| + return 0;
|
| + }
|
| + my $logAllAccess = ($attrExt->{"ActivityLog"} =~ /^Access/);
|
| + my $logGetter = ($attrExt->{"ActivityLog"} =~ /^Getter/);
|
| + my $logSetter = ($attrExt->{"ActivityLog"} =~ /^Setter/);
|
| + my $logOnlyIsolatedWorlds = ($attrExt->{"ActivityLog"} =~ /ForIsolatedWorlds$/);
|
| +
|
| + if ($logOnlyIsolatedWorlds && $forMainWorldSuffix eq "ForMainWorld") {
|
| + return 0;
|
| + }
|
| + return $logAllAccess || ($logGetter && $access eq "Getter") || ($logSetter && $access eq "Setter");
|
| +}
|
| +
|
| sub IsConstructable
|
| {
|
| my $interface = shift;
|
| @@ -943,6 +963,48 @@ sub GenerateFeatureObservation
|
| return "";
|
| }
|
|
|
| +sub GenerateActivityLogging
|
| +{
|
| + my $accessType = shift;
|
| + my $interface = shift;
|
| + my $propertyName = shift;
|
| +
|
| + my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
|
| +
|
| + AddToImplIncludes("V8Binding.h");
|
| + AddToImplIncludes("V8DOMActivityLogger.h");
|
| + AddToImplIncludes("wtf/Vector.h");
|
| +
|
| + my $code = "";
|
| + if ($accessType eq "Method") {
|
| + $code .= <<END;
|
| + V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->GetCurrentContext());
|
| + if (contextData && contextData->activityLogger()) {
|
| + Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args);
|
| + contextData->activityLogger()->log("${visibleInterfaceName}.${propertyName}", args.Length(), loggerArgs.data(), "${accessType}");
|
| + }
|
| +END
|
| + } elsif ($accessType eq "Setter") {
|
| + $code .= <<END;
|
| + V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
|
| + if (contextData && contextData->activityLogger()) {
|
| + v8::Handle<v8::Value> loggerArg[] = { value };
|
| + contextData->activityLogger()->log("${visibleInterfaceName}.${propertyName}", 1, &loggerArg[0], "${accessType}");
|
| + }
|
| +END
|
| + } elsif ($accessType eq "Getter") {
|
| + $code .= <<END;
|
| + V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
|
| + if (contextData && contextData->activityLogger())
|
| + contextData->activityLogger()->log("${visibleInterfaceName}.${propertyName}", 0, 0, "${accessType}");
|
| +END
|
| + } else {
|
| + die "Unrecognized activity logging access type";
|
| + }
|
| +
|
| + return $code;
|
| +}
|
| +
|
| sub GenerateNormalAttrGetterCallback
|
| {
|
| my $attribute = shift;
|
| @@ -961,6 +1023,9 @@ sub GenerateNormalAttrGetterCallback
|
| $code .= "static v8::Handle<v8::Value> ${attrName}AttrGetterCallback${forMainWorldSuffix}(v8::Local<v8::String> name, const v8::AccessorInfo& info)\n";
|
| $code .= "{\n";
|
| $code .= GenerateFeatureObservation($attrExt->{"MeasureAs"});
|
| + if (HasActivityLogging($forMainWorldSuffix, $attrExt, "Getter")) {
|
| + $code .= GenerateActivityLogging("Getter", $interface, "${attrName}");
|
| + }
|
| if (HasCustomGetter($attrExt)) {
|
| $code .= " return ${v8InterfaceName}::${attrName}AttrGetterCustom(name, info);\n";
|
| } else {
|
| @@ -1265,6 +1330,9 @@ sub GenerateReplaceableAttrSetterCallback
|
| $code .= "static void ${interfaceName}ReplaceableAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n";
|
| $code .= "{\n";
|
| $code .= GenerateFeatureObservation($interface->extendedAttributes->{"MeasureAs"});
|
| + if (HasActivityLogging("", $interface->extendedAttributes, "Setter")) {
|
| + die "IDL error: ActivityLog attribute cannot exist on a ReplacableAttrSetterCallback";
|
| + }
|
| $code .= " return ${interfaceName}V8Internal::${interfaceName}ReplaceableAttrSetter(name, value, info);\n";
|
| $code .= "}\n\n";
|
| AddToImplContentInternals($code);
|
| @@ -1335,6 +1403,9 @@ sub GenerateNormalAttrSetterCallback
|
| $code .= "static void ${attrName}AttrSetterCallback${forMainWorldSuffix}(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n";
|
| $code .= "{\n";
|
| $code .= GenerateFeatureObservation($attrExt->{"MeasureAs"});
|
| + if (HasActivityLogging($forMainWorldSuffix, $attrExt, "Setter")) {
|
| + $code .= GenerateActivityLogging("Setter", $interface, "${attrName}");
|
| + }
|
| if (HasCustomSetter($attrExt)) {
|
| $code .= " ${v8InterfaceName}::${attrName}AttrSetterCustom(name, value, info);\n";
|
| } else {
|
| @@ -1684,6 +1755,9 @@ static v8::Handle<v8::Value> ${name}MethodCallback${forMainWorldSuffix}(const v8
|
| {
|
| END
|
| $code .= GenerateFeatureObservation($function->signature->extendedAttributes->{"MeasureAs"});
|
| + if (HasActivityLogging($forMainWorldSuffix, $function->signature->extendedAttributes, "Access")) {
|
| + $code .= GenerateActivityLogging("Method", $interface, "${name}");
|
| + }
|
| if (HasCustomMethod($function->signature->extendedAttributes)) {
|
| $code .= " return ${v8InterfaceName}::${name}MethodCustom(args);\n";
|
| } else {
|
|
|