Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: Source/bindings/scripts/CodeGeneratorV8.pm

Issue 16708002: Simplify Custom Element constructors to be functions, not wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address morrita1's first round of feedback Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 "Uint8ClampedArray" => ["unsigned char", "v8::kExternalPix elArray"], 181 "Uint8ClampedArray" => ["unsigned char", "v8::kExternalPix elArray"],
182 "Uint16Array" => ["unsigned short", "v8::kExternalUnsigned ShortArray"], 182 "Uint16Array" => ["unsigned short", "v8::kExternalUnsigned ShortArray"],
183 "Uint32Array" => ["unsigned int", "v8::kExternalUnsignedIn tArray"], 183 "Uint32Array" => ["unsigned int", "v8::kExternalUnsignedIn tArray"],
184 "Int8Array" => ["signed char", "v8::kExternalByteArray"], 184 "Int8Array" => ["signed char", "v8::kExternalByteArray"],
185 "Int16Array" => ["short", "v8::kExternalShortArray"], 185 "Int16Array" => ["short", "v8::kExternalShortArray"],
186 "Int32Array" => ["int", "v8::kExternalIntArray"], 186 "Int32Array" => ["int", "v8::kExternalIntArray"],
187 "Float32Array" => ["float", "v8::kExternalFloatArray"], 187 "Float32Array" => ["float", "v8::kExternalFloatArray"],
188 "Float64Array" => ["double", "v8::kExternalDoubleArray"], 188 "Float64Array" => ["double", "v8::kExternalDoubleArray"],
189 ); 189 );
190 190
191 my %callbackFunctionTypeHash = ();
192
191 my %enumTypeHash = (); 193 my %enumTypeHash = ();
192 194
193 my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1, 195 my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
194 "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" = > 1, 196 "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" = > 1,
195 "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1, 197 "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1,
196 "SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1, 198 "SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1,
197 "SVGAnimatedPreserveAspectRatio" => 1, 199 "SVGAnimatedPreserveAspectRatio" => 1,
198 "SVGAnimatedRect" => 1, "SVGAnimatedString" => 1, 200 "SVGAnimatedRect" => 1, "SVGAnimatedString" => 1,
199 "SVGAnimatedTransformList" => 1); 201 "SVGAnimatedTransformList" => 1);
200 202
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 } 320 }
319 321
320 die("Could NOT find interface definition for $interfaceName in $filename"); 322 die("Could NOT find interface definition for $interfaceName in $filename");
321 } 323 }
322 324
323 sub GenerateInterface 325 sub GenerateInterface
324 { 326 {
325 my $object = shift; 327 my $object = shift;
326 my $interface = shift; 328 my $interface = shift;
327 329
330 %callbackFunctionTypeHash = map { $_->name => $_ } @{$idlDocument->callbackF unctions};
328 %enumTypeHash = map { $_->name => $_->values } @{$idlDocument->enumerations} ; 331 %enumTypeHash = map { $_->name => $_->values } @{$idlDocument->enumerations} ;
329 my $v8ClassName = GetV8ClassName($interface); 332 my $v8ClassName = GetV8ClassName($interface);
330 my $defineName = $v8ClassName . "_h"; 333 my $defineName = $v8ClassName . "_h";
331 my $internalNamespace = GetImplName($interface) . "V8Internal"; 334 my $internalNamespace = GetImplName($interface) . "V8Internal";
332 335
333 my $conditionalString = GenerateConditionalString($interface); 336 my $conditionalString = GenerateConditionalString($interface);
334 my $conditionalIf = ""; 337 my $conditionalIf = "";
335 my $conditionalEndif = ""; 338 my $conditionalEndif = "";
336 if ($conditionalString) { 339 if ($conditionalString) {
337 $conditionalIf = "#if ${conditionalString}"; 340 $conditionalIf = "#if ${conditionalString}";
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 $headerIncludes{$include} = 1; 411 $headerIncludes{$include} = 1;
409 } 412 }
410 } 413 }
411 414
412 sub SkipIncludeHeader 415 sub SkipIncludeHeader
413 { 416 {
414 my $type = shift; 417 my $type = shift;
415 418
416 return 1 if IsPrimitiveType($type); 419 return 1 if IsPrimitiveType($type);
417 return 1 if IsEnumType($type); 420 return 1 if IsEnumType($type);
421 return 1 if IsCallbackFunctionType($type);
418 return 1 if $type eq "DOMString"; 422 return 1 if $type eq "DOMString";
419 423
420 # Special case: SVGPoint.h / SVGNumber.h do not exist. 424 # Special case: SVGPoint.h / SVGNumber.h do not exist.
421 return 1 if $type eq "SVGPoint" or $type eq "SVGNumber"; 425 return 1 if $type eq "SVGPoint" or $type eq "SVGNumber";
422 return 0; 426 return 0;
423 } 427 }
424 428
425 sub AddIncludesForType 429 sub AddIncludesForType
426 { 430 {
427 my $type = shift; 431 my $type = shift;
428 432
429 return if SkipIncludeHeader($type); 433 return if SkipIncludeHeader($type);
430 434
431 # Default includes 435 # Default includes
432 if ($type eq "EventListener") { 436 if ($type eq "EventListener") {
433 AddToImplIncludes("core/dom/EventListener.h"); 437 AddToImplIncludes("core/dom/EventListener.h");
434 } elsif ($type eq "SerializedScriptValue") { 438 } elsif ($type eq "SerializedScriptValue") {
435 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); 439 AddToImplIncludes("bindings/v8/SerializedScriptValue.h");
436 } elsif ($type eq "any") { 440 } elsif ($type eq "any" || IsCallbackFunctionType($type)) {
437 AddToImplIncludes("bindings/v8/ScriptValue.h"); 441 AddToImplIncludes("bindings/v8/ScriptValue.h");
438 } else { 442 } else {
439 AddToImplIncludes("V8${type}.h"); 443 AddToImplIncludes("V8${type}.h");
440 } 444 }
441 445
442 # Additional includes 446 # Additional includes
443 if ($type eq "CSSStyleSheet") { 447 if ($type eq "CSSStyleSheet") {
444 AddToImplIncludes("core/css/CSSImportRule.h"); 448 AddToImplIncludes("core/css/CSSImportRule.h");
445 } 449 }
446 } 450 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 public: 658 public:
655 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); 659 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType);
656 static WrapperTypeInfo info; 660 static WrapperTypeInfo info;
657 }; 661 };
658 END 662 END
659 } 663 }
660 664
661 $header{class}->addHeader("class $v8ClassName {"); 665 $header{class}->addHeader("class $v8ClassName {");
662 $header{class}->addFooter("};"); 666 $header{class}->addFooter("};");
663 667
664 my $fromFunctionOpening = "";
665 my $fromFunctionClosing = "";
666 if ($interface->extendedAttributes->{"WrapAsFunction"}) {
haraken 2013/06/10 09:11:03 Now you can remove [WrapAsFunction] from IDLAttrib
667 $fromFunctionOpening = "V8DOMWrapper::fromFunction(";
668 $fromFunctionClosing = ")";
669 }
670
671 $header{classPublic}->add(<<END); 668 $header{classPublic}->add(<<END);
672 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e); 669 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e);
673 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); 670 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
674 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); 671 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType);
675 static ${nativeType}* toNative(v8::Handle<v8::Object> object) 672 static ${nativeType}* toNative(v8::Handle<v8::Object> object)
676 { 673 {
677 return reinterpret_cast<${nativeType}*>(${fromFunctionOpening}object${fr omFunctionClosing}->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) ; 674 return reinterpret_cast<${nativeType}*>(object->GetAlignedPointerFromInt ernalField(v8DOMWrapperObjectIndex));
678 } 675 }
679 static void derefObject(void*); 676 static void derefObject(void*);
680 static WrapperTypeInfo info; 677 static WrapperTypeInfo info;
681 END 678 END
682 679
683 if (NeedsOpaqueRootForGC($interface)) { 680 if (NeedsOpaqueRootForGC($interface)) {
684 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I solate*);\n"); 681 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I solate*);\n");
685 } 682 }
686 683
687 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { 684 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 837
841 template<class HolderContainer, class Wrappable> 838 template<class HolderContainer, class Wrappable>
842 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable*) 839 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable*)
843 { 840 {
844 return toV8ForMainWorld(impl, container.Holder(), container.GetIsolate()); 841 return toV8ForMainWorld(impl, container.Holder(), container.GetIsolate());
845 } 842 }
846 END 843 END
847 } else { 844 } else {
848 845
849 my $createWrapperCall = $customWrap ? "${v8ClassName}::wrap" : "${v8Clas sName}::createWrapper"; 846 my $createWrapperCall = $customWrap ? "${v8ClassName}::wrap" : "${v8Clas sName}::createWrapper";
850 my $returningWrapper = $interface->extendedAttributes->{"WrapAsFunction" } ? "V8DOMWrapper::toFunction(wrapper)" : "wrapper";
851 my $returningCreatedWrapperOpening = $interface->extendedAttributes->{"W rapAsFunction"} ? "V8DOMWrapper::toFunction(" : "";
852 my $returningCreatedWrapperClosing = $interface->extendedAttributes->{"W rapAsFunction"} ? ", \"${implClassName}\", isolate)" : "";
853 847
854 if ($customWrap) { 848 if ($customWrap) {
855 $header{nameSpaceWebCore}->add(<<END); 849 $header{nameSpaceWebCore}->add(<<END);
856 850
857 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*); 851 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*);
858 END 852 END
859 } else { 853 } else {
860 $header{nameSpaceWebCore}->add(<<END); 854 $header{nameSpaceWebCore}->add(<<END);
861 855
862 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 856 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
863 { 857 {
864 ASSERT(impl); 858 ASSERT(impl);
865 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); 859 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
866 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { 860 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
867 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl); 861 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl);
868 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have 862 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have
869 // the same object de-ref functions, though, so use that as the basis of the check. 863 // the same object de-ref functions, though, so use that as the basis of the check.
870 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == ${v8ClassName}::info.derefObjectFunction); 864 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == ${v8ClassName}::info.derefObjectFunction);
871 } 865 }
872 return ${returningCreatedWrapperOpening}$createWrapperCall(impl, creationCon text, isolate)${returningCreatedWrapperClosing}; 866 return $createWrapperCall(impl, creationContext, isolate);
873 } 867 }
874 END 868 END
875 } 869 }
876 870
877 $header{nameSpaceWebCore}->add(<<END); 871 $header{nameSpaceWebCore}->add(<<END);
878 872
879 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 873 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
880 { 874 {
881 if (UNLIKELY(!impl)) 875 if (UNLIKELY(!impl))
882 return v8NullWithCheck(isolate); 876 return v8NullWithCheck(isolate);
883 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); 877 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
884 if (!wrapper.IsEmpty()) 878 if (!wrapper.IsEmpty())
885 return $returningWrapper; 879 return wrapper;
886 return wrap(impl, creationContext, isolate); 880 return wrap(impl, creationContext, isolate);
887 } 881 }
888 882
889 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) 883 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
890 { 884 {
891 ASSERT(worldType(isolate) == MainWorld); 885 ASSERT(worldType(isolate) == MainWorld);
892 if (UNLIKELY(!impl)) 886 if (UNLIKELY(!impl))
893 return v8NullWithCheck(isolate); 887 return v8NullWithCheck(isolate);
894 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); 888 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
895 if (!wrapper.IsEmpty()) 889 if (!wrapper.IsEmpty())
896 return $returningWrapper; 890 return wrapper;
897 return wrap(impl, creationContext, isolate); 891 return wrap(impl, creationContext, isolate);
898 } 892 }
899 893
900 template<class HolderContainer, class Wrappable> 894 template<class HolderContainer, class Wrappable>
901 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer & container, Wrappable* wrappable) 895 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer & container, Wrappable* wrappable)
902 { 896 {
903 if (UNLIKELY(!impl)) 897 if (UNLIKELY(!impl))
904 return v8Null(container.GetIsolate()); 898 return v8Null(container.GetIsolate());
905 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable); 899 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable);
906 if (!wrapper.IsEmpty()) 900 if (!wrapper.IsEmpty())
907 return $returningWrapper; 901 return wrapper;
908 return wrap(impl, container.Holder(), container.GetIsolate()); 902 return wrap(impl, container.Holder(), container.GetIsolate());
909 } 903 }
910 904
911 template<class HolderContainer, class Wrappable> 905 template<class HolderContainer, class Wrappable>
912 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable* wrappable) 906 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable* wrappable)
913 { 907 {
914 ASSERT(worldType(container.GetIsolate()) == MainWorld); 908 ASSERT(worldType(container.GetIsolate()) == MainWorld);
915 if (UNLIKELY(!impl)) 909 if (UNLIKELY(!impl))
916 return v8Null(container.GetIsolate()); 910 return v8Null(container.GetIsolate());
917 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); 911 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
918 if (!wrapper.IsEmpty()) 912 if (!wrapper.IsEmpty())
919 return $returningWrapper; 913 return wrapper;
920 return wrap(impl, container.Holder(), container.GetIsolate()); 914 return wrap(impl, container.Holder(), container.GetIsolate());
921 } 915 }
922 916
923 template<class HolderContainer, class Wrappable> 917 template<class HolderContainer, class Wrappable>
924 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im pl, const HolderContainer& container, Wrappable* wrappable) 918 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im pl, const HolderContainer& container, Wrappable* wrappable)
925 { 919 {
926 return toV8FastForMainWorld(impl.get(), container, wrappable); 920 return toV8FastForMainWorld(impl.get(), container, wrappable);
927 } 921 }
928 922
929 END 923 END
(...skipping 3878 matching lines...) Expand 10 before | Expand all | Expand 10 after
4808 return "long long" if $type eq "long long"; 4802 return "long long" if $type eq "long long";
4809 return "unsigned long long" if $type eq "unsigned long long"; 4803 return "unsigned long long" if $type eq "unsigned long long";
4810 return "bool" if $type eq "boolean"; 4804 return "bool" if $type eq "boolean";
4811 4805
4812 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter; 4806 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter;
4813 return "String" if $type eq "DOMString" or IsEnumType($type); 4807 return "String" if $type eq "DOMString" or IsEnumType($type);
4814 4808
4815 return "Range::CompareHow" if $type eq "CompareHow"; 4809 return "Range::CompareHow" if $type eq "CompareHow";
4816 return "DOMTimeStamp" if $type eq "DOMTimeStamp"; 4810 return "DOMTimeStamp" if $type eq "DOMTimeStamp";
4817 return "double" if $type eq "Date"; 4811 return "double" if $type eq "Date";
4818 return "ScriptValue" if $type eq "any"; 4812 return "ScriptValue" if $type eq "any" or IsCallbackFunctionType($type);
4819 return "Dictionary" if $type eq "Dictionary"; 4813 return "Dictionary" if $type eq "Dictionary";
4820 4814
4821 return "RefPtr<DOMStringList>" if $type eq "DOMStringList"; 4815 return "RefPtr<DOMStringList>" if $type eq "DOMStringList";
4822 return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener" ; 4816 return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener" ;
4823 return "RefPtr<NodeFilter>" if $type eq "NodeFilter"; 4817 return "RefPtr<NodeFilter>" if $type eq "NodeFilter";
4824 return "RefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue"; 4818 return "RefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue";
4825 return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver"; 4819 return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver";
4826 4820
4827 die "UnionType is not supported" if IsUnionType($type); 4821 die "UnionType is not supported" if IsUnionType($type);
4828 4822
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4892 if ($type eq "SerializedScriptValue") { 4886 if ($type eq "SerializedScriptValue") {
4893 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); 4887 AddToImplIncludes("bindings/v8/SerializedScriptValue.h");
4894 return "SerializedScriptValue::create($value, $getIsolate)"; 4888 return "SerializedScriptValue::create($value, $getIsolate)";
4895 } 4889 }
4896 4890
4897 if ($type eq "Dictionary") { 4891 if ($type eq "Dictionary") {
4898 AddToImplIncludes("bindings/v8/Dictionary.h"); 4892 AddToImplIncludes("bindings/v8/Dictionary.h");
4899 return "Dictionary($value, $getIsolate)"; 4893 return "Dictionary($value, $getIsolate)";
4900 } 4894 }
4901 4895
4902 if ($type eq "any") { 4896 if ($type eq "any" || IsCallbackFunctionType($type)) {
4903 AddToImplIncludes("bindings/v8/ScriptValue.h"); 4897 AddToImplIncludes("bindings/v8/ScriptValue.h");
4904 return "ScriptValue($value)"; 4898 return "ScriptValue($value)";
4905 } 4899 }
4906 4900
4907 if ($type eq "NodeFilter") { 4901 if ($type eq "NodeFilter") {
4908 return "toNodeFilter($value)"; 4902 return "toNodeFilter($value)";
4909 } 4903 }
4910 4904
4911 if ($type eq "MediaQueryListListener") { 4905 if ($type eq "MediaQueryListListener") {
4912 AddToImplIncludes("core/css/MediaQueryListListener.h"); 4906 AddToImplIncludes("core/css/MediaQueryListListener.h");
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
5024 return 1; 5018 return 1;
5025 } 5019 }
5026 return 0; 5020 return 0;
5027 } 5021 }
5028 5022
5029 sub IsWrapperType 5023 sub IsWrapperType
5030 { 5024 {
5031 my $type = shift; 5025 my $type = shift;
5032 return 0 if GetArrayType($type); 5026 return 0 if GetArrayType($type);
5033 return 0 if GetSequenceType($type); 5027 return 0 if GetSequenceType($type);
5028 return 0 if IsCallbackFunctionType($type);
5034 return 0 if IsEnumType($type); 5029 return 0 if IsEnumType($type);
5035 return 0 if IsPrimitiveType($type); 5030 return 0 if IsPrimitiveType($type);
5036 return 0 if $type eq "DOMString"; 5031 return 0 if $type eq "DOMString";
5037 return !$nonWrapperTypes{$type}; 5032 return !$nonWrapperTypes{$type};
5038 } 5033 }
5039 5034
5040 sub IsCallbackInterface 5035 sub IsCallbackInterface
5041 { 5036 {
5042 my $type = shift; 5037 my $type = shift;
5043 return 0 unless IsWrapperType($type); 5038 return 0 unless IsWrapperType($type);
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
5449 } 5444 }
5450 5445
5451 sub IsPrimitiveType 5446 sub IsPrimitiveType
5452 { 5447 {
5453 my $type = shift; 5448 my $type = shift;
5454 5449
5455 return 1 if $primitiveTypeHash{$type}; 5450 return 1 if $primitiveTypeHash{$type};
5456 return 0; 5451 return 0;
5457 } 5452 }
5458 5453
5454 sub IsCallbackFunctionType
5455 {
5456 my $type = shift;
5457
5458 return 1 if $callbackFunctionTypeHash{$type};
5459 return 0;
5460 }
5461
5459 sub IsEnumType 5462 sub IsEnumType
5460 { 5463 {
5461 my $type = shift; 5464 my $type = shift;
5462 5465
5463 return 1 if $enumTypeHash{$type}; 5466 return 1 if $enumTypeHash{$type};
5464 return 0; 5467 return 0;
5465 } 5468 }
5466 5469
5467 sub ValidEnumValues 5470 sub ValidEnumValues
5468 { 5471 {
(...skipping 22 matching lines...) Expand all
5491 { 5494 {
5492 my $type = shift; 5495 my $type = shift;
5493 return 1 if $typedArrayHash{$type}; 5496 return 1 if $typedArrayHash{$type};
5494 return 0; 5497 return 0;
5495 } 5498 }
5496 5499
5497 sub IsRefPtrType 5500 sub IsRefPtrType
5498 { 5501 {
5499 my $type = shift; 5502 my $type = shift;
5500 5503
5504 return 0 if $type eq "any";
5501 return 0 if IsPrimitiveType($type); 5505 return 0 if IsPrimitiveType($type);
5502 return 0 if GetArrayType($type); 5506 return 0 if GetArrayType($type);
5503 return 0 if GetSequenceType($type); 5507 return 0 if GetSequenceType($type);
5504 return 0 if $type eq "DOMString"; 5508 return 0 if $type eq "DOMString";
5509 return 0 if IsCallbackFunctionType($type);
5505 return 0 if IsEnumType($type); 5510 return 0 if IsEnumType($type);
5506 return 0 if IsUnionType($type); 5511 return 0 if IsUnionType($type);
5507 5512
5508 return 1; 5513 return 1;
5509 } 5514 }
5510 5515
5511 sub GetSVGTypeNeedingTearOff 5516 sub GetSVGTypeNeedingTearOff
5512 { 5517 {
5513 my $type = shift; 5518 my $type = shift;
5514 5519
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
5837 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 5842 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
5838 $found = 1; 5843 $found = 1;
5839 } 5844 }
5840 return 1 if $found; 5845 return 1 if $found;
5841 }, 0); 5846 }, 0);
5842 5847
5843 return $found; 5848 return $found;
5844 } 5849 }
5845 5850
5846 1; 5851 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698