diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-24 17:12:57 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-05-24 19:48:37 +0200 |
commit | de6642b1a97840e204f9d45275ca29a859a890d0 (patch) | |
tree | 5936ca3fa90ce9199459e16c0379424923a6ae46 /src/qml/qml/qqmlvmemetaobject_p.h | |
parent | 788252a2e80ef7e27ab1347d998b482091f93863 (diff) |
Implement JS ownership policy for var and variant properties
Instead of a GC callback, let's keep the lifecycle of the var properties and
the QObject wrapped variants in sync with the lifecycle of the JS QObject
wrapper, through a markObjects re-implementation.
handleReferenceManagement test passes now, fixed a few incorrect gc() calls
in there.
Change-Id: I78e8ca700e41bba788b61d3816a77cfb3a7c5e58
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvmemetaobject_p.h')
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject_p.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index cb437683e5..d0e86a1e6d 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -159,8 +159,7 @@ class QV8QObjectWrapper; class QQmlVMEVariant; class QQmlRefCount; class QQmlVMEMetaObjectEndpoint; -class Q_QML_PRIVATE_EXPORT QQmlVMEMetaObject : public QAbstractDynamicMetaObject, - public QV8GCCallback::Node +class Q_QML_PRIVATE_EXPORT QQmlVMEMetaObject : public QAbstractDynamicMetaObject { public: QQmlVMEMetaObject(QObject *obj, QQmlPropertyCache *cache, const QQmlVMEMetaData *data); @@ -205,14 +204,16 @@ public: QQmlVMEVariant *data; QQmlVMEMetaObjectEndpoint *aliasEndpoints; - QV4::PersistentValue varProperties; + QV4::WeakValue varProperties; int firstVarPropertyIndex; bool varPropertiesInitialized; - static void VarPropertiesWeakReferenceCallback(QV4::PersistentValue &object, void* parameter); - static void GcPrologueCallback(QV8GCCallback::Node *node); inline void allocateVarPropertiesArray(); inline bool ensureVarPropertiesAllocated(); + void ensureQObjectWrapper(); + + void mark(); + void connectAlias(int aliasId); QBitArray aConnected; |