diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-01-13 09:01:29 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2015-01-13 22:42:04 +0100 |
commit | 39f1e0d66dc434e764731fbfed29c8fd98d217aa (patch) | |
tree | d9855dbedd752c23395ccb6d4d3dc8fc3bece254 /src/qml/jsruntime/qv4persistent_p.h | |
parent | a38f9ec6c96559efa56e8f7346f74f5990810c3a (diff) |
Make sure we always have an engine when assigning to a Persistent
This prepares things for a rewrite of the internals of Persistent.
Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4persistent_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4persistent_p.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h index 9ccab914a7..41c482fbb7 100644 --- a/src/qml/jsruntime/qv4persistent_p.h +++ b/src/qml/jsruntime/qv4persistent_p.h @@ -71,15 +71,17 @@ public: PersistentValue() : d(0) {} PersistentValue(const PersistentValue &other); PersistentValue &operator=(const PersistentValue &other); - - PersistentValue(const ValueRef val); - PersistentValue(ReturnedValue val); - PersistentValue &operator=(const ValueRef other); - PersistentValue &operator=(const ScopedValue &other); - PersistentValue &operator =(ReturnedValue other); - PersistentValue &operator=(Heap::Base *obj); + PersistentValue &operator=(const WeakValue &other); + PersistentValue &operator=(Object *object); ~PersistentValue(); + PersistentValue(ExecutionEngine *engine, const ValueRef val); + PersistentValue(ExecutionEngine *engine, ReturnedValue val); + + void set(ExecutionEngine *engine, const ValueRef val); + void set(ExecutionEngine *engine, ReturnedValue val); + void set(ExecutionEngine *engine, Heap::Base *obj); + ReturnedValue value() const { return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue()); } @@ -89,7 +91,7 @@ public: return d->value.asManaged(); } - ExecutionEngine *engine() { + ExecutionEngine *engine() const { if (!d) return 0; if (d->engine) @@ -113,20 +115,19 @@ class Q_QML_EXPORT WeakValue { public: WeakValue() : d(0) {} - WeakValue(const ValueRef val); WeakValue(const WeakValue &other); - WeakValue(ReturnedValue val); WeakValue &operator=(const WeakValue &other); - WeakValue &operator=(const ValueRef other); - WeakValue &operator =(const ReturnedValue &other); - ~WeakValue(); + void set(ExecutionEngine *e, const ValueRef val); + void set(ExecutionEngine *e, ReturnedValue val); + void set(ExecutionEngine *e, Heap::Base *obj); + ReturnedValue value() const { return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue()); } - ExecutionEngine *engine() { + ExecutionEngine *engine() const { if (!d) return 0; if (d->engine) |