Chromium Code Reviews| Index: Source/bindings/scripts/CodeGeneratorV8.pm |
| diff --git a/Source/bindings/scripts/CodeGeneratorV8.pm b/Source/bindings/scripts/CodeGeneratorV8.pm |
| index a241974bed4a053dc83c13eacccb7f5381ad010f..9423ab233c0ffdff8851e384405e0978df4b17b1 100644 |
| --- a/Source/bindings/scripts/CodeGeneratorV8.pm |
| +++ b/Source/bindings/scripts/CodeGeneratorV8.pm |
| @@ -8,6 +8,7 @@ |
| # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| # Copyright (C) 2012 Ericsson AB. All rights reserved. |
| +# Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| # |
| # This library is free software; you can redistribute it and/or |
| # modify it under the terms of the GNU Library General Public |
| @@ -1656,7 +1657,7 @@ sub GenerateParametersCheckExpression |
| if ($parameter->extendedAttributes->{"StrictTypeChecking"}) { |
| push(@andExpression, "(${value}->IsNull() || ${value}->IsUndefined() || ${value}->IsString() || ${value}->IsObject())"); |
| } |
| - } elsif ($parameter->extendedAttributes->{"Callback"}) { |
| + } elsif (IsCallbackInterface($parameter->type)) { |
| # For Callbacks only checks if the value is null or object. |
| push(@andExpression, "(${value}->IsNull() || ${value}->IsFunction())"); |
| } elsif ($codeGenerator->GetArrayType($type) || $codeGenerator->GetSequenceType($type)) { |
| @@ -1901,7 +1902,7 @@ END |
| my $raisesExceptions = $function->signature->extendedAttributes->{"RaisesException"}; |
| if (!$raisesExceptions) { |
| foreach my $parameter (@{$function->parameters}) { |
| - if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { |
| + if ((!IsCallbackInterface($parameter->type) and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { |
| $raisesExceptions = 1; |
| } |
| } |
| @@ -2024,7 +2025,7 @@ sub GenerateParametersCheck |
| # Optional arguments without [Default=...] should generate an early call with fewer arguments. |
| # Optional arguments with [Optional=...] should not generate the early call. |
| # Optional Dictionary arguments always considered to have default of empty dictionary. |
| - if ($parameter->isOptional && !$parameter->extendedAttributes->{"Default"} && $nativeType ne "Dictionary" && !$parameter->extendedAttributes->{"Callback"}) { |
| + if ($parameter->isOptional && !$parameter->extendedAttributes->{"Default"} && $nativeType ne "Dictionary" && !IsCallbackInterface($parameter->type)) { |
| $parameterCheckString .= " if (args.Length() <= $paramIndex) {\n"; |
| my $functionCall = GenerateFunctionCallString($function, $paramIndex, " " x 2, $interfaceName, $forMainWorldSuffix, %replacements); |
| $parameterCheckString .= $functionCall; |
| @@ -2045,7 +2046,7 @@ sub GenerateParametersCheck |
| } |
| AddToImplIncludes("ExceptionCode.h"); |
| - if ($parameter->extendedAttributes->{"Callback"}) { |
| + if (IsCallbackInterface($parameter->type)) { |
| my $v8InterfaceName = "V8" . $parameter->type; |
| AddToImplIncludes("$v8InterfaceName.h"); |
| if ($parameter->isOptional) { |
| @@ -2229,7 +2230,7 @@ sub GenerateSingleConstructorCallback |
| } |
| if (!$raisesExceptions) { |
| foreach my $parameter (@{$function->parameters}) { |
| - if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { |
| + if ((!IsCallbackInterface($parameter->type) and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { |
| $raisesExceptions = 1; |
| } |
| } |
| @@ -2454,7 +2455,7 @@ sub GenerateNamedConstructor |
| } |
| if (!$raisesExceptions) { |
| foreach my $parameter (@{$function->parameters}) { |
| - if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { |
| + if ((!IsCallbackInterface($parameter->type) and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { |
| $raisesExceptions = 1; |
| } |
| } |
| @@ -4594,7 +4595,7 @@ sub RequiresCustomSignature |
| return 0; |
| } |
| foreach my $parameter (@{$function->parameters}) { |
| - if (($parameter->isOptional && !$parameter->extendedAttributes->{"Default"}) || $parameter->extendedAttributes->{"Callback"}) { |
| + if (($parameter->isOptional && !$parameter->extendedAttributes->{"Default"}) || IsCallbackInterface($parameter->type)) { |
| return 0; |
| } |
| } |
| @@ -4646,6 +4647,16 @@ sub IsWrapperType |
| return !($non_wrapper_types{$type}); |
| } |
| +sub IsCallbackInterface |
| +{ |
| + my $type = shift; |
| + return 0 unless IsWrapperType($type); |
| + return 0 if $codeGenerator->GetArrayType($type); |
| + return 0 if $codeGenerator->GetSequenceType($type); |
|
haraken
2013/04/26 18:03:36
I'm OK to land the patch with this, but I think Is
do-not-use
2013/04/26 18:15:57
Yes, I saw but I did not want to be too greedy and
|
| + |
| + return $codeGenerator->IsCallbackInterfaceFromFile($type); |
| +} |
| + |
| sub GetTypeNameOfExternalTypedArray |
| { |
| my $interface = shift; |