Use PassRefPtr in V8DOMWrapper interface to avoid explicit ref() calls
https://bugs.webkit.org/show_bug.cgi?id=82238
Reviewed by Adam Barth.
The setJSWrapper* methods previously featured a comment that asked
callers to ref the objects before passing them in. This change makes
that contract explicit (and allows the removal of the comment).
In addition, for ConstructorCallbacks, this change slightly reduces
refcount churn by passing on the initial ref via RefPtr::release().
No new tests, no change in behavior.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateConstructorCallback): Use RefPtr::release() to avoid refcount churn and remove explicit ref() call.
(GenerateNamedConstructorCallback): ditto.
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::installDOMWindow): Cast to a PassRefPtr and remove explicit ref call.
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::setJSWrapperForDOMNode): Pass leaked refs into the DOMNodeMaps.
* bindings/v8/V8DOMWrapper.h:
(V8DOMWrapper): Make the setJSWrapperFor* methods take PassRefPtr<T>.
(WebCore::V8DOMWrapper::setJSWrapperForDOMObject): Pass leaked ref into the DOMObjectMap.
(WebCore::V8DOMWrapper::setJSWrapperForActiveDOMObject): Pass leaked ref into the ActiveDOMObjectMap.
* bindings/v8/V8Proxy.h:
(WebCore::toV8): Remove explicit ref.
* bindings/v8/WorkerContextExecutionProxy.cpp:
(WebCore::WorkerContextExecutionProxy::initContextIfNeeded): Cast to a PassRefPTr and remove explicit ref call.
* bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
(WebCore::v8HTMLImageElementConstructorCallback): Use RefPtr::release() to avoid refcount churn and remove explicit ref.
* bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
(WebCore::V8WebKitMutationObserver::constructorCallback): ditto.
* bindings/v8/custom/V8WebSocketCustom.cpp:
(WebCore::V8WebSocket::constructorCallback): ditto.
* bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
(WebCore::V8XMLHttpRequest::constructorCallback): ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112163
268f45cc-cd09-0410-ab3c-
d52691b4dbfc