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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 $code .= " return;\n"; | 1589 $code .= " return;\n"; |
1590 } elsif ($attribute->signature->type eq "SerializedScriptValue" && $attrExt-
>{"CachedAttribute"}) { | 1590 } elsif ($attribute->signature->type eq "SerializedScriptValue" && $attrExt-
>{"CachedAttribute"}) { |
1591 my $getterFunc = ToMethodName($attribute->signature->name); | 1591 my $getterFunc = ToMethodName($attribute->signature->name); |
1592 $code .= <<END; | 1592 $code .= <<END; |
1593 RefPtr<SerializedScriptValue> serialized = imp->${getterFunc}(); | 1593 RefPtr<SerializedScriptValue> serialized = imp->${getterFunc}(); |
1594 value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8Nul
l(info.GetIsolate())); | 1594 value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8Nul
l(info.GetIsolate())); |
1595 info.Holder()->SetHiddenValue(propertyName, value); | 1595 info.Holder()->SetHiddenValue(propertyName, value); |
1596 v8SetReturnValue(info, value); | 1596 v8SetReturnValue(info, value); |
1597 return; | 1597 return; |
1598 END | 1598 END |
| 1599 } elsif ($attribute->signature->type eq "EventListener") { |
| 1600 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); |
| 1601 my $getterFunc = ToMethodName($attribute->signature->name); |
| 1602 # FIXME: Pass the main world ID for main-world-only getters. |
| 1603 $code .= " EventListener* listener = imp->${getterFunc}(isolatedWorld
ForIsolate(info.GetIsolate()));\n"; |
| 1604 $code .= " v8SetReturnValue(info, listener ? v8::Handle<v8::Value>(V8
AbstractEventListener::cast(listener)->getListenerObject(imp->scriptExecutionCon
text())) : v8::Handle<v8::Value>(v8Null(info.GetIsolate())));\n"; |
| 1605 $code .= " return;\n"; |
1599 } else { | 1606 } else { |
1600 my $nativeValue = NativeToJSValue($attribute->signature->type, $attribut
e->signature->extendedAttributes, $expression, " ", "", "info.Holder()", "inf
o.GetIsolate()", "info", "imp", "ReturnUnsafeHandle", $forMainWorldSuffix, "retu
rn"); | 1607 my $nativeValue = NativeToJSValue($attribute->signature->type, $attribut
e->signature->extendedAttributes, $expression, " ", "", "info.Holder()", "inf
o.GetIsolate()", "info", "imp", "ReturnUnsafeHandle", $forMainWorldSuffix, "retu
rn"); |
1601 $code .= "${nativeValue}\n"; | 1608 $code .= "${nativeValue}\n"; |
1602 $code .= " return;\n"; | 1609 $code .= " return;\n"; |
1603 } | 1610 } |
1604 | 1611 |
1605 $code .= "}\n\n"; # end of getter | 1612 $code .= "}\n\n"; # end of getter |
1606 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 1613 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; |
1607 $implementation{nameSpaceInternal}->add($code); | 1614 $implementation{nameSpaceInternal}->add($code); |
1608 } | 1615 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 } | 1881 } |
1875 | 1882 |
1876 if ($interfaceName eq "SVGNumber") { | 1883 if ($interfaceName eq "SVGNumber") { |
1877 $code .= " *imp = $expression;\n"; | 1884 $code .= " *imp = $expression;\n"; |
1878 } else { | 1885 } else { |
1879 if ($attribute->signature->type eq "EventListener") { | 1886 if ($attribute->signature->type eq "EventListener") { |
1880 my $implSetterFunctionName = FirstLetterToUpperCase($attrName); | 1887 my $implSetterFunctionName = FirstLetterToUpperCase($attrName); |
1881 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); | 1888 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); |
1882 if (!InheritsInterface($interface, "Node")) { | 1889 if (!InheritsInterface($interface, "Node")) { |
1883 my $attrImplName = GetImplName($attribute->signature); | 1890 my $attrImplName = GetImplName($attribute->signature); |
1884 $code .= " transferHiddenDependency(info.Holder(), imp->${att
rImplName}(), value, ${v8ClassName}::eventListenerCacheIndex, info.GetIsolate())
;\n"; | 1891 $code .= " transferHiddenDependency(info.Holder(), imp->${att
rImplName}(isolatedWorldForIsolate(info.GetIsolate())), value, ${v8ClassName}::e
ventListenerCacheIndex, info.GetIsolate());\n"; |
1885 } | 1892 } |
1886 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 1893 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
1887 if (($interfaceName eq "DOMWindow" or $interfaceName eq "WorkerConte
xt") and $attribute->signature->name eq "onerror") { | 1894 if (($interfaceName eq "DOMWindow" or $interfaceName eq "WorkerConte
xt") and $attribute->signature->name eq "onerror") { |
1888 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); | 1895 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); |
1889 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::findOrCreateWrapper<V8ErrorHandler>(value, true)"; | 1896 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::findOrCreateWrapper<V8ErrorHandler>(value, true), isolatedWorldForIsolate(inf
o.GetIsolate()));\n"; |
1890 } else { | 1897 } else { |
1891 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate)"; | 1898 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(
info.GetIsolate()));\n"; |
1892 } | 1899 } |
1893 $code .= ", ec" if $useExceptions; | |
1894 $code .= ");\n"; | |
1895 } else { | 1900 } else { |
1896 my ($functionName, @arguments) = SetterExpression($interfaceName, $a
ttribute); | 1901 my ($functionName, @arguments) = SetterExpression($interfaceName, $a
ttribute); |
1897 push(@arguments, $expression); | 1902 push(@arguments, $expression); |
1898 push(@arguments, "ec") if $useExceptions; | 1903 push(@arguments, "ec") if $useExceptions; |
1899 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { | 1904 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { |
1900 my $implementedBy = $attribute->signature->extendedAttributes->{
"ImplementedBy"}; | 1905 my $implementedBy = $attribute->signature->extendedAttributes->{
"ImplementedBy"}; |
1901 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $imple
mentedBy)); | 1906 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $imple
mentedBy)); |
1902 unshift(@arguments, "imp") if !$attribute->isStatic; | 1907 unshift(@arguments, "imp") if !$attribute->isStatic; |
1903 $functionName = "${implementedBy}::${functionName}"; | 1908 $functionName = "${implementedBy}::${functionName}"; |
1904 } elsif ($attribute->isStatic) { | 1909 } elsif ($attribute->isStatic) { |
(...skipping 3338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5243 if ($getScriptWrappable) { | 5248 if ($getScriptWrappable) { |
5244 # FIXME: Use safe handles | 5249 # FIXME: Use safe handles |
5245 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8Fast${for
MainWorldSuffix}($nativeValue$getHolderContainerArg$getScriptWrappableArg));" if
$isReturnValue; | 5250 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8Fast${for
MainWorldSuffix}($nativeValue$getHolderContainerArg$getScriptWrappableArg));" if
$isReturnValue; |
5246 return "$indent$receiver toV8Fast${forMainWorldSuffix}($nativeValue$ge
tHolderContainerArg$getScriptWrappableArg);"; | 5251 return "$indent$receiver toV8Fast${forMainWorldSuffix}($nativeValue$ge
tHolderContainerArg$getScriptWrappableArg);"; |
5247 } | 5252 } |
5248 # FIXME: Use safe handles | 5253 # FIXME: Use safe handles |
5249 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8($nativeValue
, $getCreationContext, $getIsolate));" if $isReturnValue; | 5254 return "${indent}v8SetReturnValue(${getHolderContainer}, toV8($nativeValue
, $getCreationContext, $getIsolate));" if $isReturnValue; |
5250 return "$indent$receiver toV8($nativeValue, $getCreationContext, $getIsola
te);"; | 5255 return "$indent$receiver toV8($nativeValue, $getCreationContext, $getIsola
te);"; |
5251 } | 5256 } |
5252 | 5257 |
5253 if ($type eq "EventListener") { | |
5254 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); | |
5255 my $returnValue = "$nativeValue ? v8::Handle<v8::Value>(static_cast<V8Ab
stractEventListener*>(${nativeValue})->getListenerObject(imp->scriptExecutionCon
text())) : v8::Handle<v8::Value>(v8Null($getIsolate))"; | |
5256 return "${indent}v8SetReturnValue(${getHolderContainer}, $returnValue);"
if $isReturnValue; | |
5257 return "$indent$receiver $returnValue;"; | |
5258 } | |
5259 | |
5260 if ($type eq "SerializedScriptValue") { | 5258 if ($type eq "SerializedScriptValue") { |
5261 AddToImplIncludes("$type.h"); | 5259 AddToImplIncludes("$type.h"); |
5262 my $returnValue = "$nativeValue ? $nativeValue->deserialize() : v8::Hand
le<v8::Value>(v8Null($getIsolate))"; | 5260 my $returnValue = "$nativeValue ? $nativeValue->deserialize() : v8::Hand
le<v8::Value>(v8Null($getIsolate))"; |
5263 return "${indent}v8SetReturnValue(${getHolderContainer}, $returnValue);"
if $isReturnValue; | 5261 return "${indent}v8SetReturnValue(${getHolderContainer}, $returnValue);"
if $isReturnValue; |
5264 return "$indent$receiver $returnValue;"; | 5262 return "$indent$receiver $returnValue;"; |
5265 } | 5263 } |
5266 | 5264 |
5267 AddToImplIncludes("wtf/RefCounted.h"); | 5265 AddToImplIncludes("wtf/RefCounted.h"); |
5268 AddToImplIncludes("wtf/RefPtr.h"); | 5266 AddToImplIncludes("wtf/RefPtr.h"); |
5269 AddToImplIncludes("wtf/GetPtr.h"); | 5267 AddToImplIncludes("wtf/GetPtr.h"); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5856 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 5854 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
5857 $found = 1; | 5855 $found = 1; |
5858 } | 5856 } |
5859 return 1 if $found; | 5857 return 1 if $found; |
5860 }, 0); | 5858 }, 0); |
5861 | 5859 |
5862 return $found; | 5860 return $found; |
5863 } | 5861 } |
5864 | 5862 |
5865 1; | 5863 1; |
OLD | NEW |