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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 (IsTypedArrayType($type)) { | 440 } elsif (IsTypedArrayType($type)) { |
| 441 AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); | 441 AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); |
| 442 } elsif (my $arrayType = GetArrayType($type)) { | 442 } elsif (my $arrayType = GetArrayType($type)) { |
| 443 AddIncludesForType($arrayType); | 443 if (IsDictionaryType($arrayType)) { |
|
Nils Barth (inactive)
2013/11/19 06:45:43
I think you can just add:
} elsif ($type eq "Dicti
alancutter (OOO until 2018)
2013/11/19 11:00:44
Done.
| |
| 444 AddToImplIncludes("bindings/v8/Dictionary.h"); | |
| 445 } else { | |
| 446 AddIncludesForType($arrayType); | |
| 447 } | |
| 444 } else { | 448 } else { |
| 445 AddToImplIncludes("V8${type}.h"); | 449 AddToImplIncludes("V8${type}.h"); |
| 446 } | 450 } |
| 447 } | 451 } |
| 448 | 452 |
| 449 sub HeaderFilesForInterface | 453 sub HeaderFilesForInterface |
| 450 { | 454 { |
| 451 my $interfaceName = shift; | 455 my $interfaceName = shift; |
| 452 my $implClassName = shift; | 456 my $implClassName = shift; |
| 453 | 457 |
| (...skipping 4843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5297 } | 5301 } |
| 5298 | 5302 |
| 5299 return "String" if $type eq "DOMString" or IsEnumType($type); | 5303 return "String" if $type eq "DOMString" or IsEnumType($type); |
| 5300 | 5304 |
| 5301 return "ScriptPromise" if $type eq "Promise"; | 5305 return "ScriptPromise" if $type eq "Promise"; |
| 5302 | 5306 |
| 5303 return "Range::CompareHow" if $type eq "CompareHow"; | 5307 return "Range::CompareHow" if $type eq "CompareHow"; |
| 5304 return "DOMTimeStamp" if $type eq "DOMTimeStamp"; | 5308 return "DOMTimeStamp" if $type eq "DOMTimeStamp"; |
| 5305 return "double" if $type eq "Date"; | 5309 return "double" if $type eq "Date"; |
| 5306 return "ScriptValue" if $type eq "any" or IsCallbackFunctionType($type); | 5310 return "ScriptValue" if $type eq "any" or IsCallbackFunctionType($type); |
| 5307 return "Dictionary" if $type eq "Dictionary"; | 5311 return "Dictionary" if IsDictionaryType($type); |
| 5308 | 5312 |
| 5309 die "UnionType is not supported" if IsUnionType($type); | 5313 die "UnionType is not supported" if IsUnionType($type); |
| 5310 | 5314 |
| 5311 if (IsTypedArrayType($type)) { | 5315 if (IsTypedArrayType($type)) { |
| 5312 return $isParameter ? "${type}*" : "RefPtr<${type}>"; | 5316 return $isParameter ? "${type}*" : "RefPtr<${type}>"; |
| 5313 } | 5317 } |
| 5314 | 5318 |
| 5315 # We need to check [ImplementedAs] extended attribute for wrapper types. | 5319 # We need to check [ImplementedAs] extended attribute for wrapper types. |
| 5316 return "RefPtr<$type>" if $type eq "XPathNSResolver"; # FIXME: can this be put in nonWrapperTypes instead? | 5320 return "RefPtr<$type>" if $type eq "XPathNSResolver"; # FIXME: can this be put in nonWrapperTypes instead? |
| 5317 if (IsWrapperType($type)) { | 5321 if (IsWrapperType($type)) { |
| 5318 my $interface = ParseInterface($type); | 5322 my $interface = ParseInterface($type); |
| 5319 my $implClassName = GetImplName($interface); | 5323 my $implClassName = GetImplName($interface); |
| 5320 return $isParameter ? "${implClassName}*" : "RefPtr<${implClassName}>"; | 5324 return $isParameter ? "${implClassName}*" : "RefPtr<${implClassName}>"; |
| 5321 } | 5325 } |
| 5322 return "RefPtr<$type>" if IsRefPtrType($type) and (not $isParameter or $nonW rapperTypes{$type}); | 5326 return "RefPtr<$type>" if IsRefPtrType($type) and (not $isParameter or $nonW rapperTypes{$type}); |
| 5323 | 5327 |
| 5324 my $arrayOrSequenceType = GetArrayOrSequenceType($type); | 5328 my $arrayOrSequenceType = GetArrayOrSequenceType($type); |
| 5325 | 5329 |
| 5326 if ($arrayOrSequenceType) { | 5330 if ($arrayOrSequenceType) { |
| 5327 my $nativeType = GetNativeType($arrayOrSequenceType); | 5331 my $nativeType = GetNativeType($arrayOrSequenceType); |
| 5328 $nativeType .= " " if ($nativeType =~ />$/); | 5332 $nativeType .= " " if ($nativeType =~ />$/); |
| 5333 return "DictionarySequence" if IsDictionaryType($nativeType); | |
| 5329 return "Vector<${nativeType}>"; | 5334 return "Vector<${nativeType}>"; |
| 5330 } | 5335 } |
| 5331 | 5336 |
| 5332 # Default, assume native type is a pointer with same type name as idl type | 5337 # Default, assume native type is a pointer with same type name as idl type |
| 5333 return "${type}*"; | 5338 return "${type}*"; |
| 5334 } | 5339 } |
| 5335 | 5340 |
| 5336 sub GetNativeTypeForCallbacks | 5341 sub GetNativeTypeForCallbacks |
| 5337 { | 5342 { |
| 5338 my $type = shift; | 5343 my $type = shift; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5412 | 5417 |
| 5413 if ($type eq "DOMString" or IsEnumType($type)) { | 5418 if ($type eq "DOMString" or IsEnumType($type)) { |
| 5414 return $value; | 5419 return $value; |
| 5415 } | 5420 } |
| 5416 | 5421 |
| 5417 if ($type eq "SerializedScriptValue") { | 5422 if ($type eq "SerializedScriptValue") { |
| 5418 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); | 5423 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); |
| 5419 return "SerializedScriptValue::create($value, $getIsolate)"; | 5424 return "SerializedScriptValue::create($value, $getIsolate)"; |
| 5420 } | 5425 } |
| 5421 | 5426 |
| 5422 if ($type eq "Dictionary") { | 5427 if (IsDictionaryType($type)) { |
| 5423 AddToImplIncludes("bindings/v8/Dictionary.h"); | 5428 AddToImplIncludes("bindings/v8/Dictionary.h"); |
| 5424 return "Dictionary($value, $getIsolate)"; | 5429 return "Dictionary($value, $getIsolate)"; |
| 5425 } | 5430 } |
| 5426 | 5431 |
| 5427 if ($type eq "any" || IsCallbackFunctionType($type)) { | 5432 if ($type eq "any" || IsCallbackFunctionType($type)) { |
| 5428 AddToImplIncludes("bindings/v8/ScriptValue.h"); | 5433 AddToImplIncludes("bindings/v8/ScriptValue.h"); |
| 5429 return "ScriptValue($value, $getIsolate)"; | 5434 return "ScriptValue($value, $getIsolate)"; |
| 5430 } | 5435 } |
| 5431 | 5436 |
| 5432 if ($type eq "Promise") { | 5437 if ($type eq "Promise") { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 5452 return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type} >::Cast($value)) : 0" | 5457 return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type} >::Cast($value)) : 0" |
| 5453 } | 5458 } |
| 5454 | 5459 |
| 5455 if ($type eq "XPathNSResolver") { | 5460 if ($type eq "XPathNSResolver") { |
| 5456 return "toXPathNSResolver($value, $getIsolate)"; | 5461 return "toXPathNSResolver($value, $getIsolate)"; |
| 5457 } | 5462 } |
| 5458 | 5463 |
| 5459 my $arrayOrSequenceType = GetArrayOrSequenceType($type); | 5464 my $arrayOrSequenceType = GetArrayOrSequenceType($type); |
| 5460 | 5465 |
| 5461 if ($arrayOrSequenceType) { | 5466 if ($arrayOrSequenceType) { |
| 5467 if (IsDictionaryType($arrayOrSequenceType)) { | |
| 5468 return "toDictionarySequence($value, $argIndexOrZero, $getIsolate)"; | |
| 5469 } | |
| 5462 if (IsRefPtrType($arrayOrSequenceType)) { | 5470 if (IsRefPtrType($arrayOrSequenceType)) { |
| 5463 AddToImplIncludes("V8${arrayOrSequenceType}.h"); | 5471 AddToImplIncludes("V8${arrayOrSequenceType}.h"); |
| 5464 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))"; | 5472 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))"; |
| 5465 } | 5473 } |
| 5466 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $argIndexOrZero, $getIsolate)"; | 5474 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $argIndexOrZero, $getIsolate)"; |
| 5467 } | 5475 } |
| 5468 | 5476 |
| 5469 AddIncludesForType($type); | 5477 AddIncludesForType($type); |
| 5470 | 5478 |
| 5471 AddToImplIncludes("V8${type}.h"); | 5479 AddToImplIncludes("V8${type}.h"); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5936 } | 5944 } |
| 5937 | 5945 |
| 5938 sub IsEnumType | 5946 sub IsEnumType |
| 5939 { | 5947 { |
| 5940 my $type = shift; | 5948 my $type = shift; |
| 5941 | 5949 |
| 5942 return 1 if $enumTypeHash{$type}; | 5950 return 1 if $enumTypeHash{$type}; |
| 5943 return 0; | 5951 return 0; |
| 5944 } | 5952 } |
| 5945 | 5953 |
| 5954 sub IsDictionaryType | |
|
Nils Barth (inactive)
2013/11/19 06:45:43
This subroutine doesn't add anything, and is less
alancutter (OOO until 2018)
2013/11/19 11:00:44
Done.
| |
| 5955 { | |
| 5956 my $type = shift; | |
| 5957 | |
| 5958 return $type eq "Dictionary"; | |
| 5959 } | |
| 5960 | |
| 5946 sub ValidEnumValues | 5961 sub ValidEnumValues |
| 5947 { | 5962 { |
| 5948 my $type = shift; | 5963 my $type = shift; |
| 5949 | 5964 |
| 5950 return @{$enumTypeHash{$type}}; | 5965 return @{$enumTypeHash{$type}}; |
| 5951 } | 5966 } |
| 5952 | 5967 |
| 5953 sub IsSVGTypeNeedingTearOff | 5968 sub IsSVGTypeNeedingTearOff |
| 5954 { | 5969 { |
| 5955 my $type = shift; | 5970 my $type = shift; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6310 my $interface = shift; | 6325 my $interface = shift; |
| 6311 | 6326 |
| 6312 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6327 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6313 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6328 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6314 return 1 if InheritsInterface($interface, "Document"); | 6329 return 1 if InheritsInterface($interface, "Document"); |
| 6315 | 6330 |
| 6316 return 0; | 6331 return 0; |
| 6317 } | 6332 } |
| 6318 | 6333 |
| 6319 1; | 6334 1; |
| OLD | NEW |