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

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: Rebased 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
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/scripts/IDLAttributes.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 "Uint8ClampedArray" => ["unsigned char", "v8::kExternalPix elArray"], 183 "Uint8ClampedArray" => ["unsigned char", "v8::kExternalPix elArray"],
184 "Uint16Array" => ["unsigned short", "v8::kExternalUnsigned ShortArray"], 184 "Uint16Array" => ["unsigned short", "v8::kExternalUnsigned ShortArray"],
185 "Uint32Array" => ["unsigned int", "v8::kExternalUnsignedIn tArray"], 185 "Uint32Array" => ["unsigned int", "v8::kExternalUnsignedIn tArray"],
186 "Int8Array" => ["signed char", "v8::kExternalByteArray"], 186 "Int8Array" => ["signed char", "v8::kExternalByteArray"],
187 "Int16Array" => ["short", "v8::kExternalShortArray"], 187 "Int16Array" => ["short", "v8::kExternalShortArray"],
188 "Int32Array" => ["int", "v8::kExternalIntArray"], 188 "Int32Array" => ["int", "v8::kExternalIntArray"],
189 "Float32Array" => ["float", "v8::kExternalFloatArray"], 189 "Float32Array" => ["float", "v8::kExternalFloatArray"],
190 "Float64Array" => ["double", "v8::kExternalDoubleArray"], 190 "Float64Array" => ["double", "v8::kExternalDoubleArray"],
191 ); 191 );
192 192
193 my %callbackFunctionTypeHash = ();
194
193 my %enumTypeHash = (); 195 my %enumTypeHash = ();
194 196
195 my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1, 197 my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
196 "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" = > 1, 198 "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" = > 1,
197 "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1, 199 "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1,
198 "SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1, 200 "SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1,
199 "SVGAnimatedPreserveAspectRatio" => 1, 201 "SVGAnimatedPreserveAspectRatio" => 1,
200 "SVGAnimatedRect" => 1, "SVGAnimatedString" => 1, 202 "SVGAnimatedRect" => 1, "SVGAnimatedString" => 1,
201 "SVGAnimatedTransformList" => 1); 203 "SVGAnimatedTransformList" => 1);
202 204
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 322 }
321 323
322 die("Could NOT find interface definition for $interfaceName in $filename"); 324 die("Could NOT find interface definition for $interfaceName in $filename");
323 } 325 }
324 326
325 sub GenerateInterface 327 sub GenerateInterface
326 { 328 {
327 my $object = shift; 329 my $object = shift;
328 my $interface = shift; 330 my $interface = shift;
329 331
332 %callbackFunctionTypeHash = map { $_->name => $_ } @{$idlDocument->callbackF unctions};
330 %enumTypeHash = map { $_->name => $_->values } @{$idlDocument->enumerations} ; 333 %enumTypeHash = map { $_->name => $_->values } @{$idlDocument->enumerations} ;
331 my $v8ClassName = GetV8ClassName($interface); 334 my $v8ClassName = GetV8ClassName($interface);
332 my $defineName = $v8ClassName . "_h"; 335 my $defineName = $v8ClassName . "_h";
333 my $internalNamespace = GetImplName($interface) . "V8Internal"; 336 my $internalNamespace = GetImplName($interface) . "V8Internal";
334 337
335 my $conditionalString = GenerateConditionalString($interface); 338 my $conditionalString = GenerateConditionalString($interface);
336 my $conditionalIf = ""; 339 my $conditionalIf = "";
337 my $conditionalEndif = ""; 340 my $conditionalEndif = "";
338 if ($conditionalString) { 341 if ($conditionalString) {
339 $conditionalIf = "#if ${conditionalString}"; 342 $conditionalIf = "#if ${conditionalString}";
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 $headerIncludes{$include} = 1; 413 $headerIncludes{$include} = 1;
411 } 414 }
412 } 415 }
413 416
414 sub SkipIncludeHeader 417 sub SkipIncludeHeader
415 { 418 {
416 my $type = shift; 419 my $type = shift;
417 420
418 return 1 if IsPrimitiveType($type); 421 return 1 if IsPrimitiveType($type);
419 return 1 if IsEnumType($type); 422 return 1 if IsEnumType($type);
423 return 1 if IsCallbackFunctionType($type);
420 return 1 if $type eq "DOMString"; 424 return 1 if $type eq "DOMString";
421 425
422 # Special case: SVGPoint.h / SVGNumber.h do not exist. 426 # Special case: SVGPoint.h / SVGNumber.h do not exist.
423 return 1 if $type eq "SVGPoint" or $type eq "SVGNumber"; 427 return 1 if $type eq "SVGPoint" or $type eq "SVGNumber";
424 return 0; 428 return 0;
425 } 429 }
426 430
427 sub AddIncludesForType 431 sub AddIncludesForType
428 { 432 {
429 my $type = shift; 433 my $type = shift;
430 434
431 return if SkipIncludeHeader($type); 435 return if SkipIncludeHeader($type);
432 436
433 # Default includes 437 # Default includes
434 if ($type eq "EventListener") { 438 if ($type eq "EventListener") {
435 AddToImplIncludes("core/dom/EventListener.h"); 439 AddToImplIncludes("core/dom/EventListener.h");
436 } elsif ($type eq "SerializedScriptValue") { 440 } elsif ($type eq "SerializedScriptValue") {
437 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); 441 AddToImplIncludes("bindings/v8/SerializedScriptValue.h");
438 } elsif ($type eq "any") { 442 } elsif ($type eq "any" || IsCallbackFunctionType($type)) {
439 AddToImplIncludes("bindings/v8/ScriptValue.h"); 443 AddToImplIncludes("bindings/v8/ScriptValue.h");
440 } else { 444 } else {
441 AddToImplIncludes("V8${type}.h"); 445 AddToImplIncludes("V8${type}.h");
442 } 446 }
443 447
444 # Additional includes 448 # Additional includes
445 if ($type eq "CSSStyleSheet") { 449 if ($type eq "CSSStyleSheet") {
446 AddToImplIncludes("core/css/CSSImportRule.h"); 450 AddToImplIncludes("core/css/CSSImportRule.h");
447 } 451 }
448 } 452 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 public: 660 public:
657 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); 661 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType);
658 static WrapperTypeInfo info; 662 static WrapperTypeInfo info;
659 }; 663 };
660 END 664 END
661 } 665 }
662 666
663 $header{class}->addHeader("class $v8ClassName {"); 667 $header{class}->addHeader("class $v8ClassName {");
664 $header{class}->addFooter("};"); 668 $header{class}->addFooter("};");
665 669
666 my $fromFunctionOpening = "";
667 my $fromFunctionClosing = "";
668 if ($interface->extendedAttributes->{"WrapAsFunction"}) {
669 $fromFunctionOpening = "V8DOMWrapper::fromFunction(";
670 $fromFunctionClosing = ")";
671 }
672
673 $header{classPublic}->add(<<END); 670 $header{classPublic}->add(<<END);
674 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e); 671 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e);
675 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); 672 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
676 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); 673 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType);
677 static ${nativeType}* toNative(v8::Handle<v8::Object> object) 674 static ${nativeType}* toNative(v8::Handle<v8::Object> object)
678 { 675 {
679 return reinterpret_cast<${nativeType}*>(${fromFunctionOpening}object${fr omFunctionClosing}->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) ; 676 return reinterpret_cast<${nativeType}*>(object->GetAlignedPointerFromInt ernalField(v8DOMWrapperObjectIndex));
680 } 677 }
681 static void derefObject(void*); 678 static void derefObject(void*);
682 static WrapperTypeInfo info; 679 static WrapperTypeInfo info;
683 END 680 END
684 681
685 if (NeedsOpaqueRootForGC($interface)) { 682 if (NeedsOpaqueRootForGC($interface)) {
686 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I solate*);\n"); 683 $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::I solate*);\n");
687 } 684 }
688 685
689 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { 686 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 839
843 template<class HolderContainer, class Wrappable> 840 template<class HolderContainer, class Wrappable>
844 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable*) 841 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable*)
845 { 842 {
846 return toV8ForMainWorld(impl, container.Holder(), container.GetIsolate()); 843 return toV8ForMainWorld(impl, container.Holder(), container.GetIsolate());
847 } 844 }
848 END 845 END
849 } else { 846 } else {
850 847
851 my $createWrapperCall = $customWrap ? "${v8ClassName}::wrap" : "${v8Clas sName}::createWrapper"; 848 my $createWrapperCall = $customWrap ? "${v8ClassName}::wrap" : "${v8Clas sName}::createWrapper";
852 my $returningWrapper = $interface->extendedAttributes->{"WrapAsFunction" } ? "V8DOMWrapper::toFunction(wrapper)" : "wrapper";
853 my $returningCreatedWrapperOpening = $interface->extendedAttributes->{"W rapAsFunction"} ? "V8DOMWrapper::toFunction(" : "";
854 my $returningCreatedWrapperClosing = $interface->extendedAttributes->{"W rapAsFunction"} ? ", \"${implClassName}\", isolate)" : "";
855 849
856 if ($customWrap) { 850 if ($customWrap) {
857 $header{nameSpaceWebCore}->add(<<END); 851 $header{nameSpaceWebCore}->add(<<END);
858 852
859 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*); 853 v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*);
860 END 854 END
861 } else { 855 } else {
862 $header{nameSpaceWebCore}->add(<<END); 856 $header{nameSpaceWebCore}->add(<<END);
863 857
864 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 858 inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
865 { 859 {
866 ASSERT(impl); 860 ASSERT(impl);
867 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); 861 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
868 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { 862 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
869 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl); 863 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl);
870 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have 864 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have
871 // the same object de-ref functions, though, so use that as the basis of the check. 865 // the same object de-ref functions, though, so use that as the basis of the check.
872 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == ${v8ClassName}::info.derefObjectFunction); 866 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == ${v8ClassName}::info.derefObjectFunction);
873 } 867 }
874 return ${returningCreatedWrapperOpening}$createWrapperCall(impl, creationCon text, isolate)${returningCreatedWrapperClosing}; 868 return $createWrapperCall(impl, creationContext, isolate);
875 } 869 }
876 END 870 END
877 } 871 }
878 872
879 $header{nameSpaceWebCore}->add(<<END); 873 $header{nameSpaceWebCore}->add(<<END);
880 874
881 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 875 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
882 { 876 {
883 if (UNLIKELY(!impl)) 877 if (UNLIKELY(!impl))
884 return v8NullWithCheck(isolate); 878 return v8NullWithCheck(isolate);
885 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); 879 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
886 if (!wrapper.IsEmpty()) 880 if (!wrapper.IsEmpty())
887 return $returningWrapper; 881 return wrapper;
888 return wrap(impl, creationContext, isolate); 882 return wrap(impl, creationContext, isolate);
889 } 883 }
890 884
891 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) 885 inline v8::Handle<v8::Value> toV8ForMainWorld(${nativeType}* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
892 { 886 {
893 ASSERT(worldType(isolate) == MainWorld); 887 ASSERT(worldType(isolate) == MainWorld);
894 if (UNLIKELY(!impl)) 888 if (UNLIKELY(!impl))
895 return v8NullWithCheck(isolate); 889 return v8NullWithCheck(isolate);
896 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); 890 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
897 if (!wrapper.IsEmpty()) 891 if (!wrapper.IsEmpty())
898 return $returningWrapper; 892 return wrapper;
899 return wrap(impl, creationContext, isolate); 893 return wrap(impl, creationContext, isolate);
900 } 894 }
901 895
902 template<class HolderContainer, class Wrappable> 896 template<class HolderContainer, class Wrappable>
903 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer & container, Wrappable* wrappable) 897 inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const HolderContainer & container, Wrappable* wrappable)
904 { 898 {
905 if (UNLIKELY(!impl)) 899 if (UNLIKELY(!impl))
906 return v8Null(container.GetIsolate()); 900 return v8Null(container.GetIsolate());
907 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable); 901 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable);
908 if (!wrapper.IsEmpty()) 902 if (!wrapper.IsEmpty())
909 return $returningWrapper; 903 return wrapper;
910 return wrap(impl, container.Holder(), container.GetIsolate()); 904 return wrap(impl, container.Holder(), container.GetIsolate());
911 } 905 }
912 906
913 template<class HolderContainer, class Wrappable> 907 template<class HolderContainer, class Wrappable>
914 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable* wrappable) 908 inline v8::Handle<v8::Value> toV8FastForMainWorld(${nativeType}* impl, const Hol derContainer& container, Wrappable* wrappable)
915 { 909 {
916 ASSERT(worldType(container.GetIsolate()) == MainWorld); 910 ASSERT(worldType(container.GetIsolate()) == MainWorld);
917 if (UNLIKELY(!impl)) 911 if (UNLIKELY(!impl))
918 return v8Null(container.GetIsolate()); 912 return v8Null(container.GetIsolate());
919 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); 913 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
920 if (!wrapper.IsEmpty()) 914 if (!wrapper.IsEmpty())
921 return $returningWrapper; 915 return wrapper;
922 return wrap(impl, container.Holder(), container.GetIsolate()); 916 return wrap(impl, container.Holder(), container.GetIsolate());
923 } 917 }
924 918
925 template<class HolderContainer, class Wrappable> 919 template<class HolderContainer, class Wrappable>
926 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im pl, const HolderContainer& container, Wrappable* wrappable) 920 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< ${nativeType} > im pl, const HolderContainer& container, Wrappable* wrappable)
927 { 921 {
928 return toV8FastForMainWorld(impl.get(), container, wrappable); 922 return toV8FastForMainWorld(impl.get(), container, wrappable);
929 } 923 }
930 924
931 END 925 END
(...skipping 3907 matching lines...) Expand 10 before | Expand all | Expand 10 after
4839 return "long long" if $type eq "long long"; 4833 return "long long" if $type eq "long long";
4840 return "unsigned long long" if $type eq "unsigned long long"; 4834 return "unsigned long long" if $type eq "unsigned long long";
4841 return "bool" if $type eq "boolean"; 4835 return "bool" if $type eq "boolean";
4842 4836
4843 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter; 4837 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter;
4844 return "String" if $type eq "DOMString" or IsEnumType($type); 4838 return "String" if $type eq "DOMString" or IsEnumType($type);
4845 4839
4846 return "Range::CompareHow" if $type eq "CompareHow"; 4840 return "Range::CompareHow" if $type eq "CompareHow";
4847 return "DOMTimeStamp" if $type eq "DOMTimeStamp"; 4841 return "DOMTimeStamp" if $type eq "DOMTimeStamp";
4848 return "double" if $type eq "Date"; 4842 return "double" if $type eq "Date";
4849 return "ScriptValue" if $type eq "any"; 4843 return "ScriptValue" if $type eq "any" or IsCallbackFunctionType($type);
4850 return "Dictionary" if $type eq "Dictionary"; 4844 return "Dictionary" if $type eq "Dictionary";
4851 4845
4852 return "RefPtr<DOMStringList>" if $type eq "DOMStringList"; 4846 return "RefPtr<DOMStringList>" if $type eq "DOMStringList";
4853 return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener" ; 4847 return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener" ;
4854 return "RefPtr<NodeFilter>" if $type eq "NodeFilter"; 4848 return "RefPtr<NodeFilter>" if $type eq "NodeFilter";
4855 return "RefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue"; 4849 return "RefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue";
4856 return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver"; 4850 return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver";
4857 4851
4858 die "UnionType is not supported" if IsUnionType($type); 4852 die "UnionType is not supported" if IsUnionType($type);
4859 4853
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4925 if ($type eq "SerializedScriptValue") { 4919 if ($type eq "SerializedScriptValue") {
4926 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); 4920 AddToImplIncludes("bindings/v8/SerializedScriptValue.h");
4927 return "SerializedScriptValue::create($value, $getIsolate)"; 4921 return "SerializedScriptValue::create($value, $getIsolate)";
4928 } 4922 }
4929 4923
4930 if ($type eq "Dictionary") { 4924 if ($type eq "Dictionary") {
4931 AddToImplIncludes("bindings/v8/Dictionary.h"); 4925 AddToImplIncludes("bindings/v8/Dictionary.h");
4932 return "Dictionary($value, $getIsolate)"; 4926 return "Dictionary($value, $getIsolate)";
4933 } 4927 }
4934 4928
4935 if ($type eq "any") { 4929 if ($type eq "any" || IsCallbackFunctionType($type)) {
4936 AddToImplIncludes("bindings/v8/ScriptValue.h"); 4930 AddToImplIncludes("bindings/v8/ScriptValue.h");
4937 return "ScriptValue($value)"; 4931 return "ScriptValue($value)";
4938 } 4932 }
4939 4933
4940 if ($type eq "NodeFilter") { 4934 if ($type eq "NodeFilter") {
4941 return "toNodeFilter($value)"; 4935 return "toNodeFilter($value)";
4942 } 4936 }
4943 4937
4944 if ($type eq "MediaQueryListListener") { 4938 if ($type eq "MediaQueryListListener") {
4945 AddToImplIncludes("core/css/MediaQueryListListener.h"); 4939 AddToImplIncludes("core/css/MediaQueryListListener.h");
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5052 return 1; 5046 return 1;
5053 } 5047 }
5054 return 0; 5048 return 0;
5055 } 5049 }
5056 5050
5057 sub IsWrapperType 5051 sub IsWrapperType
5058 { 5052 {
5059 my $type = shift; 5053 my $type = shift;
5060 return 0 if GetArrayType($type); 5054 return 0 if GetArrayType($type);
5061 return 0 if GetSequenceType($type); 5055 return 0 if GetSequenceType($type);
5056 return 0 if IsCallbackFunctionType($type);
5062 return 0 if IsEnumType($type); 5057 return 0 if IsEnumType($type);
5063 return 0 if IsPrimitiveType($type); 5058 return 0 if IsPrimitiveType($type);
5064 return 0 if $type eq "DOMString"; 5059 return 0 if $type eq "DOMString";
5065 return !$nonWrapperTypes{$type}; 5060 return !$nonWrapperTypes{$type};
5066 } 5061 }
5067 5062
5068 sub IsCallbackInterface 5063 sub IsCallbackInterface
5069 { 5064 {
5070 my $type = shift; 5065 my $type = shift;
5071 return 0 unless IsWrapperType($type); 5066 return 0 unless IsWrapperType($type);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
5465 } 5460 }
5466 5461
5467 sub IsPrimitiveType 5462 sub IsPrimitiveType
5468 { 5463 {
5469 my $type = shift; 5464 my $type = shift;
5470 5465
5471 return 1 if $primitiveTypeHash{$type}; 5466 return 1 if $primitiveTypeHash{$type};
5472 return 0; 5467 return 0;
5473 } 5468 }
5474 5469
5470 sub IsCallbackFunctionType
5471 {
5472 my $type = shift;
5473
5474 return 1 if $callbackFunctionTypeHash{$type};
5475 return 0;
5476 }
5477
5475 sub IsEnumType 5478 sub IsEnumType
5476 { 5479 {
5477 my $type = shift; 5480 my $type = shift;
5478 5481
5479 return 1 if $enumTypeHash{$type}; 5482 return 1 if $enumTypeHash{$type};
5480 return 0; 5483 return 0;
5481 } 5484 }
5482 5485
5483 sub ValidEnumValues 5486 sub ValidEnumValues
5484 { 5487 {
(...skipping 22 matching lines...) Expand all
5507 { 5510 {
5508 my $type = shift; 5511 my $type = shift;
5509 return 1 if $typedArrayHash{$type}; 5512 return 1 if $typedArrayHash{$type};
5510 return 0; 5513 return 0;
5511 } 5514 }
5512 5515
5513 sub IsRefPtrType 5516 sub IsRefPtrType
5514 { 5517 {
5515 my $type = shift; 5518 my $type = shift;
5516 5519
5520 return 0 if $type eq "any";
5517 return 0 if IsPrimitiveType($type); 5521 return 0 if IsPrimitiveType($type);
5518 return 0 if GetArrayType($type); 5522 return 0 if GetArrayType($type);
5519 return 0 if GetSequenceType($type); 5523 return 0 if GetSequenceType($type);
5520 return 0 if $type eq "DOMString"; 5524 return 0 if $type eq "DOMString";
5525 return 0 if IsCallbackFunctionType($type);
5521 return 0 if IsEnumType($type); 5526 return 0 if IsEnumType($type);
5522 return 0 if IsUnionType($type); 5527 return 0 if IsUnionType($type);
5523 5528
5524 return 1; 5529 return 1;
5525 } 5530 }
5526 5531
5527 sub GetSVGTypeNeedingTearOff 5532 sub GetSVGTypeNeedingTearOff
5528 { 5533 {
5529 my $type = shift; 5534 my $type = shift;
5530 5535
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
5860 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 5865 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
5861 $found = 1; 5866 $found = 1;
5862 } 5867 }
5863 return 1 if $found; 5868 return 1 if $found;
5864 }, 0); 5869 }, 0);
5865 5870
5866 return $found; 5871 return $found;
5867 } 5872 }
5868 5873
5869 1; 5874 1;
OLDNEW
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/scripts/IDLAttributes.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698