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 3686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3697 sub GenerateImplementationIndexedPropertyGetter | 3697 sub GenerateImplementationIndexedPropertyGetter |
3698 { | 3698 { |
3699 my $interface = shift; | 3699 my $interface = shift; |
3700 my $indexedGetterFunction = shift; | 3700 my $indexedGetterFunction = shift; |
3701 my $implClassName = GetImplName($interface); | 3701 my $implClassName = GetImplName($interface); |
3702 my $v8ClassName = GetV8ClassName($interface); | 3702 my $v8ClassName = GetV8ClassName($interface); |
3703 my $methodName = GetImplName($indexedGetterFunction) || "anonymousIndexedGet
ter"; | 3703 my $methodName = GetImplName($indexedGetterFunction) || "anonymousIndexedGet
ter"; |
3704 | 3704 |
3705 my $returnType = $indexedGetterFunction->type; | 3705 my $returnType = $indexedGetterFunction->type; |
3706 my $nativeType = GetNativeType($returnType); | 3706 my $nativeType = GetNativeType($returnType); |
3707 my $nativeValue = "element"; | 3707 my $nativeValue = "result"; |
3708 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3708 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
3709 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3709 my $isNull = GenerateIsNullExpression($returnType, "result"); |
3710 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate
()", "info", "collection", "", "return"); | 3710 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate
()", "info", "imp", "", "return"); |
3711 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3711 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; |
3712 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); | 3712 my $methodCallCode = GenerateMethodCall($returnType, "result", "imp->${metho
dName}", "index", $raisesExceptions); |
3713 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; | 3713 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; |
3714 $getterCode .= "{\n"; | 3714 $getterCode .= "{\n"; |
3715 $getterCode .= " ${implClassName}* collection = ${v8ClassName}::toNative(
info.Holder());\n"; | 3715 $getterCode .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Ho
lder());\n"; |
3716 if ($raisesExceptions) { | 3716 if ($raisesExceptions) { |
3717 $getterCode .= " ExceptionState exceptionState(info.Holder(), info.Ge
tIsolate());\n"; | 3717 $getterCode .= " ExceptionState exceptionState(info.Holder(), info.Ge
tIsolate());\n"; |
3718 } | 3718 } |
3719 $getterCode .= $methodCallCode . "\n"; | 3719 $getterCode .= $methodCallCode . "\n"; |
3720 if ($raisesExceptions) { | 3720 if ($raisesExceptions) { |
3721 $getterCode .= " if (exceptionState.throwIfNeeded())\n"; | 3721 $getterCode .= " if (exceptionState.throwIfNeeded())\n"; |
3722 $getterCode .= " return;\n"; | 3722 $getterCode .= " return;\n"; |
3723 } | 3723 } |
3724 if (IsUnionType($returnType)) { | 3724 if (IsUnionType($returnType)) { |
3725 $getterCode .= "${returnJSValueCode}\n"; | 3725 $getterCode .= "${returnJSValueCode}\n"; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3804 | 3804 |
3805 my $type = $indexedSetterFunction->parameters->[1]->type; | 3805 my $type = $indexedSetterFunction->parameters->[1]->type; |
3806 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3806 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE
xception"}; |
3807 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute
s->{"TreatNullAs"}; | 3807 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute
s->{"TreatNullAs"}; |
3808 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; | 3808 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; |
3809 | 3809 |
3810 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3810 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
3811 $code .= "{\n"; | 3811 $code .= "{\n"; |
3812 | 3812 |
3813 my $asSetterValue = 0; | 3813 my $asSetterValue = 0; |
3814 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3814 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
3815 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); | 3815 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); |
3816 | 3816 |
3817 my $extraArguments = ""; | 3817 my $extraArguments = ""; |
3818 if ($raisesExceptions || IsIntegerType($type)) { | 3818 if ($raisesExceptions || IsIntegerType($type)) { |
3819 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 3819 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3820 if ($raisesExceptions) { | 3820 if ($raisesExceptions) { |
3821 $extraArguments = ", exceptionState"; | 3821 $extraArguments = ", exceptionState"; |
3822 } | 3822 } |
3823 } | 3823 } |
3824 | 3824 |
3825 if ($indexedSetterFunction->extendedAttributes->{"StrictTypeChecking"} && Is
WrapperType($type)) { | 3825 if ($indexedSetterFunction->extendedAttributes->{"StrictTypeChecking"} && Is
WrapperType($type)) { |
3826 $code .= <<END; | 3826 $code .= <<END; |
3827 if (!isUndefinedOrNull(jsValue) && !V8${type}::hasInstance(jsValue, info.Get
Isolate())) { | 3827 if (!isUndefinedOrNull(jsValue) && !V8${type}::hasInstance(jsValue, info.Get
Isolate())) { |
3828 exceptionState.throwTypeError("The provided value is not of type '$type'
."); | 3828 exceptionState.throwTypeError("The provided value is not of type '$type'
."); |
3829 exceptionState.throwIfNeeded(); | 3829 exceptionState.throwIfNeeded(); |
3830 return; | 3830 return; |
3831 } | 3831 } |
3832 END | 3832 END |
3833 } | 3833 } |
3834 | 3834 |
3835 $code .= " bool result = collection->${methodName}(index, propertyValue$e
xtraArguments);\n"; | 3835 $code .= " bool result = imp->${methodName}(index, propertyValue$extraArg
uments);\n"; |
3836 | 3836 |
3837 if ($raisesExceptions) { | 3837 if ($raisesExceptions) { |
3838 $code .= " if (exceptionState.throwIfNeeded())\n"; | 3838 $code .= " if (exceptionState.throwIfNeeded())\n"; |
3839 $code .= " return;\n"; | 3839 $code .= " return;\n"; |
3840 } | 3840 } |
3841 $code .= " if (!result)\n"; | 3841 $code .= " if (!result)\n"; |
3842 $code .= " return;\n"; | 3842 $code .= " return;\n"; |
3843 $code .= " v8SetReturnValue(info, jsValue);\n"; | 3843 $code .= " v8SetReturnValue(info, jsValue);\n"; |
3844 $code .= "}\n\n"; | 3844 $code .= "}\n\n"; |
3845 $implementation{nameSpaceInternal}->add($code); | 3845 $implementation{nameSpaceInternal}->add($code); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4051 $code .= " bool ${unionMemberEnabledVariable} = false;\n"; | 4051 $code .= " bool ${unionMemberEnabledVariable} = false;\n"; |
4052 $code .= " ${nativeType} ${unionMemberVariable};\n"; | 4052 $code .= " ${nativeType} ${unionMemberVariable};\n"; |
4053 push @extraArguments, $unionMemberEnabledVariable; | 4053 push @extraArguments, $unionMemberEnabledVariable; |
4054 push @extraArguments, $unionMemberVariable; | 4054 push @extraArguments, $unionMemberVariable; |
4055 } | 4055 } |
4056 push @arguments, @extraArguments; | 4056 push @arguments, @extraArguments; |
4057 $code .= " ${functionExpression}(" . (join ", ", @arguments) . ");"; | 4057 $code .= " ${functionExpression}(" . (join ", ", @arguments) . ");"; |
4058 return $code; | 4058 return $code; |
4059 } else { | 4059 } else { |
4060 my $nativeType = GetNativeType($returnType); | 4060 my $nativeType = GetNativeType($returnType); |
4061 return " ${nativeType} element = ${functionExpression}(" . (join ", "
, @arguments) . ");" | 4061 return " ${nativeType} result = ${functionExpression}(" . (join ", ",
@arguments) . ");" |
4062 } | 4062 } |
4063 } | 4063 } |
4064 | 4064 |
4065 sub GenerateImplementationNamedPropertyGetter | 4065 sub GenerateImplementationNamedPropertyGetter |
4066 { | 4066 { |
4067 my $interface = shift; | 4067 my $interface = shift; |
4068 my $namedGetterFunction = shift; | 4068 my $namedGetterFunction = shift; |
4069 my $implClassName = GetImplName($interface); | 4069 my $implClassName = GetImplName($interface); |
4070 my $v8ClassName = GetV8ClassName($interface); | 4070 my $v8ClassName = GetV8ClassName($interface); |
4071 my $methodName = GetImplName($namedGetterFunction) || "anonymousNamedGetter"
; | 4071 my $methodName = GetImplName($namedGetterFunction) || "anonymousNamedGetter"
; |
4072 | 4072 |
4073 my $returnType = $namedGetterFunction->type; | 4073 my $returnType = $namedGetterFunction->type; |
4074 my $isNull = GenerateIsNullExpression($returnType, "element"); | 4074 my $isNull = GenerateIsNullExpression($returnType, "result"); |
4075 my $nativeValue = "element"; | 4075 my $nativeValue = "result"; |
4076 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 4076 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
4077 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate()",
"info", "collection", "", "return"); | 4077 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate()",
"info", "imp", "", "return"); |
4078 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; | 4078 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; |
4079 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "propertyName", $raisesExceptions); | 4079 my $methodCallCode = GenerateMethodCall($returnType, "result", "imp->${metho
dName}", "propertyName", $raisesExceptions); |
4080 | 4080 |
4081 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 4081 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
4082 $code .= "{\n"; | 4082 $code .= "{\n"; |
4083 if (!$interface->extendedAttributes->{"OverrideBuiltins"}) { | 4083 if (!$interface->extendedAttributes->{"OverrideBuiltins"}) { |
4084 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; | 4084 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; |
4085 $code .= " return;\n"; | 4085 $code .= " return;\n"; |
4086 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 4086 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
4087 $code .= " return;\n"; | 4087 $code .= " return;\n"; |
4088 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; | 4088 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; |
4089 $code .= " return;\n"; | 4089 $code .= " return;\n"; |
4090 $code .= "\n"; | 4090 $code .= "\n"; |
4091 } | 4091 } |
4092 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 4092 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
4093 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; | 4093 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; |
4094 if ($raisesExceptions) { | 4094 if ($raisesExceptions) { |
4095 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4095 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
4096 } | 4096 } |
4097 $code .= $methodCallCode . "\n"; | 4097 $code .= $methodCallCode . "\n"; |
4098 if ($raisesExceptions) { | 4098 if ($raisesExceptions) { |
4099 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4099 $code .= " if (exceptionState.throwIfNeeded())\n"; |
4100 $code .= " return;\n"; | 4100 $code .= " return;\n"; |
4101 } | 4101 } |
4102 $code .= " if (${isNull})\n"; | 4102 $code .= " if (${isNull})\n"; |
(...skipping 23 matching lines...) Expand all Loading... |
4126 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; | 4126 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; |
4127 $code .= " return;\n"; | 4127 $code .= " return;\n"; |
4128 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 4128 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
4129 $code .= " return;\n"; | 4129 $code .= " return;\n"; |
4130 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; | 4130 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; |
4131 $code .= " return;\n"; | 4131 $code .= " return;\n"; |
4132 $code .= "\n"; | 4132 $code .= "\n"; |
4133 } | 4133 } |
4134 | 4134 |
4135 my $asSetterValue = 0; | 4135 my $asSetterValue = 0; |
4136 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 4136 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
4137 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); | 4137 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); |
4138 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); | 4138 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); |
4139 | 4139 |
4140 my $extraArguments = ""; | 4140 my $extraArguments = ""; |
4141 if ($raisesExceptions || IsIntegerType($type)) { | 4141 if ($raisesExceptions || IsIntegerType($type)) { |
4142 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4142 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
4143 if ($raisesExceptions) { | 4143 if ($raisesExceptions) { |
4144 $extraArguments = ", exceptionState"; | 4144 $extraArguments = ", exceptionState"; |
4145 } | 4145 } |
4146 } | 4146 } |
4147 | 4147 |
4148 $code .= " bool result = collection->$methodName(propertyName, propertyVa
lue$extraArguments);\n"; | 4148 $code .= " bool result = imp->$methodName(propertyName, propertyValue$ext
raArguments);\n"; |
4149 if ($raisesExceptions) { | 4149 if ($raisesExceptions) { |
4150 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4150 $code .= " if (exceptionState.throwIfNeeded())\n"; |
4151 $code .= " return;\n"; | 4151 $code .= " return;\n"; |
4152 } | 4152 } |
4153 $code .= " if (!result)\n"; | 4153 $code .= " if (!result)\n"; |
4154 $code .= " return;\n"; | 4154 $code .= " return;\n"; |
4155 $code .= " v8SetReturnValue(info, jsValue);\n"; | 4155 $code .= " v8SetReturnValue(info, jsValue);\n"; |
4156 $code .= "}\n\n"; | 4156 $code .= "}\n\n"; |
4157 $implementation{nameSpaceInternal}->add($code); | 4157 $implementation{nameSpaceInternal}->add($code); |
4158 } | 4158 } |
4159 | 4159 |
4160 sub GenerateImplementationIndexedPropertyDeleter | 4160 sub GenerateImplementationIndexedPropertyDeleter |
4161 { | 4161 { |
4162 my $interface = shift; | 4162 my $interface = shift; |
4163 my $indexedDeleterFunction = shift; | 4163 my $indexedDeleterFunction = shift; |
4164 my $implClassName = GetImplName($interface); | 4164 my $implClassName = GetImplName($interface); |
4165 my $v8ClassName = GetV8ClassName($interface); | 4165 my $v8ClassName = GetV8ClassName($interface); |
4166 my $methodName = GetImplName($indexedDeleterFunction) || "anonymousIndexedDe
leter"; | 4166 my $methodName = GetImplName($indexedDeleterFunction) || "anonymousIndexedDe
leter"; |
4167 | 4167 |
4168 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; | 4168 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; |
4169 | 4169 |
4170 my $code = "static void indexedPropertyDeleter(uint32_t index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; | 4170 my $code = "static void indexedPropertyDeleter(uint32_t index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; |
4171 $code .= "{\n"; | 4171 $code .= "{\n"; |
4172 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 4172 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
4173 my $extraArguments = ""; | 4173 my $extraArguments = ""; |
4174 if ($raisesExceptions) { | 4174 if ($raisesExceptions) { |
4175 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4175 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
4176 $extraArguments = ", exceptionState"; | 4176 $extraArguments = ", exceptionState"; |
4177 } | 4177 } |
4178 $code .= " DeleteResult result = collection->${methodName}(index$extraArg
uments);\n"; | 4178 $code .= " DeleteResult result = imp->${methodName}(index$extraArguments)
;\n"; |
4179 if ($raisesExceptions) { | 4179 if ($raisesExceptions) { |
4180 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4180 $code .= " if (exceptionState.throwIfNeeded())\n"; |
4181 $code .= " return;\n"; | 4181 $code .= " return;\n"; |
4182 } | 4182 } |
4183 $code .= " if (result != DeleteUnknownProperty)\n"; | 4183 $code .= " if (result != DeleteUnknownProperty)\n"; |
4184 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; | 4184 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; |
4185 $code .= "}\n\n"; | 4185 $code .= "}\n\n"; |
4186 $implementation{nameSpaceInternal}->add($code); | 4186 $implementation{nameSpaceInternal}->add($code); |
4187 } | 4187 } |
4188 | 4188 |
4189 sub GenerateImplementationNamedPropertyDeleter | 4189 sub GenerateImplementationNamedPropertyDeleter |
4190 { | 4190 { |
4191 my $interface = shift; | 4191 my $interface = shift; |
4192 my $namedDeleterFunction = shift; | 4192 my $namedDeleterFunction = shift; |
4193 my $implClassName = GetImplName($interface); | 4193 my $implClassName = GetImplName($interface); |
4194 my $v8ClassName = GetV8ClassName($interface); | 4194 my $v8ClassName = GetV8ClassName($interface); |
4195 my $methodName = GetImplName($namedDeleterFunction) || "anonymousNamedDelete
r"; | 4195 my $methodName = GetImplName($namedDeleterFunction) || "anonymousNamedDelete
r"; |
4196 | 4196 |
4197 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; | 4197 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; |
4198 | 4198 |
4199 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; | 4199 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; |
4200 $code .= "{\n"; | 4200 $code .= "{\n"; |
4201 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 4201 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
4202 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; | 4202 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; |
4203 my $extraArguments = ""; | 4203 my $extraArguments = ""; |
4204 if ($raisesExceptions) { | 4204 if ($raisesExceptions) { |
4205 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4205 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
4206 $extraArguments .= ", exceptionState"; | 4206 $extraArguments .= ", exceptionState"; |
4207 } | 4207 } |
4208 $code .= " DeleteResult result = collection->${methodName}(propertyName$e
xtraArguments);\n"; | 4208 $code .= " DeleteResult result = imp->${methodName}(propertyName$extraArg
uments);\n"; |
4209 if ($raisesExceptions) { | 4209 if ($raisesExceptions) { |
4210 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4210 $code .= " if (exceptionState.throwIfNeeded())\n"; |
4211 $code .= " return;\n"; | 4211 $code .= " return;\n"; |
4212 } | 4212 } |
4213 $code .= " if (result != DeleteUnknownProperty)\n"; | 4213 $code .= " if (result != DeleteUnknownProperty)\n"; |
4214 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; | 4214 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; |
4215 $code .= "}\n\n"; | 4215 $code .= "}\n\n"; |
4216 $implementation{nameSpaceInternal}->add($code); | 4216 $implementation{nameSpaceInternal}->add($code); |
4217 } | 4217 } |
4218 | 4218 |
4219 sub GenerateImplementationNamedPropertyEnumerator | 4219 sub GenerateImplementationNamedPropertyEnumerator |
4220 { | 4220 { |
4221 my $interface = shift; | 4221 my $interface = shift; |
4222 my $implClassName = GetImplName($interface); | 4222 my $implClassName = GetImplName($interface); |
4223 my $v8ClassName = GetV8ClassName($interface); | 4223 my $v8ClassName = GetV8ClassName($interface); |
4224 | 4224 |
4225 $implementation{nameSpaceInternal}->add(<<END); | 4225 $implementation{nameSpaceInternal}->add(<<END); |
4226 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 4226 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
4227 { | 4227 { |
4228 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); | 4228 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
4229 Vector<String> names; | 4229 Vector<String> names; |
4230 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 4230 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
4231 collection->namedPropertyEnumerator(names, exceptionState); | 4231 imp->namedPropertyEnumerator(names, exceptionState); |
4232 if (exceptionState.throwIfNeeded()) | 4232 if (exceptionState.throwIfNeeded()) |
4233 return; | 4233 return; |
4234 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 4234 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
4235 for (size_t i = 0; i < names.size(); ++i) | 4235 for (size_t i = 0; i < names.size(); ++i) |
4236 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 4236 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
4237 v8SetReturnValue(info, v8names); | 4237 v8SetReturnValue(info, v8names); |
4238 } | 4238 } |
4239 | 4239 |
4240 END | 4240 END |
4241 } | 4241 } |
4242 | 4242 |
4243 sub GenerateImplementationNamedPropertyQuery | 4243 sub GenerateImplementationNamedPropertyQuery |
4244 { | 4244 { |
4245 my $interface = shift; | 4245 my $interface = shift; |
4246 my $implClassName = GetImplName($interface); | 4246 my $implClassName = GetImplName($interface); |
4247 my $v8ClassName = GetV8ClassName($interface); | 4247 my $v8ClassName = GetV8ClassName($interface); |
4248 | 4248 |
4249 $implementation{nameSpaceInternal}->add(<<END); | 4249 $implementation{nameSpaceInternal}->add(<<END); |
4250 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 4250 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
4251 { | 4251 { |
4252 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); | 4252 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
4253 AtomicString propertyName = toCoreAtomicString(name); | 4253 AtomicString propertyName = toCoreAtomicString(name); |
4254 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 4254 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
4255 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 4255 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
4256 if (exceptionState.throwIfNeeded()) | 4256 if (exceptionState.throwIfNeeded()) |
4257 return; | 4257 return; |
4258 if (!result) | 4258 if (!result) |
4259 return; | 4259 return; |
4260 v8SetReturnValueInt(info, v8::None); | 4260 v8SetReturnValueInt(info, v8::None); |
4261 } | 4261 } |
4262 | 4262 |
4263 END | 4263 END |
4264 } | 4264 } |
4265 | 4265 |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5727 my $unionMemberVariable = $nativeValue . $i; | 5727 my $unionMemberVariable = $nativeValue . $i; |
5728 my $unionMemberEnabledVariable = $nativeValue . $i . "Enabled"; | 5728 my $unionMemberEnabledVariable = $nativeValue . $i . "Enabled"; |
5729 my $unionMemberNativeValue = $unionMemberVariable; | 5729 my $unionMemberNativeValue = $unionMemberVariable; |
5730 $unionMemberNativeValue .= ".release()" if (IsRefPtrType($unionMembe
rType)); | 5730 $unionMemberNativeValue .= ".release()" if (IsRefPtrType($unionMembe
rType)); |
5731 my $returnJSValueCode = NativeToJSValue($unionMemberType, $extendedA
ttributes, $unionMemberNativeValue, $indent . " ", $receiver, $getIsolate, $g
etCallbackInfo, $getScriptWrappable, $forMainWorldSuffix, $returnValueArg); | 5731 my $returnJSValueCode = NativeToJSValue($unionMemberType, $extendedA
ttributes, $unionMemberNativeValue, $indent . " ", $receiver, $getIsolate, $g
etCallbackInfo, $getScriptWrappable, $forMainWorldSuffix, $returnValueArg); |
5732 my $code = ""; | 5732 my $code = ""; |
5733 if ($isReturnValue) { | 5733 if ($isReturnValue) { |
5734 $code .= "${indent}if (${unionMemberEnabledVariable}) {\n"; | 5734 $code .= "${indent}if (${unionMemberEnabledVariable}) {\n"; |
5735 $code .= "${returnJSValueCode}\n"; | 5735 $code .= "${returnJSValueCode}\n"; |
5736 $code .= "${indent} return;\n"; | 5736 $code .= "${indent} return;\n"; |
5737 $code .= "${indent}}\n"; | 5737 $code .= "${indent}}"; |
5738 } else { | 5738 } else { |
5739 $code .= "${indent}if (${unionMemberEnabledVariable})\n"; | 5739 $code .= "${indent}if (${unionMemberEnabledVariable})\n"; |
5740 $code .= "${returnJSValueCode}"; | 5740 $code .= "${returnJSValueCode}"; |
5741 } | 5741 } |
5742 push @codes, $code; | 5742 push @codes, $code; |
5743 } | 5743 } |
5744 if ($isReturnValue) { | 5744 if ($isReturnValue) { |
5745 # Fall back to returning null if none of the union members results a
re returned. | 5745 # Fall back to returning null if none of the union members results a
re returned. |
5746 push @codes, "${indent}v8SetReturnValueNull(${getCallbackInfo});"; | 5746 push @codes, "${indent}v8SetReturnValueNull(${getCallbackInfo});"; |
5747 } | 5747 } |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6483 if ($parameter->type eq "SerializedScriptValue") { | 6483 if ($parameter->type eq "SerializedScriptValue") { |
6484 return 1; | 6484 return 1; |
6485 } elsif (IsIntegerType($parameter->type)) { | 6485 } elsif (IsIntegerType($parameter->type)) { |
6486 return 1; | 6486 return 1; |
6487 } | 6487 } |
6488 } | 6488 } |
6489 return 0; | 6489 return 0; |
6490 } | 6490 } |
6491 | 6491 |
6492 1; | 6492 1; |
OLD | NEW |