JS wrappers of DOM objects should have no-op constructors
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 23:46:54 +0000 (23:46 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 23:46:54 +0000 (23:46 +0000)
commit32c41ba03dffa16cbcfcd4b80e55cb6da9fa8d94
tree835b4b0877059f4e9bb5607ad8dfcd53f9953a65
parent59a38bb2f941b9f80d0884d20301f2e19d981f7e
JS wrappers of DOM objects should have no-op constructors
https://bugs.webkit.org/show_bug.cgi?id=72556

Reviewed by Geoffrey Garen.

Stop using a RefPtr to hold DOM objects contained by JavaScript
wrappers and instead use a raw pointer. We were already releasing
the underlying object before the destructor ran (via the finalizer)
so the default behavior of destroying the RefPtr is always unnecessary
busy work.

* bindings/js/JSCSSValueCustom.cpp:
(WebCore::JSCSSValueOwner::finalize):
* bindings/js/JSNodeCustom.cpp:
(WebCore::JSNodeOwner::finalize):
(WebCore::JSNode::visitChildren):
Call releaseImpl() instead of clearImpl().

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
Stop storing m_impl in a RefPtr and instead use a raw pointer. Switch
clearImpl() to releaseImpl(), which explicitly derefs the pointer and
clear it.

(GenerateImplementation):
Use leakPtr() to explicitly adopt the PassRefPtr into the raw pointer.
Change default finalize to call releaseImpl() instead of clearImpl().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100517 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSCSSValueCustom.cpp
Source/WebCore/bindings/js/JSNodeCustom.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm