[Qt] Replace use of internal Weak smart pointer with JSWeakObjectMap
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Aug 2012 20:44:33 +0000 (20:44 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Aug 2012 20:44:33 +0000 (20:44 +0000)
commit1c4a155dd35df1d8a563107bea06a3b0b77c7cb4
treec830ec74cc0dac36224a33b041ea519de73b3f42
parent7f655c86e914fde1ccf6cc3c9f4686b1fdd644ca
[Qt] Replace use of internal Weak smart pointer with JSWeakObjectMap
https://bugs.webkit.org/show_bug.cgi?id=93872

Reviewed by Kenneth Rohde Christiansen.

Source/JavaScriptCore:

* Target.pri: Add missing JSWeakObjectMap file to build.

Source/WebCore:

The intention of this patch series is to replace use of internal JSC
API with use of the stable and public C API.

The JSC::Weak template is internal API and the only part of the C API
that exposes similar functionality is the JSWeakObjectMap. It is
special in the sense that its life-time is tied to the life-time of the
JS global object, which in turn is subject to garbage collection. In
order to maximize re-use of the same map across different JSContextRef
instances, we use the associated global context ref as owner of the
weak maps. The key in the weak map is the identity (pointer) of the
runtime method object itself.  The iteration through the maps is
tedious, but should usually not go beyond just a few.

* bridge/qt/qt_runtime.cpp:
(Bindings):
(JSC::Bindings::methodMapCleaner):
(JSC::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
(JSC::Bindings::QtRuntimeMethod::jsObjectRef):
* bridge/qt/qt_runtime.h:
(QtRuntimeMethod):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Target.pri
Source/WebCore/ChangeLog
Source/WebCore/bridge/qt/qt_runtime.cpp
Source/WebCore/bridge/qt/qt_runtime.h