|
Lines 181-190
sub AddIncludesForType
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec1
|
| 181 |
} |
181 |
} |
| 182 |
} |
182 |
} |
| 183 |
|
183 |
|
|
|
184 |
sub GetIndexerType |
| 185 |
{ |
| 186 |
my $dataNode = shift; |
| 187 |
|
| 188 |
my $hasIndexGetter = $dataNode->extendedAttributes->{"IndexedGetter"}; |
| 189 |
if (!$hasIndexGetter) { |
| 190 |
return 0; |
| 191 |
} |
| 192 |
|
| 193 |
my $indexer; |
| 194 |
|
| 195 |
foreach my $function (@{$dataNode->functions}) { |
| 196 |
if ($function->signature->name eq "item") { |
| 197 |
$indexer = $function->signature; |
| 198 |
last; |
| 199 |
} |
| 200 |
} |
| 201 |
|
| 202 |
if (!$indexer) { |
| 203 |
$indexer = $codeGenerator->FindSuperMethod($dataNode, "item"); |
| 204 |
} |
| 205 |
|
| 206 |
if (!$indexer) { |
| 207 |
return 0; |
| 208 |
} |
| 209 |
|
| 210 |
my $indexerType = $indexer->type; |
| 211 |
|
| 212 |
if (IsWrapperType($indexerType) && !IsDOMNodeType($indexerType)) { |
| 213 |
return $indexerType; |
| 214 |
} |
| 215 |
|
| 216 |
return 0; |
| 217 |
} |
| 218 |
|
| 184 |
sub NeedsToVisitDOMWrapper |
219 |
sub NeedsToVisitDOMWrapper |
| 185 |
{ |
220 |
{ |
| 186 |
my $dataNode = shift; |
221 |
my $dataNode = shift; |
| 187 |
return GetGenerateIsReachable($dataNode) || GetCustomIsReachable($dataNode); |
222 |
return GetGenerateIsReachable($dataNode) || GetCustomIsReachable($dataNode) || GetIndexerType($dataNode); |
| 188 |
} |
223 |
} |
| 189 |
|
224 |
|
| 190 |
sub GetGenerateIsReachable |
225 |
sub GetGenerateIsReachable |
|
Lines 232-237
END
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec2
|
| 232 |
END |
267 |
END |
| 233 |
} |
268 |
} |
| 234 |
|
269 |
|
|
|
270 |
my $indexerType = GetIndexerType($dataNode); |
| 271 |
if ($indexerType) { |
| 272 |
# FIXME: This needs to be a $dataNode |
| 273 |
my $itemDataNode = $codeGenerator->GetInterface($indexerType); |
| 274 |
my $mapName = GetStoreDomMapNameFunction($itemDataNode); |
| 275 |
push(@implContent, <<END); |
| 276 |
{ |
| 277 |
Vector<v8::Persistent<v8::Value> > wrappers; |
| 278 |
for (unsigned i = 0; i < impl->length(); ++i) { |
| 279 |
RefPtr<${indexerType}> item = impl->item(i); |
| 280 |
v8::Handle<v8::Object> wrapper = store->$mapName().get(item.get()); |
| 281 |
if (!wrapper.IsEmpty()) |
| 282 |
wrappers.append(wrapper); |
| 283 |
} |
| 284 |
if (!wrappers.isEmpty()) |
| 285 |
v8::V8::AddImplicitReferences(wrapper, wrappers.data(), wrappers.size()); |
| 286 |
} |
| 287 |
END |
| 288 |
} |
| 235 |
push(@implContent, <<END); |
289 |
push(@implContent, <<END); |
| 236 |
} |
290 |
} |
| 237 |
|
291 |
|
|
Lines 293-299
sub GenerateHeader
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec3
|
| 293 |
$codeGenerator->LinkOverloadedFunctions($dataNode); |
347 |
$codeGenerator->LinkOverloadedFunctions($dataNode); |
| 294 |
|
348 |
|
| 295 |
my $hasDependentLifetime = $dataNode->extendedAttributes->{"V8DependentLifetime"} || $dataNode->extendedAttributes->{"ActiveDOMObject"} |
349 |
my $hasDependentLifetime = $dataNode->extendedAttributes->{"V8DependentLifetime"} || $dataNode->extendedAttributes->{"ActiveDOMObject"} |
| 296 |
|| GetGenerateIsReachable($dataNode) || $className =~ /SVG/; |
350 |
|| GetGenerateIsReachable($dataNode) || GetCustomIsReachable($dataNode) || $className =~ /SVG/; |
| 297 |
if (!$hasDependentLifetime) { |
351 |
if (!$hasDependentLifetime) { |
| 298 |
foreach (@{$dataNode->parents}) { |
352 |
foreach (@{$dataNode->parents}) { |
| 299 |
my $parent = $codeGenerator->StripModule($_); |
353 |
my $parent = $codeGenerator->StripModule($_); |
|
Lines 494-500
v8::Handle<v8::Object> ${className}::wrap(${nativeType}* impl, v8::Isolate* isol
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec4
|
| 494 |
{ |
548 |
{ |
| 495 |
END |
549 |
END |
| 496 |
push(@headerContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); |
550 |
push(@headerContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); |
| 497 |
my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName, "isolate"); |
551 |
my $domMapFunction = GetDomMapFunction($dataNode, "isolate"); |
| 498 |
my $getCachedWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getCachedWrapper(impl)" : "${domMapFunction}.get(impl)"; |
552 |
my $getCachedWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getCachedWrapper(impl)" : "${domMapFunction}.get(impl)"; |
| 499 |
push(@headerContent, <<END); |
553 |
push(@headerContent, <<END); |
| 500 |
v8::Handle<v8::Object> wrapper = $getCachedWrapper; |
554 |
v8::Handle<v8::Object> wrapper = $getCachedWrapper; |
|
Lines 991-997
END
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec5
|
| 991 |
# Check for a wrapper in the wrapper cache. If there is one, we know that a hidden reference has already |
1045 |
# Check for a wrapper in the wrapper cache. If there is one, we know that a hidden reference has already |
| 992 |
# been created. If we don't find a wrapper, we create both a wrapper and a hidden reference. |
1046 |
# been created. If we don't find a wrapper, we create both a wrapper and a hidden reference. |
| 993 |
push(@implContentDecls, " RefPtr<$returnType> result = ${getterString};\n"); |
1047 |
push(@implContentDecls, " RefPtr<$returnType> result = ${getterString};\n"); |
| 994 |
my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName, "info.GetIsolate()"); |
1048 |
my $domMapFunction = GetDomMapFunction($dataNode, "info.GetIsolate()"); |
| 995 |
push(@implContentDecls, " v8::Handle<v8::Value> wrapper = result.get() ? ${domMapFunction}.get(result.get()) : v8::Handle<v8::Object>();\n"); |
1049 |
push(@implContentDecls, " v8::Handle<v8::Value> wrapper = result.get() ? ${domMapFunction}.get(result.get()) : v8::Handle<v8::Object>();\n"); |
| 996 |
push(@implContentDecls, " if (wrapper.IsEmpty()) {\n"); |
1050 |
push(@implContentDecls, " if (wrapper.IsEmpty()) {\n"); |
| 997 |
push(@implContentDecls, " wrapper = toV8(result.get(), info.GetIsolate());\n"); |
1051 |
push(@implContentDecls, " wrapper = toV8(result.get(), info.GetIsolate());\n"); |
|
Lines 1827-1833
END
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec6
|
| 1827 |
push(@implContent, " goto fail;\n"); |
1881 |
push(@implContent, " goto fail;\n"); |
| 1828 |
} |
1882 |
} |
| 1829 |
|
1883 |
|
| 1830 |
my $DOMObject = GetDomMapName($dataNode, $implClassName); |
1884 |
my $DOMObject = GetDomMapName($dataNode); |
| 1831 |
push(@implContent, <<END); |
1885 |
push(@implContent, <<END); |
| 1832 |
|
1886 |
|
| 1833 |
V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get()); |
1887 |
V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get()); |
|
Lines 2002-2008
END
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec7
|
| 2002 |
push(@implContent, " goto fail;\n"); |
2056 |
push(@implContent, " goto fail;\n"); |
| 2003 |
} |
2057 |
} |
| 2004 |
|
2058 |
|
| 2005 |
my $DOMObject = GetDomMapName($dataNode, $implClassName); |
2059 |
my $DOMObject = GetDomMapName($dataNode); |
| 2006 |
push(@implContent, <<END); |
2060 |
push(@implContent, <<END); |
| 2007 |
|
2061 |
|
| 2008 |
V8DOMWrapper::setDOMWrapper(wrapper, &V8${implClassName}Constructor::info, impl.get()); |
2062 |
V8DOMWrapper::setDOMWrapper(wrapper, &V8${implClassName}Constructor::info, impl.get()); |
|
Lines 3217-3223
sub GenerateToV8Converters
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec8
|
| 3217 |
my $className = shift; |
3271 |
my $className = shift; |
| 3218 |
my $nativeType = shift; |
3272 |
my $nativeType = shift; |
| 3219 |
|
3273 |
|
| 3220 |
my $domMapName = GetDomMapName($dataNode, $interfaceName); |
3274 |
my $domMapName = GetDomMapName($dataNode); |
| 3221 |
my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : ""; |
3275 |
my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : ""; |
| 3222 |
my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : ""; |
3276 |
my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : ""; |
| 3223 |
my $wrapSlowArgumentType = GetPassRefPtrType($nativeType); |
3277 |
my $wrapSlowArgumentType = GetPassRefPtrType($nativeType); |
|
Lines 3315-3330
END
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec9
|
| 3315 |
sub GetDomMapFunction |
3369 |
sub GetDomMapFunction |
| 3316 |
{ |
3370 |
{ |
| 3317 |
my $dataNode = shift; |
3371 |
my $dataNode = shift; |
| 3318 |
my $interfaceName = shift; |
|
|
| 3319 |
my $getIsolate = shift; |
3372 |
my $getIsolate = shift; |
| 3320 |
|
3373 |
|
| 3321 |
return "get" . GetDomMapName($dataNode, $interfaceName) . "Map(" . $getIsolate . ")"; |
3374 |
return "get" . GetDomMapName($dataNode) . "Map(" . $getIsolate . ")"; |
| 3322 |
} |
3375 |
} |
| 3323 |
|
3376 |
|
| 3324 |
sub GetDomMapName |
3377 |
sub GetDomMapName |
| 3325 |
{ |
3378 |
{ |
| 3326 |
my $dataNode = shift; |
3379 |
my $dataNode = shift; |
| 3327 |
my $type = shift; |
|
|
| 3328 |
|
3380 |
|
| 3329 |
return "ActiveDOMNode" if (IsNodeSubType($dataNode) && $dataNode->extendedAttributes->{"ActiveDOMObject"}); |
3381 |
return "ActiveDOMNode" if (IsNodeSubType($dataNode) && $dataNode->extendedAttributes->{"ActiveDOMObject"}); |
| 3330 |
return "DOMNode" if IsNodeSubType($dataNode); |
3382 |
return "DOMNode" if IsNodeSubType($dataNode); |
|
Lines 3332-3337
sub GetDomMapName
a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec10
|
| 3332 |
return "DOMObject"; |
3384 |
return "DOMObject"; |
| 3333 |
} |
3385 |
} |
| 3334 |
|
3386 |
|
|
|
3387 |
sub GetStoreDomMapNameFunction |
| 3388 |
{ |
| 3389 |
my $dataNode = shift; |
| 3390 |
my $domMapName = GetDomMapName($dataNode); |
| 3391 |
|
| 3392 |
return "domNodeMap" if ($domMapName eq "DOMNode"); |
| 3393 |
return "activeDomNodeMap" if ($domMapName eq "ActiveDOMNode"); |
| 3394 |
return "activeDomObjectMap" if ($domMapName eq "ActiveDOMObject"); |
| 3395 |
return "domObjectMap" if ($domMapName eq "DOMObject"); |
| 3396 |
} |
| 3397 |
|
| 3335 |
sub GetNativeTypeForConversions |
3398 |
sub GetNativeTypeForConversions |
| 3336 |
{ |
3399 |
{ |
| 3337 |
my $dataNode = shift; |
3400 |
my $dataNode = shift; |