Title: [112597] branches/chromium/1025/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Revision
112597
Author
[email protected]
Date
2012-03-29 16:09:33 -0700 (Thu, 29 Mar 2012)

Log Message

Merge 111813
BUG=118185
Review URL: https://chromiumcodereview.appspot.com/9939001

Modified Paths

Diff

Modified: branches/chromium/1025/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (112596 => 112597)


--- branches/chromium/1025/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-03-29 23:03:58 UTC (rev 112596)
+++ branches/chromium/1025/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-03-29 23:09:33 UTC (rev 112597)
@@ -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;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to