Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (134939 => 134940)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-11-16 13:47:03 UTC (rev 134939)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-11-16 13:59:50 UTC (rev 134940)
@@ -46,8 +46,6 @@
my %implIncludes = ();
my %headerIncludes = ();
-my @allParents = ();
-
# Default .h template
my $headerTemplate = << "EOF";
/*
@@ -291,11 +289,12 @@
my $className = "V8$interfaceName";
# Copy contents of parent classes except the first parent.
- $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@allParents, 1);
+ my @parents;
+ $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@parents, 1);
$codeGenerator->LinkOverloadedFunctions($dataNode);
# Ensure the IsDOMNodeType function is in sync.
- die("IsDOMNodeType is out of date with respect to $interfaceName") if IsDOMNodeType($interfaceName) != IsNodeSubType($dataNode);
+ die("IsDOMNodeType is out of date with respect to $interfaceName") if IsDOMNodeType($interfaceName) != $codeGenerator->IsSubType($dataNode, "Node");
my $hasDependentLifetime = $dataNode->extendedAttributes->{"V8DependentLifetime"} || $dataNode->extendedAttributes->{"ActiveDOMObject"}
|| GetGenerateIsReachable($dataNode) || $className =~ /SVG/;
@@ -537,7 +536,7 @@
my $customWrap = !!($dataNode->extendedAttributes->{"CustomToJSObject"} or $dataNode->extendedAttributes->{"V8CustomToJSObject"});
if ($noToV8) {
- die "Can't suppress toV8 for subclass\n" if @allParents;
+ die "Can't suppress toV8 for subclass\n" if @parents;
} elsif ($noWrap) {
die "Must have custom toV8\n" if !$customWrap;
push(@headerContent, <<END);
@@ -551,7 +550,7 @@
END
} else {
- my $getCachedWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getCachedWrapper(impl)" : "DOMDataStore::current(isolate)->get(impl)";
+ my $getCachedWrapper = $codeGenerator->IsSubType($dataNode, "Node") ? "V8DOMWrapper::getCachedWrapper(impl)" : "DOMDataStore::current(isolate)->get(impl)";
my $createWrapperCall = $customWrap ? "${className}::wrap" : "${className}::createWrapper";
if ($customWrap) {
@@ -593,7 +592,7 @@
return wrap(impl, creationContext, isolate);
}
END
- if (IsNodeSubType($dataNode)) {
+ if ($codeGenerator->IsSubType($dataNode, "Node")) {
push(@headerContent, <<END);
inline v8::Handle<v8::Value> toV8Fast(${nativeType}* impl, const v8::AccessorInfo& info, Node* holder)
@@ -642,11 +641,11 @@
# so special-case AbstractWorker and WorkerContext to include all sub-types.
# Event listeners on DOM nodes are explicitly supported in the GC controller.
# FIXME: Simplify this when all EventTargets are subtypes of EventTarget.
- if (!IsNodeSubType($dataNode)
+ if (!$codeGenerator->IsSubType($dataNode, "Node")
&& ($dataNode->extendedAttributes->{"EventTarget"}
|| $dataNode->extendedAttributes->{"IsWorkerContext"}
- || IsSubType($dataNode, "AbstractWorker")
- || IsSubType($dataNode, "EventTarget"))) {
+ || $codeGenerator->IsSubType($dataNode, "AbstractWorker")
+ || $codeGenerator->IsSubType($dataNode, "EventTarget"))) {
push(@customInternalFields, "eventListenerCacheIndex");
}
@@ -772,24 +771,6 @@
}
}
-sub IsSubType
-{
- my $dataNode = shift;
- my $parentType = shift;
- return 1 if ($dataNode->name eq $parentType);
- foreach (@allParents) {
- my $parent = $_;
- return 1 if $parent eq $parentType;
- }
- return 0;
-}
-
-sub IsNodeSubType
-{
- my $dataNode = shift;
- return IsSubType($dataNode, "Node");
-}
-
sub IsVisibleAcrossOrigins
{
my $dataNode = shift;
@@ -968,7 +949,7 @@
} else {
my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
my $url = ""
- if ($getterStringUsesImp && $reflect && !$url && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) {
+ if ($getterStringUsesImp && $reflect && !$url && $codeGenerator->IsSubType($dataNode, "Node") && $codeGenerator->IsStringType($attrType)) {
# Generate super-compact call for regular attribute getter:
my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attrName : $reflect;
my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
@@ -1062,7 +1043,7 @@
# Special case for readonly or Replaceable attributes (with a few exceptions). This attempts to ensure that JS wrappers don't get
# garbage-collected prematurely when their lifetime is strongly tied to their owner. We accomplish this by inserting a reference to
# the newly created wrapper into an internal field of the holder object.
- if (!IsNodeSubType($dataNode) && $attrName ne "self" && IsWrapperType($returnType) && (IsReadonly($attribute) || $attribute->signature->extendedAttributes->{"Replaceable"} || $attrName eq "location")
+ if (!$codeGenerator->IsSubType($dataNode, "Node") && $attrName ne "self" && IsWrapperType($returnType) && (IsReadonly($attribute) || $attribute->signature->extendedAttributes->{"Replaceable"} || $attrName eq "location")
&& $returnType ne "EventTarget" && $returnType ne "SerializedScriptValue" && $returnType ne "DOMWindow"
&& $returnType ne "MessagePortArray"
&& $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType)) {
@@ -1251,7 +1232,7 @@
} else {
my $attrType = GetTypeFromSignature($attribute->signature);
my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
- if ($reflect && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) {
+ if ($reflect && $codeGenerator->IsSubType($dataNode, "Node") && $codeGenerator->IsStringType($attrType)) {
# Generate super-compact call for regular attribute setter:
my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attrName : $reflect;
my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
@@ -1310,7 +1291,7 @@
if ($attribute->signature->type eq "EventListener") {
my $implSetterFunctionName = $codeGenerator->WK_ucfirst($attrName);
AddToImplIncludes("V8AbstractEventListener.h");
- if (!IsNodeSubType($dataNode)) {
+ if (!$codeGenerator->IsSubType($dataNode, "Node")) {
push(@implContentDecls, " transferHiddenDependency(info.Holder(), imp->$attrName(), value, V8${interfaceName}::eventListenerCacheIndex);\n");
}
if ($interfaceName eq "WorkerContext" and $attribute->signature->name eq "onerror") {
@@ -1563,10 +1544,10 @@
# but they are extremely consistent across the various classes that take event listeners,
# so we can generate them as a "special case".
if ($name eq "addEventListener") {
- GenerateEventListenerCallback($interfaceName, !IsNodeSubType($dataNode), "add");
+ GenerateEventListenerCallback($interfaceName, !$codeGenerator->IsSubType($dataNode, "Node"), "add");
return;
} elsif ($name eq "removeEventListener") {
- GenerateEventListenerCallback($interfaceName, !IsNodeSubType($dataNode), "remove");
+ GenerateEventListenerCallback($interfaceName, !$codeGenerator->IsSubType($dataNode, "Node"), "remove");
return;
}
@@ -2503,7 +2484,7 @@
}
}
- my $hasEnumerator = !$isSpecialCase && IsNodeSubType($dataNode);
+ my $hasEnumerator = !$isSpecialCase && $codeGenerator->IsSubType($dataNode, "Node");
# FIXME: Find a way to not have to special-case HTMLOptionsCollection.
if ($interfaceName eq "HTMLOptionsCollection") {
@@ -3490,7 +3471,7 @@
my $createWrapperArgumentType = GetPassRefPtrType($nativeType);
my $baseType = BaseInterfaceName($dataNode);
- my $getCachedWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getCachedWrapper(impl.get())" : "DOMDataStore::current(isolate)->get(impl.get())";
+ my $getCachedWrapper = $codeGenerator->IsSubType($dataNode, "Node") ? "V8DOMWrapper::getCachedWrapper(impl.get())" : "DOMDataStore::current(isolate)->get(impl.get())";
push(@implContent, <<END);
@@ -3507,7 +3488,7 @@
AddToImplIncludes("Frame.h");
- if (IsSubType($dataNode, "Document")) {
+ if ($codeGenerator->IsSubType($dataNode, "Document")) {
push(@implContent, <<END);
if (Frame* frame = impl->frame()) {
if (frame->script()->initializeMainWorld()) {