| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 # Conditional ... #if FEATURE ... #endif (to be removed soon) | 145 # Conditional ... #if FEATURE ... #endif (to be removed soon) |
| 146 # Includes | 146 # Includes |
| 147 # NameSpaceWebCore | 147 # NameSpaceWebCore |
| 148 # NameSpaceInternal ... namespace ${implClassName}V8Internal in case of no
n-callback | 148 # NameSpaceInternal ... namespace ${implClassName}V8Internal in case of no
n-callback |
| 149 my %implementation; | 149 my %implementation; |
| 150 | 150 |
| 151 # Promise is not yet in the Web IDL spec but is going to be speced | 151 # Promise is not yet in the Web IDL spec but is going to be speced |
| 152 # as primitive types in the future. | 152 # as primitive types in the future. |
| 153 # Since V8 dosn't provide Promise primitive object currently, | 153 # Since V8 dosn't provide Promise primitive object currently, |
| 154 # primitiveTypeHash doesn't contain Promise. | 154 # primitiveTypeHash doesn't contain Promise. |
| 155 my %primitiveTypeHash = ("boolean" => 1, | 155 my %primitiveTypeHash = ("Date" => 1, |
| 156 "DOMString" => 1, |
| 157 "DOMTimeStamp" => 1, # typedef unsigned long long |
| 158 "boolean" => 1, |
| 156 "void" => 1, | 159 "void" => 1, |
| 157 "Date" => 1, | |
| 158 "byte" => 1, | 160 "byte" => 1, |
| 159 "octet" => 1, | 161 "octet" => 1, |
| 160 "short" => 1, | 162 "short" => 1, |
| 161 "long" => 1, | 163 "long" => 1, |
| 162 "long long" => 1, | 164 "long long" => 1, |
| 163 "unsigned short" => 1, | 165 "unsigned short" => 1, |
| 164 "unsigned long" => 1, | 166 "unsigned long" => 1, |
| 165 "unsigned long long" => 1, | 167 "unsigned long long" => 1, |
| 166 "float" => 1, | 168 "float" => 1, |
| 167 "double" => 1, | 169 "double" => 1, |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 409 } |
| 408 } | 410 } |
| 409 | 411 |
| 410 sub SkipIncludeHeader | 412 sub SkipIncludeHeader |
| 411 { | 413 { |
| 412 my $type = shift; | 414 my $type = shift; |
| 413 | 415 |
| 414 return 1 if IsPrimitiveType($type); | 416 return 1 if IsPrimitiveType($type); |
| 415 return 1 if IsEnumType($type); | 417 return 1 if IsEnumType($type); |
| 416 return 1 if IsCallbackFunctionType($type); | 418 return 1 if IsCallbackFunctionType($type); |
| 417 return 1 if $type eq "DOMString"; | |
| 418 return 0; | 419 return 0; |
| 419 } | 420 } |
| 420 | 421 |
| 421 sub AddIncludesForType | 422 sub AddIncludesForType |
| 422 { | 423 { |
| 423 my $type = shift; | 424 my $type = shift; |
| 424 | 425 |
| 425 return if SkipIncludeHeader($type); | 426 return if SkipIncludeHeader($type); |
| 426 | 427 |
| 427 # Default includes | 428 # Default includes |
| (...skipping 5027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5455 } | 5456 } |
| 5456 | 5457 |
| 5457 sub IsWrapperType | 5458 sub IsWrapperType |
| 5458 { | 5459 { |
| 5459 my $type = shift; | 5460 my $type = shift; |
| 5460 return 0 if GetArrayType($type); | 5461 return 0 if GetArrayType($type); |
| 5461 return 0 if GetSequenceType($type); | 5462 return 0 if GetSequenceType($type); |
| 5462 return 0 if IsCallbackFunctionType($type); | 5463 return 0 if IsCallbackFunctionType($type); |
| 5463 return 0 if IsEnumType($type); | 5464 return 0 if IsEnumType($type); |
| 5464 return 0 if IsPrimitiveType($type); | 5465 return 0 if IsPrimitiveType($type); |
| 5465 return 0 if $type eq "DOMString"; | |
| 5466 return 0 if $type eq "Promise"; | 5466 return 0 if $type eq "Promise"; |
| 5467 return !$nonWrapperTypes{$type}; | 5467 return !$nonWrapperTypes{$type}; |
| 5468 } | 5468 } |
| 5469 | 5469 |
| 5470 sub IsCallbackInterface | 5470 sub IsCallbackInterface |
| 5471 { | 5471 { |
| 5472 my $type = shift; | 5472 my $type = shift; |
| 5473 return 0 unless IsWrapperType($type); | 5473 return 0 unless IsWrapperType($type); |
| 5474 return 0 if IsTypedArrayType($type); | 5474 return 0 if IsTypedArrayType($type); |
| 5475 | 5475 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5600 return "${indent}v8SetReturnValue(${getCallbackInfo}, v8DateOrNull($nati
veValue, $getIsolate));" if $isReturnValue; | 5600 return "${indent}v8SetReturnValue(${getCallbackInfo}, v8DateOrNull($nati
veValue, $getIsolate));" if $isReturnValue; |
| 5601 return "$indent$receiver v8DateOrNull($nativeValue, $getIsolate);" | 5601 return "$indent$receiver v8DateOrNull($nativeValue, $getIsolate);" |
| 5602 } | 5602 } |
| 5603 | 5603 |
| 5604 # long long and unsigned long long are not representable in ECMAScript. | 5604 # long long and unsigned long long are not representable in ECMAScript. |
| 5605 if ($type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTi
meStamp") { | 5605 if ($type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTi
meStamp") { |
| 5606 return "${indent}v8SetReturnValue(${getCallbackInfo}, static_cast<double
>($nativeValue));" if $isReturnValue; | 5606 return "${indent}v8SetReturnValue(${getCallbackInfo}, static_cast<double
>($nativeValue));" if $isReturnValue; |
| 5607 return "$indent$receiver v8::Number::New($getIsolate, static_cast<double
>($nativeValue));"; | 5607 return "$indent$receiver v8::Number::New($getIsolate, static_cast<double
>($nativeValue));"; |
| 5608 } | 5608 } |
| 5609 | 5609 |
| 5610 if (IsPrimitiveType($type)) { | |
| 5611 die "unexpected type $type" if not ($type eq "float" or $type eq "double
"); | |
| 5612 return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue});"
if $isReturnValue; | |
| 5613 return "$indent$receiver v8::Number::New($getIsolate, $nativeValue);"; | |
| 5614 } | |
| 5615 | |
| 5616 if ($nativeType eq "ScriptValue" or $nativeType eq "ScriptPromise") { | |
| 5617 return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue}.v8V
alue());" if $isReturnValue; | |
| 5618 return "$indent$receiver $nativeValue.v8Value();"; | |
| 5619 } | |
| 5620 | |
| 5621 my $conv = $extendedAttributes->{"TreatReturnedNullStringAs"}; | 5610 my $conv = $extendedAttributes->{"TreatReturnedNullStringAs"}; |
| 5622 if (($type eq "DOMString" || IsEnumType($type)) && $isReturnValue) { | 5611 if (($type eq "DOMString" || IsEnumType($type)) && $isReturnValue) { |
| 5623 my $functionSuffix = ""; | 5612 my $functionSuffix = ""; |
| 5624 if (defined $conv) { | 5613 if (defined $conv) { |
| 5625 if ($conv eq "Null") { | 5614 if ($conv eq "Null") { |
| 5626 $functionSuffix = "OrNull"; | 5615 $functionSuffix = "OrNull"; |
| 5627 } elsif ($conv eq "Undefined") { | 5616 } elsif ($conv eq "Undefined") { |
| 5628 $functionSuffix = "OrUndefined"; | 5617 $functionSuffix = "OrUndefined"; |
| 5629 } else { | 5618 } else { |
| 5630 die "Unknown value for TreatReturnedNullStringAs extended attrib
ute"; | 5619 die "Unknown value for TreatReturnedNullStringAs extended attrib
ute"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5642 $returnValue = "v8StringOrUndefined($nativeValue, $getIsolate)"; | 5631 $returnValue = "v8StringOrUndefined($nativeValue, $getIsolate)"; |
| 5643 } else { | 5632 } else { |
| 5644 die "Unknown value for TreatReturnedNullStringAs extended attrib
ute"; | 5633 die "Unknown value for TreatReturnedNullStringAs extended attrib
ute"; |
| 5645 } | 5634 } |
| 5646 } else { | 5635 } else { |
| 5647 $returnValue = "v8String($nativeValue, $getIsolate)"; | 5636 $returnValue = "v8String($nativeValue, $getIsolate)"; |
| 5648 } | 5637 } |
| 5649 return "$indent$receiver $returnValue;"; | 5638 return "$indent$receiver $returnValue;"; |
| 5650 } | 5639 } |
| 5651 | 5640 |
| 5641 if (IsPrimitiveType($type)) { |
| 5642 die "unexpected type $type" if not ($type eq "float" or $type eq "double
"); |
| 5643 return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue});"
if $isReturnValue; |
| 5644 return "$indent$receiver v8::Number::New($getIsolate, $nativeValue);"; |
| 5645 } |
| 5646 |
| 5647 if ($nativeType eq "ScriptValue" or $nativeType eq "ScriptPromise") { |
| 5648 return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue}.v8V
alue());" if $isReturnValue; |
| 5649 return "$indent$receiver $nativeValue.v8Value();"; |
| 5650 } |
| 5651 |
| 5652 my $arrayOrSequenceType = GetArrayOrSequenceType($type); | 5652 my $arrayOrSequenceType = GetArrayOrSequenceType($type); |
| 5653 | 5653 |
| 5654 if ($arrayOrSequenceType) { | 5654 if ($arrayOrSequenceType) { |
| 5655 if (IsRefPtrType($arrayOrSequenceType)) { | 5655 if (IsRefPtrType($arrayOrSequenceType)) { |
| 5656 AddIncludesForType($arrayOrSequenceType); | 5656 AddIncludesForType($arrayOrSequenceType); |
| 5657 } | 5657 } |
| 5658 return "${indent}v8SetReturnValue(${getCallbackInfo}, v8Array($nativeVal
ue, $getIsolate));" if $isReturnValue; | 5658 return "${indent}v8SetReturnValue(${getCallbackInfo}, v8Array($nativeVal
ue, $getIsolate));" if $isReturnValue; |
| 5659 return "$indent$receiver v8Array($nativeValue, $getIsolate);"; | 5659 return "$indent$receiver v8Array($nativeValue, $getIsolate);"; |
| 5660 } | 5660 } |
| 5661 | 5661 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5875 } | 5875 } |
| 5876 | 5876 |
| 5877 sub IsRefPtrType | 5877 sub IsRefPtrType |
| 5878 { | 5878 { |
| 5879 my $type = shift; | 5879 my $type = shift; |
| 5880 | 5880 |
| 5881 return 0 if $type eq "any"; | 5881 return 0 if $type eq "any"; |
| 5882 return 0 if IsPrimitiveType($type); | 5882 return 0 if IsPrimitiveType($type); |
| 5883 return 0 if GetArrayType($type); | 5883 return 0 if GetArrayType($type); |
| 5884 return 0 if GetSequenceType($type); | 5884 return 0 if GetSequenceType($type); |
| 5885 return 0 if $type eq "DOMString"; | |
| 5886 return 0 if $type eq "Promise"; | 5885 return 0 if $type eq "Promise"; |
| 5887 return 0 if IsCallbackFunctionType($type); | 5886 return 0 if IsCallbackFunctionType($type); |
| 5888 return 0 if IsEnumType($type); | 5887 return 0 if IsEnumType($type); |
| 5889 return 0 if IsUnionType($type); | 5888 return 0 if IsUnionType($type); |
| 5890 | 5889 |
| 5891 return 1; | 5890 return 1; |
| 5892 } | 5891 } |
| 5893 | 5892 |
| 5894 sub GetSVGTypeNeedingTearOff | 5893 sub GetSVGTypeNeedingTearOff |
| 5895 { | 5894 { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6205 my $interface = shift; | 6204 my $interface = shift; |
| 6206 | 6205 |
| 6207 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6206 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6208 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6207 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6209 return 1 if InheritsInterface($interface, "Document"); | 6208 return 1 if InheritsInterface($interface, "Document"); |
| 6210 | 6209 |
| 6211 return 0; | 6210 return 0; |
| 6212 } | 6211 } |
| 6213 | 6212 |
| 6214 1; | 6213 1; |
| OLD | NEW |