Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

Issue 9939001: Merge 111813 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
===================================================================
--- Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (revision 112582)
+++ Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (working copy)
@@ -434,11 +434,12 @@
END
}
+ my $wrapSlowArgumentType = GetPassRefPtrType($nativeType);
push(@headerContent, <<END);
static v8::Handle<v8::Object> existingWrapper(${nativeType}*);
private:
- static v8::Handle<v8::Object> wrapSlow(${nativeType}*);
+ static v8::Handle<v8::Object> wrapSlow(${wrapSlowArgumentType});
};
END
@@ -3041,10 +3042,11 @@
my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName);
my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : "";
my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : "";
+ my $wrapSlowArgumentType = GetPassRefPtrType($nativeType);
push(@implContent, <<END);
-v8::Handle<v8::Object> ${className}::wrapSlow(${nativeType}* impl)
+v8::Handle<v8::Object> ${className}::wrapSlow(${wrapSlowArgumentType} impl)
{
v8::Handle<v8::Object> wrapper;
V8Proxy* proxy = 0;
@@ -3054,10 +3056,10 @@
push(@implContent, <<END);
if (impl->document()) {
proxy = V8Proxy::retrieve(impl->document()->frame());
- if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>(impl)) {
+ if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>(impl.get())) {
if (proxy->windowShell()->context().IsEmpty() && proxy->windowShell()->initContextIfNeeded()) {
// initContextIfNeeded may have created a wrapper for the object, retry from the start.
- return ${className}::wrap(impl);
+ return ${className}::wrap(impl.get());
}
}
}
@@ -3092,7 +3094,7 @@
}
push(@implContent, <<END);
- wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
+ wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get());
END
if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) {
push(@implContent, <<END);
@@ -3106,8 +3108,6 @@
if (wrapper.IsEmpty())
return wrapper;
END
- push(@implContent, "\n impl->ref();\n") if IsRefPtrType($interfaceName);
-
if ($serializedAttribute) {
GenerateEagerDeserialization($serializedAttribute);
}
@@ -3122,12 +3122,9 @@
push(@implContent, <<END);
wrapperHandle.SetWrapperClassId(v8DOMSubtreeClassId);
END
- }
+ }
push(@implContent, <<END);
- ${domMapFunction}.set(impl, wrapperHandle);
-END
-
- push(@implContent, <<END);
+ ${domMapFunction}.set(impl.leakRef(), wrapperHandle);
return wrapper;
}
END
@@ -3898,6 +3895,14 @@
return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->name) . "Enabled";
}
+sub GetPassRefPtrType
+{
+ my $className = shift;
+
+ my $angleBracketSpace = $className =~ />$/ ? " " : "";
+ return "PassRefPtr<${className}${angleBracketSpace}>";
+}
+
sub DebugPrint
{
my $output = shift;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698