| 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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 $code .= " return v8Array(${getterString}, info.GetIsolate());\n"
; | 1550 $code .= " return v8Array(${getterString}, info.GetIsolate());\n"
; |
| 1551 $code .= "}\n\n"; | 1551 $code .= "}\n\n"; |
| 1552 $implementation{nameSpaceInternal}->add($code); | 1552 $implementation{nameSpaceInternal}->add($code); |
| 1553 return; | 1553 return; |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 AddIncludesForType($returnType); | 1556 AddIncludesForType($returnType); |
| 1557 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h"); | 1557 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h"); |
| 1558 # Check for a wrapper in the wrapper cache. If there is one, we know tha
t a hidden reference has already | 1558 # Check for a wrapper in the wrapper cache. If there is one, we know tha
t a hidden reference has already |
| 1559 # been created. If we don't find a wrapper, we create both a wrapper and
a hidden reference. | 1559 # been created. If we don't find a wrapper, we create both a wrapper and
a hidden reference. |
| 1560 $code .= " RefPtr<$returnType> result = ${getterString};\n"; | 1560 my $nativeReturnType = GetNativeType($returnType); |
| 1561 $code .= " $nativeReturnType result = ${getterString};\n"; |
| 1561 if ($forMainWorldSuffix) { | 1562 if ($forMainWorldSuffix) { |
| 1562 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}(result.get())) : v8Un
defined();\n"; | 1563 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}(result.get())) : v8Un
defined();\n"; |
| 1563 } else { | 1564 } else { |
| 1564 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Unde
fined();\n"; | 1565 $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handl
e<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Unde
fined();\n"; |
| 1565 } | 1566 } |
| 1566 $code .= " if (wrapper.IsEmpty()) {\n"; | 1567 $code .= " if (wrapper.IsEmpty()) {\n"; |
| 1567 $code .= " wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate());\n"; # FIXME: Could use wrap here since the wrapper is empty. | 1568 $code .= " wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate());\n"; # FIXME: Could use wrap here since the wrapper is empty. |
| 1568 $code .= " if (!wrapper.IsEmpty())\n"; | 1569 $code .= " if (!wrapper.IsEmpty())\n"; |
| 1569 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info
.Holder(), \"${attrName}\", wrapper);\n"; | 1570 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info
.Holder(), \"${attrName}\", wrapper);\n"; |
| 1570 $code .= " }\n"; | 1571 $code .= " }\n"; |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 my $paramIndex = 0; | 2379 my $paramIndex = 0; |
| 2379 my %replacements = (); | 2380 my %replacements = (); |
| 2380 | 2381 |
| 2381 foreach my $parameter (@{$function->parameters}) { | 2382 foreach my $parameter (@{$function->parameters}) { |
| 2382 my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex); | 2383 my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex); |
| 2383 | 2384 |
| 2384 # Optional arguments without [Default=...] should generate an early call
with fewer arguments. | 2385 # Optional arguments without [Default=...] should generate an early call
with fewer arguments. |
| 2385 # Optional arguments with [Optional=...] should not generate the early c
all. | 2386 # Optional arguments with [Optional=...] should not generate the early c
all. |
| 2386 # Optional Dictionary arguments always considered to have default of emp
ty dictionary. | 2387 # Optional Dictionary arguments always considered to have default of emp
ty dictionary. |
| 2387 if ($parameter->isOptional && !$parameter->extendedAttributes->{"Default
"} && $nativeType ne "Dictionary" && !IsCallbackInterface($parameter->type)) { | 2388 if ($parameter->isOptional && !$parameter->extendedAttributes->{"Default
"} && $nativeType ne "Dictionary" && !IsCallbackInterface($parameter->type)) { |
| 2388 $parameterCheckString .= " if (args.Length() <= $paramIndex) {\n"
; | 2389 $parameterCheckString .= " if (args.Length() <= $paramIndex)"; |
| 2389 my $functionCall = GenerateFunctionCallString($function, $paramIndex
, " " x 2, $interface, $forMainWorldSuffix, %replacements); | 2390 my $functionCall = GenerateFunctionCallString($function, $paramIndex
, " " x 2, $interface, $forMainWorldSuffix, %replacements); |
| 2391 my $multiLine = ($functionCall =~ tr/\n//) > 1; |
| 2392 $parameterCheckString .= $multiLine ? " {\n" : "\n"; |
| 2390 $parameterCheckString .= $functionCall; | 2393 $parameterCheckString .= $functionCall; |
| 2391 $parameterCheckString .= " }\n"; | 2394 $parameterCheckString .= $multiLine ? " }\n" : "\n"; |
| 2392 } | 2395 } |
| 2393 | 2396 |
| 2394 my $parameterDefaultPolicy = "DefaultIsUndefined"; | 2397 my $parameterDefaultPolicy = "DefaultIsUndefined"; |
| 2395 my $default = defined $parameter->extendedAttributes->{"Default"} ? $par
ameter->extendedAttributes->{"Default"} : ""; | 2398 my $default = defined $parameter->extendedAttributes->{"Default"} ? $par
ameter->extendedAttributes->{"Default"} : ""; |
| 2396 if ($parameter->isOptional and $default eq "NullString") { | 2399 if ($parameter->isOptional and $default eq "NullString") { |
| 2397 $parameterDefaultPolicy = "DefaultIsNullString"; | 2400 $parameterDefaultPolicy = "DefaultIsNullString"; |
| 2398 } | 2401 } |
| 2399 | 2402 |
| 2400 my $parameterName = $parameter->name; | 2403 my $parameterName = $parameter->name; |
| 2401 AddToImplIncludes("core/dom/ExceptionCode.h"); | 2404 AddToImplIncludes("core/dom/ExceptionCode.h"); |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3962 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. | 3965 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. |
| 3963 | 3966 |
| 3964 ScriptExecutionContext* context = toScriptExecutionContext(proto->CreationCo
ntext()); | 3967 ScriptExecutionContext* context = toScriptExecutionContext(proto->CreationCo
ntext()); |
| 3965 END | 3968 END |
| 3966 | 3969 |
| 3967 foreach my $runtimeFunc (@enabledPerContextFunctions) { | 3970 foreach my $runtimeFunc (@enabledPerContextFunctions) { |
| 3968 my $enableFunction = GetContextEnableFunction($runtimeFunc->signatur
e); | 3971 my $enableFunction = GetContextEnableFunction($runtimeFunc->signatur
e); |
| 3969 my $functionLength = GetFunctionLength($runtimeFunc); | 3972 my $functionLength = GetFunctionLength($runtimeFunc); |
| 3970 my $conditionalString = GenerateConditionalString($runtimeFunc->sign
ature); | 3973 my $conditionalString = GenerateConditionalString($runtimeFunc->sign
ature); |
| 3971 $code .= "\n#if ${conditionalString}\n" if $conditionalString; | 3974 $code .= "\n#if ${conditionalString}\n" if $conditionalString; |
| 3972 $code .= " if (context && context->isDocument() && ${enableFuncti
on}(toDocument(context))) {\n"; | 3975 $code .= " if (context && context->isDocument() && ${enableFuncti
on}(toDocument(context)))\n"; |
| 3973 my $name = $runtimeFunc->signature->name; | 3976 my $name = $runtimeFunc->signature->name; |
| 3974 $code .= <<END; | 3977 $code .= <<END; |
| 3975 proto->Set(v8::String::NewSymbol("${name}"), v8::FunctionTemplate::New($
{implClassName}V8Internal::${name}MethodCallback, v8Undefined(), defaultSignatur
e, $functionLength)->GetFunction()); | 3978 proto->Set(v8::String::NewSymbol("${name}"), v8::FunctionTemplate::New($
{implClassName}V8Internal::${name}MethodCallback, v8Undefined(), defaultSignatur
e, $functionLength)->GetFunction()); |
| 3976 END | 3979 END |
| 3977 $code .= " }\n"; | |
| 3978 $code .= "#endif // ${conditionalString}\n" if $conditionalString; | 3980 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
| 3979 } | 3981 } |
| 3980 | 3982 |
| 3981 $code .= <<END; | 3983 $code .= <<END; |
| 3982 } | 3984 } |
| 3983 | 3985 |
| 3984 END | 3986 END |
| 3985 $implementation{nameSpaceWebCore}->add($code); | 3987 $implementation{nameSpaceWebCore}->add($code); |
| 3986 } | 3988 } |
| 3987 | 3989 |
| (...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5682 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 5684 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 5683 $found = 1; | 5685 $found = 1; |
| 5684 } | 5686 } |
| 5685 return 1 if $found; | 5687 return 1 if $found; |
| 5686 }, 0); | 5688 }, 0); |
| 5687 | 5689 |
| 5688 return $found; | 5690 return $found; |
| 5689 } | 5691 } |
| 5690 | 5692 |
| 5691 1; | 5693 1; |
| OLD | NEW |