diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-10 12:34:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-16 13:40:17 +0000 |
commit | b220a20552838fbafbbf126b9e50d148ae76518d (patch) | |
tree | 172e81559ed85ac0cdfedd4af9a9029bbdb15ecd /src/qml/qml/qqmlvaluetypewrapper_p.h | |
parent | 3fa8540800c43ccc4e4c1f8f323fb5ade34044db (diff) |
Speed up value type binding creation
* Avoid calling QMetaType::construct/destruct(typeId, ...) as that requires
repeated lookups in the type registry. Instead cache the constructor/destructor/etc.
function addresses in the QQmlValueType singletons as QMetaType
* Allocate memory for the gadget pointer lazily, to accommodate the common case of
a value type binding by property reference.
Change-Id: I98a3ac73453b8f80027c06401b4f29a9707949d2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvaluetypewrapper_p.h')
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper_p.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h index 0b8c30d0d5..6118511852 100644 --- a/src/qml/qml/qqmlvaluetypewrapper_p.h +++ b/src/qml/qml/qqmlvaluetypewrapper_p.h @@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE class QV8Engine; +class QQmlValueType; namespace QV4 { @@ -62,13 +63,12 @@ namespace Heap { struct QQmlValueTypeWrapper : Object { QQmlValueTypeWrapper(ExecutionEngine *engine); ~QQmlValueTypeWrapper(); - mutable QQmlRefPointer<QQmlPropertyCache> propertyCache; + QQmlRefPointer<QQmlPropertyCache> propertyCache; mutable void *gadgetPtr; - mutable int metaType; + QQmlValueType *valueType; void setValue(const QVariant &value) const; QVariant toVariant() const; - void *gadget() const { return gadgetPtr; } }; } @@ -84,8 +84,9 @@ public: static ReturnedValue create(ExecutionEngine *engine, const QVariant &, const QMetaObject *metaObject, int typeId); QVariant toVariant() const; - void toGadget(void *data) const; + bool toGadget(void *data) const; bool isEqual(const QVariant& value); + int typeId() const; static ReturnedValue get(Managed *m, String *name, bool *hasProperty); static void put(Managed *m, String *name, const Value &value); |