| 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 my $customWrap = NeedsSpecialWrap($interface); | 858 my $customWrap = NeedsSpecialWrap($interface); |
| 859 if ($noToV8) { | 859 if ($noToV8) { |
| 860 die "Can't suppress toV8 for subclass\n" if $interface->parent; | 860 die "Can't suppress toV8 for subclass\n" if $interface->parent; |
| 861 } elsif ($noWrap) { | 861 } elsif ($noWrap) { |
| 862 die "Must have custom toV8\n" if !$customWrap; | 862 die "Must have custom toV8\n" if !$customWrap; |
| 863 $header{nameSpaceWebCore}->add(<<END); | 863 $header{nameSpaceWebCore}->add(<<END); |
| 864 class ${nativeType}; | 864 class ${nativeType}; |
| 865 v8::Handle<v8::Value> toV8(${nativeType}*, v8::Handle<v8::Object> creationContex
t, v8::Isolate*); | 865 v8::Handle<v8::Value> toV8(${nativeType}*, v8::Handle<v8::Object> creationContex
t, v8::Isolate*); |
| 866 | 866 |
| 867 template<class CallbackInfo> | 867 template<class CallbackInfo> |
| 868 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im
pl, v8::Handle<v8::Object> creationContext) | 868 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im
pl) |
| 869 { | 869 { |
| 870 v8SetReturnValue(callbackInfo, toV8(impl, creationContext, callbackInfo.GetI
solate())); | 870 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 871 } | 871 } |
| 872 | 872 |
| 873 template<class CallbackInfo> | 873 template<class CallbackInfo> |
| 874 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, ${nat
iveType}* impl, v8::Handle<v8::Object> creationContext) | 874 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, ${nat
iveType}* impl) |
| 875 { | 875 { |
| 876 v8SetReturnValue(callbackInfo, toV8(impl, creationContext, callbackInfo.Get
Isolate())); | 876 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); |
| 877 } | 877 } |
| 878 | 878 |
| 879 template<class CallbackInfo, class Wrappable> | 879 template<class CallbackInfo, class Wrappable> |
| 880 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ${nativeType}
* impl, Wrappable*) | 880 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ${nativeType}
* impl, Wrappable*) |
| 881 { | 881 { |
| 882 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); | 882 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); |
| 883 } | 883 } |
| 884 | 884 |
| 885 END | 885 END |
| 886 } else { | 886 } else { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 910 { | 910 { |
| 911 if (UNLIKELY(!impl)) | 911 if (UNLIKELY(!impl)) |
| 912 return v8NullWithCheck(isolate); | 912 return v8NullWithCheck(isolate); |
| 913 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<${v8ClassName}>(imp
l, isolate); | 913 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<${v8ClassName}>(imp
l, isolate); |
| 914 if (!wrapper.IsEmpty()) | 914 if (!wrapper.IsEmpty()) |
| 915 return wrapper; | 915 return wrapper; |
| 916 return wrap(impl, creationContext, isolate); | 916 return wrap(impl, creationContext, isolate); |
| 917 } | 917 } |
| 918 | 918 |
| 919 template<typename CallbackInfo> | 919 template<typename CallbackInfo> |
| 920 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im
pl, v8::Handle<v8::Object> creationContext) | 920 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ${nativeType}* im
pl) |
| 921 { | 921 { |
| 922 if (UNLIKELY(!impl)) { | 922 if (UNLIKELY(!impl)) { |
| 923 v8SetReturnValueNull(callbackInfo); | 923 v8SetReturnValueNull(callbackInfo); |
| 924 return; | 924 return; |
| 925 } | 925 } |
| 926 if (DOMDataStore::setReturnValueFromWrapper<${v8ClassName}>(callbackInfo.Get
ReturnValue(), impl)) | 926 if (DOMDataStore::setReturnValueFromWrapper<${v8ClassName}>(callbackInfo.Get
ReturnValue(), impl)) |
| 927 return; | 927 return; |
| 928 v8::Handle<v8::Object> wrapper = wrap(impl, creationContext, callbackInfo.Ge
tIsolate()); | 928 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
| 929 v8SetReturnValue(callbackInfo, wrapper); | 929 v8SetReturnValue(callbackInfo, wrapper); |
| 930 } | 930 } |
| 931 | 931 |
| 932 template<typename CallbackInfo> | 932 template<typename CallbackInfo> |
| 933 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, ${nat
iveType}* impl, v8::Handle<v8::Object> creationContext) | 933 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, ${nat
iveType}* impl) |
| 934 { | 934 { |
| 935 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld); | 935 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld); |
| 936 if (UNLIKELY(!impl)) { | 936 if (UNLIKELY(!impl)) { |
| 937 v8SetReturnValueNull(callbackInfo); | 937 v8SetReturnValueNull(callbackInfo); |
| 938 return; | 938 return; |
| 939 } | 939 } |
| 940 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<${v8ClassName}>(call
backInfo.GetReturnValue(), impl)) | 940 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<${v8ClassName}>(call
backInfo.GetReturnValue(), impl)) |
| 941 return; | 941 return; |
| 942 v8::Handle<v8::Value> wrapper = wrap(impl, creationContext, callbackInfo.Get
Isolate()); | 942 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate()); |
| 943 v8SetReturnValue(callbackInfo, wrapper); | 943 v8SetReturnValue(callbackInfo, wrapper); |
| 944 } | 944 } |
| 945 | 945 |
| 946 template<class CallbackInfo, class Wrappable> | 946 template<class CallbackInfo, class Wrappable> |
| 947 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ${nativeType}
* impl, Wrappable* wrappable) | 947 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ${nativeType}
* impl, Wrappable* wrappable) |
| 948 { | 948 { |
| 949 if (UNLIKELY(!impl)) { | 949 if (UNLIKELY(!impl)) { |
| 950 v8SetReturnValueNull(callbackInfo); | 950 v8SetReturnValueNull(callbackInfo); |
| 951 return; | 951 return; |
| 952 } | 952 } |
| 953 if (DOMDataStore::setReturnValueFromWrapperFast<${v8ClassName}>(callbackInfo
.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) | 953 if (DOMDataStore::setReturnValueFromWrapperFast<${v8ClassName}>(callbackInfo
.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) |
| 954 return; | 954 return; |
| 955 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); | 955 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
| 956 v8SetReturnValue(callbackInfo, wrapper); | 956 v8SetReturnValue(callbackInfo, wrapper); |
| 957 } | 957 } |
| 958 END | 958 END |
| 959 } | 959 } |
| 960 | 960 |
| 961 $header{nameSpaceWebCore}->add(<<END); | 961 $header{nameSpaceWebCore}->add(<<END); |
| 962 | 962 |
| 963 inline v8::Handle<v8::Value> toV8(PassRefPtr<${nativeType} > impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 963 inline v8::Handle<v8::Value> toV8(PassRefPtr<${nativeType} > impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 964 { | 964 { |
| 965 return toV8(impl.get(), creationContext, isolate); | 965 return toV8(impl.get(), creationContext, isolate); |
| 966 } | 966 } |
| 967 | 967 |
| 968 template<class CallbackInfo> | 968 template<class CallbackInfo> |
| 969 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<${nati
veType} > impl, v8::Handle<v8::Object> creationContext) | 969 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<${nati
veType} > impl) |
| 970 { | 970 { |
| 971 v8SetReturnValue(callbackInfo, impl.get(), creationContext); | 971 v8SetReturnValue(callbackInfo, impl.get()); |
| 972 } | 972 } |
| 973 | 973 |
| 974 template<class CallbackInfo> | 974 template<class CallbackInfo> |
| 975 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR
efPtr<${nativeType} > impl, v8::Handle<v8::Object> creationContext) | 975 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR
efPtr<${nativeType} > impl) |
| 976 { | 976 { |
| 977 v8SetReturnValueForMainWorld(callbackInfo, impl.get(), creationContext); | 977 v8SetReturnValueForMainWorld(callbackInfo, impl.get()); |
| 978 } | 978 } |
| 979 | 979 |
| 980 template<class CallbackInfo, class Wrappable> | 980 template<class CallbackInfo, class Wrappable> |
| 981 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<${
nativeType} > impl, Wrappable* wrappable) | 981 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<${
nativeType} > impl, Wrappable* wrappable) |
| 982 { | 982 { |
| 983 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); | 983 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); |
| 984 } | 984 } |
| 985 | 985 |
| 986 END | 986 END |
| 987 | 987 |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 $code .= "\n"; | 1596 $code .= "\n"; |
| 1597 $implementation{nameSpaceInternal}->add($code); | 1597 $implementation{nameSpaceInternal}->add($code); |
| 1598 return; | 1598 return; |
| 1599 } | 1599 } |
| 1600 | 1600 |
| 1601 if ((IsSVGAnimatedType($interfaceName) or $interfaceName eq "SVGViewSpec") a
nd IsSVGTypeNeedingTearOff($attrType)) { | 1601 if ((IsSVGAnimatedType($interfaceName) or $interfaceName eq "SVGViewSpec") a
nd IsSVGTypeNeedingTearOff($attrType)) { |
| 1602 AddToImplIncludes("V8$attrType.h"); | 1602 AddToImplIncludes("V8$attrType.h"); |
| 1603 my $svgNativeType = GetSVGTypeNeedingTearOff($attrType); | 1603 my $svgNativeType = GetSVGTypeNeedingTearOff($attrType); |
| 1604 # Convert from abstract SVGProperty to real type, so the right toJS() me
thod can be invoked. | 1604 # Convert from abstract SVGProperty to real type, so the right toJS() me
thod can be invoked. |
| 1605 if ($forMainWorldSuffix eq "ForMainWorld") { | 1605 if ($forMainWorldSuffix eq "ForMainWorld") { |
| 1606 $code .= " v8SetReturnValueForMainWorld(info, static_cast<$svgNat
iveType*>($expression), info.Holder());\n"; | 1606 $code .= " v8SetReturnValueForMainWorld(info, static_cast<$svgNat
iveType*>($expression));\n"; |
| 1607 } else { | 1607 } else { |
| 1608 $code .= " v8SetReturnValueFast(info, static_cast<$svgNativeType*
>($expression), imp);\n"; | 1608 $code .= " v8SetReturnValueFast(info, static_cast<$svgNativeType*
>($expression), imp);\n"; |
| 1609 } | 1609 } |
| 1610 } elsif (IsSVGTypeNeedingTearOff($attrType) and not $interfaceName =~ /List$
/) { | 1610 } elsif (IsSVGTypeNeedingTearOff($attrType) and not $interfaceName =~ /List$
/) { |
| 1611 AddToImplIncludes("V8$attrType.h"); | 1611 AddToImplIncludes("V8$attrType.h"); |
| 1612 AddToImplIncludes("core/svg/properties/SVGPropertyTearOff.h"); | 1612 AddToImplIncludes("core/svg/properties/SVGPropertyTearOff.h"); |
| 1613 my $tearOffType = GetSVGTypeNeedingTearOff($attrType); | 1613 my $tearOffType = GetSVGTypeNeedingTearOff($attrType); |
| 1614 my $wrappedValue; | 1614 my $wrappedValue; |
| 1615 if (IsSVGTypeWithWritablePropertiesNeedingTearOff($attrType) and not def
ined $attribute->extendedAttributes->{"Immutable"}) { | 1615 if (IsSVGTypeWithWritablePropertiesNeedingTearOff($attrType) and not def
ined $attribute->extendedAttributes->{"Immutable"}) { |
| 1616 my $getter = $expression; | 1616 my $getter = $expression; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1631 $wrappedValue = "WTF::getPtr(${tearOffType}::create(imp, $expres
sion, $updateMethod))"; | 1631 $wrappedValue = "WTF::getPtr(${tearOffType}::create(imp, $expres
sion, $updateMethod))"; |
| 1632 } | 1632 } |
| 1633 } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) { | 1633 } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) { |
| 1634 $wrappedValue = "WTF::getPtr(${tearOffType}::create(imp, $expres
sion))"; | 1634 $wrappedValue = "WTF::getPtr(${tearOffType}::create(imp, $expres
sion))"; |
| 1635 } elsif ($tearOffType =~ /SVG(Point|PathSeg)List/) { | 1635 } elsif ($tearOffType =~ /SVG(Point|PathSeg)List/) { |
| 1636 $wrappedValue = "WTF::getPtr($expression)"; | 1636 $wrappedValue = "WTF::getPtr($expression)"; |
| 1637 } else { | 1637 } else { |
| 1638 $wrappedValue = "WTF::getPtr(${tearOffType}::create($expression)
)"; | 1638 $wrappedValue = "WTF::getPtr(${tearOffType}::create($expression)
)"; |
| 1639 } | 1639 } |
| 1640 if ($forMainWorldSuffix eq "ForMainWorld") { | 1640 if ($forMainWorldSuffix eq "ForMainWorld") { |
| 1641 $code .= " v8SetReturnValueForMainWorld(info, $wrappedValue, info
.Holder());\n"; | 1641 $code .= " v8SetReturnValueForMainWorld(info, $wrappedValue);\n"; |
| 1642 } else { | 1642 } else { |
| 1643 $code .= " v8SetReturnValueFast(info, $wrappedValue, imp);\n"; | 1643 $code .= " v8SetReturnValueFast(info, $wrappedValue, imp);\n"; |
| 1644 } | 1644 } |
| 1645 } elsif ($attrCached) { | 1645 } elsif ($attrCached) { |
| 1646 if ($attribute->type eq "SerializedScriptValue") { | 1646 if ($attribute->type eq "SerializedScriptValue") { |
| 1647 $code .= <<END; | 1647 $code .= <<END; |
| 1648 RefPtr<SerializedScriptValue> serialized = $getterString; | 1648 RefPtr<SerializedScriptValue> serialized = $getterString; |
| 1649 ScriptValue jsValue = serialized ? serialized->deserialize() : v8::Handle<v8
::Value>(v8::Null(info.GetIsolate())); | 1649 ScriptValue jsValue = serialized ? serialized->deserialize() : v8::Handle<v8
::Value>(v8::Null(info.GetIsolate())); |
| 1650 info.Holder()->SetHiddenValue(propertyName, jsValue); | 1650 info.Holder()->SetHiddenValue(propertyName, jsValue); |
| 1651 v8SetReturnValue(info, jsValue); | 1651 v8SetReturnValue(info, jsValue); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1666 my $implementedByImplName = GetImplNameFromImplementedBy($implemente
dBy); | 1666 my $implementedByImplName = GetImplNameFromImplementedBy($implemente
dBy); |
| 1667 $functionName = "${implementedByImplName}::${functionName}"; | 1667 $functionName = "${implementedByImplName}::${functionName}"; |
| 1668 push(@arguments, "imp"); | 1668 push(@arguments, "imp"); |
| 1669 } else { | 1669 } else { |
| 1670 $functionName = "imp->${functionName}"; | 1670 $functionName = "imp->${functionName}"; |
| 1671 } | 1671 } |
| 1672 push(@arguments, "isolatedWorldForIsolate(info.GetIsolate())"); | 1672 push(@arguments, "isolatedWorldForIsolate(info.GetIsolate())"); |
| 1673 $code .= " EventListener* jsValue = ${functionName}(" . join(", ", @a
rguments) . ");\n"; | 1673 $code .= " EventListener* jsValue = ${functionName}(" . join(", ", @a
rguments) . ");\n"; |
| 1674 $code .= " v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8A
bstractEventListener::cast(jsValue)->getListenerObject(imp->executionContext()))
: v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));\n"; | 1674 $code .= " v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8A
bstractEventListener::cast(jsValue)->getListenerObject(imp->executionContext()))
: v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));\n"; |
| 1675 } else { | 1675 } else { |
| 1676 my $nativeValue = NativeToJSValue($attribute->type, $attribute->extended
Attributes, $expression, " ", "", "info.Holder()", "info.GetIsolate()", "info
", "imp", $forMainWorldSuffix, "return"); | 1676 my $nativeValue = NativeToJSValue($attribute->type, $attribute->extended
Attributes, $expression, " ", "", "info.GetIsolate()", "info", "imp", $forMai
nWorldSuffix, "return"); |
| 1677 $code .= "${nativeValue}\n"; | 1677 $code .= "${nativeValue}\n"; |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 $code .= "}\n"; # end of getter | 1680 $code .= "}\n"; # end of getter |
| 1681 $code .= "#endif // ${conditionalString}\n" if $conditionalString; | 1681 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
| 1682 $code .= "\n"; | 1682 $code .= "\n"; |
| 1683 $implementation{nameSpaceInternal}->add($code); | 1683 $implementation{nameSpaceInternal}->add($code); |
| 1684 } | 1684 } |
| 1685 | 1685 |
| 1686 sub ShouldKeepAttributeAlive | 1686 sub ShouldKeepAttributeAlive |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3450 my $indexedGetterFunction = shift; | 3450 my $indexedGetterFunction = shift; |
| 3451 my $implClassName = GetImplName($interface); | 3451 my $implClassName = GetImplName($interface); |
| 3452 my $v8ClassName = GetV8ClassName($interface); | 3452 my $v8ClassName = GetV8ClassName($interface); |
| 3453 my $methodName = GetImplName($indexedGetterFunction); | 3453 my $methodName = GetImplName($indexedGetterFunction); |
| 3454 | 3454 |
| 3455 my $returnType = $indexedGetterFunction->type; | 3455 my $returnType = $indexedGetterFunction->type; |
| 3456 my $nativeType = GetNativeType($returnType); | 3456 my $nativeType = GetNativeType($returnType); |
| 3457 my $nativeValue = "element"; | 3457 my $nativeValue = "element"; |
| 3458 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3458 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 3459 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3459 my $isNull = GenerateIsNullExpression($returnType, "element"); |
| 3460 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()",
"info.GetIsolate()", "info", "collection", "", "return"); | 3460 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate
()", "info", "collection", "", "return"); |
| 3461 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3461 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; |
| 3462 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); | 3462 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); |
| 3463 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; | 3463 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3464 $getterCode .= "{\n"; | 3464 $getterCode .= "{\n"; |
| 3465 $getterCode .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"
; | 3465 $getterCode .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"
; |
| 3466 $getterCode .= " ${implClassName}* collection = ${v8ClassName}::toNative(
info.Holder());\n"; | 3466 $getterCode .= " ${implClassName}* collection = ${v8ClassName}::toNative(
info.Holder());\n"; |
| 3467 if ($raisesExceptions) { | 3467 if ($raisesExceptions) { |
| 3468 $getterCode .= " ExceptionState es(info.GetIsolate());\n"; | 3468 $getterCode .= " ExceptionState es(info.GetIsolate());\n"; |
| 3469 } | 3469 } |
| 3470 $getterCode .= $methodCallCode . "\n"; | 3470 $getterCode .= $methodCallCode . "\n"; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3804 my $interface = shift; | 3804 my $interface = shift; |
| 3805 my $namedGetterFunction = shift; | 3805 my $namedGetterFunction = shift; |
| 3806 my $implClassName = GetImplName($interface); | 3806 my $implClassName = GetImplName($interface); |
| 3807 my $v8ClassName = GetV8ClassName($interface); | 3807 my $v8ClassName = GetV8ClassName($interface); |
| 3808 my $methodName = GetImplName($namedGetterFunction); | 3808 my $methodName = GetImplName($namedGetterFunction); |
| 3809 | 3809 |
| 3810 my $returnType = $namedGetterFunction->type; | 3810 my $returnType = $namedGetterFunction->type; |
| 3811 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3811 my $isNull = GenerateIsNullExpression($returnType, "element"); |
| 3812 my $nativeValue = "element"; | 3812 my $nativeValue = "element"; |
| 3813 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3813 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 3814 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()", "in
fo.GetIsolate()", "info", "collection", "", "return"); | 3814 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate()",
"info", "collection", "", "return"); |
| 3815 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; | 3815 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; |
| 3816 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "propertyName", $raisesExceptions); | 3816 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "propertyName", $raisesExceptions); |
| 3817 | 3817 |
| 3818 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3818 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3819 $code .= "{\n"; | 3819 $code .= "{\n"; |
| 3820 if (!$namedGetterFunction->extendedAttributes->{"OverrideBuiltins"}) { | 3820 if (!$namedGetterFunction->extendedAttributes->{"OverrideBuiltins"}) { |
| 3821 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; | 3821 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; |
| 3822 $code .= " return;\n"; | 3822 $code .= " return;\n"; |
| 3823 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 3823 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
| 3824 $code .= " return;\n"; | 3824 $code .= " return;\n"; |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4867 $code .= " if (!isScriptControllerTerminating())\n"; | 4867 $code .= " if (!isScriptControllerTerminating())\n"; |
| 4868 $code .= " CRASH();\n"; | 4868 $code .= " CRASH();\n"; |
| 4869 $code .= " return true;\n"; | 4869 $code .= " return true;\n"; |
| 4870 $code .= " }\n"; | 4870 $code .= " }\n"; |
| 4871 $code .= " ASSERT(thisHandle->IsObject());\n"; | 4871 $code .= " ASSERT(thisHandle->IsObject());\n"; |
| 4872 $thisObjectHandle = "v8::Handle<v8::Object>::Cast(thisHandle), "
; | 4872 $thisObjectHandle = "v8::Handle<v8::Object>::Cast(thisHandle), "
; |
| 4873 } | 4873 } |
| 4874 @args = (); | 4874 @args = (); |
| 4875 foreach my $param (@params) { | 4875 foreach my $param (@params) { |
| 4876 my $paramName = $param->name; | 4876 my $paramName = $param->name; |
| 4877 $code .= NativeToJSValue($param->type, $param->extendedAttribute
s, $paramName, " ", "v8::Handle<v8::Value> ${paramName}Handle =", "v8::Handle
<v8::Object>()", "isolate", "") . "\n"; | 4877 $code .= NativeToJSValue($param->type, $param->extendedAttribute
s, $paramName, " ", "v8::Handle<v8::Value> ${paramName}Handle =", "isolate",
"") . "\n"; |
| 4878 $code .= " if (${paramName}Handle.IsEmpty()) {\n"; | 4878 $code .= " if (${paramName}Handle.IsEmpty()) {\n"; |
| 4879 $code .= " if (!isScriptControllerTerminating())\n"; | 4879 $code .= " if (!isScriptControllerTerminating())\n"; |
| 4880 $code .= " CRASH();\n"; | 4880 $code .= " CRASH();\n"; |
| 4881 $code .= " return true;\n"; | 4881 $code .= " return true;\n"; |
| 4882 $code .= " }\n"; | 4882 $code .= " }\n"; |
| 4883 push(@args, " ${paramName}Handle"); | 4883 push(@args, " ${paramName}Handle"); |
| 4884 } | 4884 } |
| 4885 | 4885 |
| 4886 if (scalar(@args) > 0) { | 4886 if (scalar(@args) > 0) { |
| 4887 $code .= "\n v8::Handle<v8::Value> argv[] = {\n"; | 4887 $code .= "\n v8::Handle<v8::Value> argv[] = {\n"; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5201 $code .= $indent . "}\n"; | 5201 $code .= $indent . "}\n"; |
| 5202 } | 5202 } |
| 5203 | 5203 |
| 5204 if ($isSVGTearOffType) { | 5204 if ($isSVGTearOffType) { |
| 5205 AddToImplIncludes("V8$returnType.h"); | 5205 AddToImplIncludes("V8$returnType.h"); |
| 5206 AddToImplIncludes("core/svg/properties/SVGPropertyTearOff.h"); | 5206 AddToImplIncludes("core/svg/properties/SVGPropertyTearOff.h"); |
| 5207 my $svgNativeType = GetSVGTypeNeedingTearOff($returnType); | 5207 my $svgNativeType = GetSVGTypeNeedingTearOff($returnType); |
| 5208 # FIXME: Update for all ScriptWrappables. | 5208 # FIXME: Update for all ScriptWrappables. |
| 5209 if (IsDOMNodeType($interfaceName)) { | 5209 if (IsDOMNodeType($interfaceName)) { |
| 5210 if ($forMainWorldSuffix eq "ForMainWorld") { | 5210 if ($forMainWorldSuffix eq "ForMainWorld") { |
| 5211 $code .= $indent . "v8SetReturnValueForMainWorld(args, WTF::getP
tr(${svgNativeType}::create($return), args.Holder()));\n"; | 5211 $code .= $indent . "v8SetReturnValueForMainWorld(args, WTF::getP
tr(${svgNativeType}::create($return)));\n"; |
| 5212 } else { | 5212 } else { |
| 5213 $code .= $indent . "v8SetReturnValueFast(args, WTF::getPtr(${svg
NativeType}::create($return)), imp);\n"; | 5213 $code .= $indent . "v8SetReturnValueFast(args, WTF::getPtr(${svg
NativeType}::create($return)), imp);\n"; |
| 5214 } | 5214 } |
| 5215 } else { | 5215 } else { |
| 5216 $code .= $indent . "v8SetReturnValue${forMainWorldSuffix}(args, WTF:
:getPtr(${svgNativeType}::create($return)), args.Holder());\n"; | 5216 $code .= $indent . "v8SetReturnValue${forMainWorldSuffix}(args, WTF:
:getPtr(${svgNativeType}::create($return)));\n"; |
| 5217 } | 5217 } |
| 5218 return $code; | 5218 return $code; |
| 5219 } | 5219 } |
| 5220 | 5220 |
| 5221 # If the implementing class is a POD type, commit changes | 5221 # If the implementing class is a POD type, commit changes |
| 5222 if (IsSVGTypeNeedingTearOff($interfaceName) and not $interfaceName =~ /List$
/) { | 5222 if (IsSVGTypeNeedingTearOff($interfaceName) and not $interfaceName =~ /List$
/) { |
| 5223 $code .= $indent . "wrapper->commitChange();\n"; | 5223 $code .= $indent . "wrapper->commitChange();\n"; |
| 5224 } | 5224 } |
| 5225 | 5225 |
| 5226 $return .= ".release()" if ($returnIsRef); | 5226 $return .= ".release()" if ($returnIsRef); |
| 5227 | 5227 |
| 5228 my $nativeValue; | 5228 my $nativeValue; |
| 5229 # FIXME: Update for all ScriptWrappables. | 5229 # FIXME: Update for all ScriptWrappables. |
| 5230 if (IsDOMNodeType($interfaceName)) { | 5230 if (IsDOMNodeType($interfaceName)) { |
| 5231 $nativeValue = NativeToJSValue($function->type, $function->extendedAttri
butes, $return, $indent, "", "args.Holder()", "args.GetIsolate()", "args", "imp"
, $forMainWorldSuffix, "return"); | 5231 $nativeValue = NativeToJSValue($function->type, $function->extendedAttri
butes, $return, $indent, "", "args.GetIsolate()", "args", "imp", $forMainWorldSu
ffix, "return"); |
| 5232 } else { | 5232 } else { |
| 5233 $nativeValue = NativeToJSValue($function->type, $function->extendedAttri
butes, $return, $indent, "", "args.Holder()", "args.GetIsolate()", "args", 0, $f
orMainWorldSuffix, "return"); | 5233 $nativeValue = NativeToJSValue($function->type, $function->extendedAttri
butes, $return, $indent, "", "args.GetIsolate()", "args", 0, $forMainWorldSuffix
, "return"); |
| 5234 } | 5234 } |
| 5235 | 5235 |
| 5236 $code .= $nativeValue . "\n" if $nativeValue; # Skip blank line for void re
turn type | 5236 $code .= $nativeValue . "\n" if $nativeValue; # Skip blank line for void re
turn type |
| 5237 | 5237 |
| 5238 return $code; | 5238 return $code; |
| 5239 } | 5239 } |
| 5240 | 5240 |
| 5241 sub GetNativeType | 5241 sub GetNativeType |
| 5242 { | 5242 { |
| 5243 my $type = shift; | 5243 my $type = shift; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5593 } | 5593 } |
| 5594 | 5594 |
| 5595 | 5595 |
| 5596 sub NativeToJSValue | 5596 sub NativeToJSValue |
| 5597 { | 5597 { |
| 5598 my $type = shift; | 5598 my $type = shift; |
| 5599 my $extendedAttributes = shift; | 5599 my $extendedAttributes = shift; |
| 5600 my $nativeValue = shift; | 5600 my $nativeValue = shift; |
| 5601 my $indent = shift; # added before every line | 5601 my $indent = shift; # added before every line |
| 5602 my $receiver = shift; # "return" or "<variableName> =" | 5602 my $receiver = shift; # "return" or "<variableName> =" |
| 5603 my $getCreationContext = shift; | |
| 5604 my $getIsolate = shift; | 5603 my $getIsolate = shift; |
| 5605 die "An Isolate is mandatory for native value => JS value conversion." unles
s $getIsolate; | 5604 die "An Isolate is mandatory for native value => JS value conversion." unles
s $getIsolate; |
| 5606 my $getCallbackInfo = shift || ""; | 5605 my $getCallbackInfo = shift || ""; |
| 5607 my $getCallbackInfoArg = $getCallbackInfo ? ", $getCallbackInfo" : ""; | 5606 my $creationContext = $getCallbackInfo ? "${getCallbackInfo}.Holder()" : "v8
::Handle<v8::Object>()"; |
| 5608 my $getScriptWrappable = shift || ""; | 5607 my $getScriptWrappable = shift || ""; |
| 5609 my $getScriptWrappableArg = $getScriptWrappable ? ", $getScriptWrappable" :
""; | |
| 5610 my $forMainWorldSuffix = shift || ""; | 5608 my $forMainWorldSuffix = shift || ""; |
| 5611 my $returnValueArg = shift || 0; | 5609 my $returnValueArg = shift || 0; |
| 5612 my $isReturnValue = $returnValueArg eq "return"; | 5610 my $isReturnValue = $returnValueArg eq "return"; |
| 5613 | 5611 |
| 5614 if (IsUnionType($type)) { | 5612 if (IsUnionType($type)) { |
| 5615 my $types = $type->unionMemberTypes; | 5613 my $types = $type->unionMemberTypes; |
| 5616 my @codes = (); | 5614 my @codes = (); |
| 5617 for my $i (0 .. scalar(@$types)-1) { | 5615 for my $i (0 .. scalar(@$types)-1) { |
| 5618 my $unionMemberType = $types->[$i]; | 5616 my $unionMemberType = $types->[$i]; |
| 5619 my $unionMemberNumber = $i + 1; | 5617 my $unionMemberNumber = $i + 1; |
| 5620 my $unionMemberVariable = $nativeValue . $i; | 5618 my $unionMemberVariable = $nativeValue . $i; |
| 5621 my $unionMemberEnabledVariable = $nativeValue . $i . "Enabled"; | 5619 my $unionMemberEnabledVariable = $nativeValue . $i . "Enabled"; |
| 5622 my $unionMemberNativeValue = $unionMemberVariable; | 5620 my $unionMemberNativeValue = $unionMemberVariable; |
| 5623 $unionMemberNativeValue .= ".release()" if (IsRefPtrType($unionMembe
rType)); | 5621 $unionMemberNativeValue .= ".release()" if (IsRefPtrType($unionMembe
rType)); |
| 5624 my $returnJSValueCode = NativeToJSValue($unionMemberType, $extendedA
ttributes, $unionMemberNativeValue, $indent . " ", $receiver, $getCreationCon
text, $getIsolate, $getCallbackInfo, $getScriptWrappable, $forMainWorldSuffix, $
returnValueArg); | 5622 my $returnJSValueCode = NativeToJSValue($unionMemberType, $extendedA
ttributes, $unionMemberNativeValue, $indent . " ", $receiver, $getIsolate, $g
etCallbackInfo, $getScriptWrappable, $forMainWorldSuffix, $returnValueArg); |
| 5625 my $code = ""; | 5623 my $code = ""; |
| 5626 if ($isReturnValue) { | 5624 if ($isReturnValue) { |
| 5627 $code .= "${indent}if (${unionMemberEnabledVariable}) {\n"; | 5625 $code .= "${indent}if (${unionMemberEnabledVariable}) {\n"; |
| 5628 $code .= "${returnJSValueCode}\n"; | 5626 $code .= "${returnJSValueCode}\n"; |
| 5629 $code .= "${indent} return;\n"; | 5627 $code .= "${indent} return;\n"; |
| 5630 $code .= "${indent}}\n"; | 5628 $code .= "${indent}}\n"; |
| 5631 } else { | 5629 } else { |
| 5632 $code .= "${indent}if (${unionMemberEnabledVariable})\n"; | 5630 $code .= "${indent}if (${unionMemberEnabledVariable})\n"; |
| 5633 $code .= "${returnJSValueCode}"; | 5631 $code .= "${returnJSValueCode}"; |
| 5634 } | 5632 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5738 return "$indent$receiver $returnValue;"; | 5736 return "$indent$receiver $returnValue;"; |
| 5739 } | 5737 } |
| 5740 | 5738 |
| 5741 AddToImplIncludes("wtf/RefPtr.h"); | 5739 AddToImplIncludes("wtf/RefPtr.h"); |
| 5742 AddToImplIncludes("wtf/GetPtr.h"); | 5740 AddToImplIncludes("wtf/GetPtr.h"); |
| 5743 | 5741 |
| 5744 if ($getScriptWrappable) { | 5742 if ($getScriptWrappable) { |
| 5745 # FIXME: Use safe handles | 5743 # FIXME: Use safe handles |
| 5746 if ($isReturnValue) { | 5744 if ($isReturnValue) { |
| 5747 if ($forMainWorldSuffix eq "ForMainWorld") { | 5745 if ($forMainWorldSuffix eq "ForMainWorld") { |
| 5748 return "${indent}v8SetReturnValueForMainWorld(${getCallbackInfo}
, $nativeValue, $getCallbackInfo.Holder());"; | 5746 return "${indent}v8SetReturnValueForMainWorld(${getCallbackInfo}
, $nativeValue);"; |
| 5749 } | 5747 } |
| 5750 return "${indent}v8SetReturnValueFast(${getCallbackInfo}, $nativeVal
ue$getScriptWrappableArg);"; | 5748 return "${indent}v8SetReturnValueFast(${getCallbackInfo}, $nativeVal
ue, $getScriptWrappable);"; |
| 5751 } | 5749 } |
| 5752 } | 5750 } |
| 5753 # FIXME: Use safe handles | 5751 # FIXME: Use safe handles |
| 5754 return "${indent}v8SetReturnValue(${getCallbackInfo}, $nativeValue, $getCrea
tionContext);" if $isReturnValue; | 5752 return "${indent}v8SetReturnValue(${getCallbackInfo}, $nativeValue);" if $is
ReturnValue; |
| 5755 return "$indent$receiver toV8($nativeValue, $getCreationContext, $getIsolate
);"; | 5753 return "$indent$receiver toV8($nativeValue, $creationContext, $getIsolate);"
; |
| 5756 } | 5754 } |
| 5757 | 5755 |
| 5758 sub WriteData | 5756 sub WriteData |
| 5759 { | 5757 { |
| 5760 my $object = shift; | 5758 my $object = shift; |
| 5761 my $interface = shift; | 5759 my $interface = shift; |
| 5762 my $outputDirectory = shift; | 5760 my $outputDirectory = shift; |
| 5763 | 5761 |
| 5764 my $name = $interface->name; | 5762 my $name = $interface->name; |
| 5765 my $headerFileName = "$outputDirectory/V8$name.h"; | 5763 my $headerFileName = "$outputDirectory/V8$name.h"; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6283 | 6281 |
| 6284 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6282 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6285 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6283 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6286 return 1 if InheritsInterface($interface, "Document"); | 6284 return 1 if InheritsInterface($interface, "Document"); |
| 6287 return 1 if SVGTypeNeedsToHoldContextElement($interface->name); | 6285 return 1 if SVGTypeNeedsToHoldContextElement($interface->name); |
| 6288 | 6286 |
| 6289 return 0; | 6287 return 0; |
| 6290 } | 6288 } |
| 6291 | 6289 |
| 6292 1; | 6290 1; |
| OLD | NEW |