Chromium Code Reviews| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 # Default includes | 430 # Default includes |
| 431 if ($type eq "SerializedScriptValue") { | 431 if ($type eq "SerializedScriptValue") { |
| 432 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); | 432 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); |
| 433 } elsif ($type eq "any" || IsCallbackFunctionType($type)) { | 433 } elsif ($type eq "any" || IsCallbackFunctionType($type)) { |
| 434 AddToImplIncludes("bindings/v8/ScriptValue.h"); | 434 AddToImplIncludes("bindings/v8/ScriptValue.h"); |
| 435 } elsif ($type eq "Promise") { | 435 } elsif ($type eq "Promise") { |
| 436 AddToImplIncludes("bindings/v8/ScriptPromise.h"); | 436 AddToImplIncludes("bindings/v8/ScriptPromise.h"); |
| 437 } elsif ($type eq "EventHandler") { | 437 } elsif ($type eq "EventHandler") { |
| 438 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); | 438 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); |
| 439 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 439 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
| 440 } elsif ($type eq "Dictionary") { | |
| 441 AddToImplIncludes("bindings/v8/Dictionary.h"); | |
| 440 } elsif (IsTypedArrayType($type)) { | 442 } elsif (IsTypedArrayType($type)) { |
| 441 AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); | 443 AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); |
| 442 } elsif (my $arrayType = GetArrayType($type)) { | 444 } elsif (my $arrayType = GetArrayType($type)) { |
| 443 AddIncludesForType($arrayType); | 445 AddIncludesForType($arrayType); |
| 444 } else { | 446 } else { |
| 445 AddToImplIncludes("V8${type}.h"); | 447 AddToImplIncludes("V8${type}.h"); |
| 446 } | 448 } |
| 447 } | 449 } |
| 448 | 450 |
| 449 sub HeaderFilesForInterface | 451 sub HeaderFilesForInterface |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2593 $parameterCheckString .= " }\n"; | 2595 $parameterCheckString .= " }\n"; |
| 2594 $parameterCheckString .= " $parameterName.append(V8${argT ype}::toNative(v8::Handle<v8::Object>::Cast(info[i])));\n"; | 2596 $parameterCheckString .= " $parameterName.append(V8${argT ype}::toNative(v8::Handle<v8::Object>::Cast(info[i])));\n"; |
| 2595 $parameterCheckString .= " }\n"; | 2597 $parameterCheckString .= " }\n"; |
| 2596 } else { | 2598 } else { |
| 2597 $parameterCheckString .= " V8TRYCATCH_VOID(Vector<$nativeElem entType>, $parameterName, toNativeArguments<$nativeElementType>(info, $paramInde x));\n"; | 2599 $parameterCheckString .= " V8TRYCATCH_VOID(Vector<$nativeElem entType>, $parameterName, toNativeArguments<$nativeElementType>(info, $paramInde x));\n"; |
| 2598 } | 2600 } |
| 2599 } elsif ($nativeType =~ /^V8StringResource/) { | 2601 } elsif ($nativeType =~ /^V8StringResource/) { |
| 2600 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; | 2602 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; |
| 2601 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; | 2603 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; |
| 2602 my $stringResourceParameterName = $parameterName; | 2604 my $stringResourceParameterName = $parameterName; |
| 2603 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter- >type); | 2605 my $isNullable = IsNullableParameter($parameter); |
| 2604 if ($isNullable) { | 2606 if ($isNullable) { |
| 2605 $parameterCheckString .= " bool ${parameterName}IsNull = $jsV alue->IsNull();\n"; | 2607 $parameterCheckString .= " bool ${parameterName}IsNull = $jsV alue->IsNull();\n"; |
| 2606 $stringResourceParameterName .= "StringResource"; | 2608 $stringResourceParameterName .= "StringResource"; |
| 2607 } | 2609 } |
| 2608 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $stringResourcePa rameterName, " ", "info.GetIsolate()"); | 2610 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $stringResourcePa rameterName, " ", "info.GetIsolate()"); |
| 2609 $parameterCheckString .= " String $parameterName = $stringResourc eParameterName;\n" if $isNullable; | 2611 $parameterCheckString .= " String $parameterName = $stringResourc eParameterName;\n" if $isNullable; |
| 2610 if (IsEnumType($parameter->type)) { | 2612 if (IsEnumType($parameter->type)) { |
| 2611 my @enumValues = ValidEnumValues($parameter->type); | 2613 my @enumValues = ValidEnumValues($parameter->type); |
| 2612 my @validEqualities = (); | 2614 my @validEqualities = (); |
| 2613 foreach my $enumValue (@enumValues) { | 2615 foreach my $enumValue (@enumValues) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 2632 my $argType = $parameter->type; | 2634 my $argType = $parameter->type; |
| 2633 if (IsWrapperType($argType)) { | 2635 if (IsWrapperType($argType)) { |
| 2634 $parameterCheckString .= " if (info.Length() > $paramInde x && !isUndefinedOrNull($argValue) && !V8${argType}::hasInstance($argValue, info .GetIsolate(), worldType(info.GetIsolate()))) {\n"; | 2636 $parameterCheckString .= " if (info.Length() > $paramInde x && !isUndefinedOrNull($argValue) && !V8${argType}::hasInstance($argValue, info .GetIsolate(), worldType(info.GetIsolate()))) {\n"; |
| 2635 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma nFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n"; | 2637 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma nFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n"; |
| 2636 $parameterCheckString .= " return;\n"; | 2638 $parameterCheckString .= " return;\n"; |
| 2637 $parameterCheckString .= " }\n"; | 2639 $parameterCheckString .= " }\n"; |
| 2638 } | 2640 } |
| 2639 } | 2641 } |
| 2640 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; | 2642 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; |
| 2641 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; | 2643 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; |
| 2642 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter- >type); | 2644 my $isNullable = IsNullableParameter($parameter); |
| 2643 $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue ->IsNull();\n" if $isNullable; | 2645 $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue ->IsNull();\n" if $isNullable; |
| 2644 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $parameterName, " ", "info.GetIsolate()"); | 2646 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $parameterName, " ", "info.GetIsolate()"); |
| 2645 if ($nativeType eq 'Dictionary' or $nativeType eq 'ScriptPromise') { | 2647 if ($nativeType eq 'Dictionary' or $nativeType eq 'ScriptPromise') { |
| 2646 $parameterCheckString .= " if (!$parameterName.isUndefinedOrN ull() && !$parameterName.isObject()) {\n"; | 2648 $parameterCheckString .= " if (!$parameterName.isUndefinedOrN ull() && !$parameterName.isObject()) {\n"; |
| 2647 if ($functionName eq "Constructor") { | 2649 if ($functionName eq "Constructor") { |
| 2648 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToConstruct(\"$interfaceName\", \"parameter ${humanFriendlyIndex} ('${parameterName}') is not an object.\"), info.GetIsolate());\n"; | 2650 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToConstruct(\"$interfaceName\", \"parameter ${humanFriendlyIndex} ('${parameterName}') is not an object.\"), info.GetIsolate());\n"; |
| 2649 } else { | 2651 } else { |
| 2650 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter ${hum anFriendlyIndex} ('${parameterName}') is not an object.\"), info.GetIsolate());\ n"; | 2652 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter ${hum anFriendlyIndex} ('${parameterName}') is not an object.\"), info.GetIsolate());\ n"; |
| 2651 } | 2653 } |
| 2652 $parameterCheckString .= " return;\n"; | 2654 $parameterCheckString .= " return;\n"; |
| (...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5175 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 5177 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
| 5176 push @arguments, "$paramName->propertyReference()"; | 5178 push @arguments, "$paramName->propertyReference()"; |
| 5177 $code .= <<END; | 5179 $code .= <<END; |
| 5178 if (!$paramName) { | 5180 if (!$paramName) { |
| 5179 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }' .\"), info.GetIsolate()); | 5181 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }' .\"), info.GetIsolate()); |
| 5180 return; | 5182 return; |
| 5181 } | 5183 } |
| 5182 END | 5184 END |
| 5183 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans formList") { | 5185 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans formList") { |
| 5184 push @arguments, "$paramName.get()"; | 5186 push @arguments, "$paramName.get()"; |
| 5185 } elsif ($parameter->isNullable && !IsRefPtrType($parameter->type)) { | 5187 } elsif (IsNullableParameter($parameter)) { |
| 5186 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; | 5188 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; |
| 5187 } else { | 5189 } else { |
| 5188 push @arguments, $paramName; | 5190 push @arguments, $paramName; |
| 5189 } | 5191 } |
| 5190 $index++; | 5192 $index++; |
| 5191 $humanFriendlyIndex = $index + 1; | 5193 $humanFriendlyIndex = $index + 1; |
| 5192 } | 5194 } |
| 5193 | 5195 |
| 5194 if ($function->extendedAttributes->{"RaisesException"}) { | 5196 if ($function->extendedAttributes->{"RaisesException"}) { |
| 5195 push @arguments, "exceptionState"; | 5197 push @arguments, "exceptionState"; |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5978 my $type = shift; | 5980 my $type = shift; |
| 5979 | 5981 |
| 5980 return 0 if $type eq "any"; | 5982 return 0 if $type eq "any"; |
| 5981 return 0 if IsPrimitiveType($type); | 5983 return 0 if IsPrimitiveType($type); |
| 5982 return 0 if GetArrayType($type); | 5984 return 0 if GetArrayType($type); |
| 5983 return 0 if GetSequenceType($type); | 5985 return 0 if GetSequenceType($type); |
| 5984 return 0 if $type eq "Promise"; | 5986 return 0 if $type eq "Promise"; |
| 5985 return 0 if IsCallbackFunctionType($type); | 5987 return 0 if IsCallbackFunctionType($type); |
| 5986 return 0 if IsEnumType($type); | 5988 return 0 if IsEnumType($type); |
| 5987 return 0 if IsUnionType($type); | 5989 return 0 if IsUnionType($type); |
| 5990 return 0 if $type eq "Dictionary"; | |
| 5988 | 5991 |
| 5989 return 1; | 5992 return 1; |
| 5990 } | 5993 } |
| 5991 | 5994 |
| 5995 sub IsNullableParameter | |
| 5996 { | |
| 5997 my $parameter = shift; | |
| 5998 | |
| 5999 return $parameter->isNullable && !IsRefPtrType($parameter->type) && $paramet er->type ne "Dictionary"; | |
|
haraken
2013/11/19 11:12:05
You won't need to check '$parameter->type ne "Dict
alancutter (OOO until 2018)
2013/11/19 23:43:47
Without '$parameter->type ne "Dictionary"' it will
| |
| 6000 } | |
| 6001 | |
| 5992 sub GetSVGTypeNeedingTearOff | 6002 sub GetSVGTypeNeedingTearOff |
| 5993 { | 6003 { |
| 5994 my $type = shift; | 6004 my $type = shift; |
| 5995 | 6005 |
| 5996 return $svgTypeNeedingTearOff{$type} if exists $svgTypeNeedingTearOff{$type} ; | 6006 return $svgTypeNeedingTearOff{$type} if exists $svgTypeNeedingTearOff{$type} ; |
| 5997 return undef; | 6007 return undef; |
| 5998 } | 6008 } |
| 5999 | 6009 |
| 6000 sub GetSVGWrappedTypeNeedingTearOff | 6010 sub GetSVGWrappedTypeNeedingTearOff |
| 6001 { | 6011 { |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6310 my $interface = shift; | 6320 my $interface = shift; |
| 6311 | 6321 |
| 6312 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6322 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6313 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6323 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6314 return 1 if InheritsInterface($interface, "Document"); | 6324 return 1 if InheritsInterface($interface, "Document"); |
| 6315 | 6325 |
| 6316 return 0; | 6326 return 0; |
| 6317 } | 6327 } |
| 6318 | 6328 |
| 6319 1; | 6329 1; |
| OLD | NEW |