From 32bcf89a330d422b0b99ac9090b104016418d07f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 18 Dec 2009 13:34:53 +1000 Subject: Support binding optimizer and deferred properties --- src/declarative/qml/qmlcontext.cpp | 5 ++++- src/declarative/qml/qmlcontext_p.h | 4 ++++ src/declarative/qml/qmlvme.cpp | 11 ++--------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index 49bb59c..4467cce 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE QmlContextPrivate::QmlContextPrivate() : parent(0), engine(0), isInternal(false), propertyNames(0), notifyIndex(-1), highPriorityCount(0), imports(0), expressions(0), contextObjects(0), - idValues(0), idValueCount(0) + idValues(0), idValueCount(0), optimizedBindings(0) { } @@ -303,6 +303,9 @@ QmlContext::~QmlContext() if (d->imports) d->imports->release(); + + if (d->optimizedBindings) + d->optimizedBindings->release(); } void QmlContextPrivate::invalidateEngines() diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index 35971d9..25f5600 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -76,6 +76,7 @@ class QmlExpression; class QmlExpressionPrivate; class QmlAbstractExpression; class QmlBinding_Id; +class QmlOptimizedBindings; class Q_DECLARATIVE_EXPORT QmlContextPrivate : public QObjectPrivate { @@ -133,6 +134,9 @@ public: static QmlContext *get(QmlContextPrivate *context) { return static_cast(context->q_func()); } + + QmlOptimizedBindings *optimizedBindings; + // Only used for debugging QList > instances; }; diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 58cd92f..f1abd7d 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -160,8 +160,6 @@ QObject *QmlVME::run(QmlVMEStack &stack, QmlContext *ctxt, int status = -1; //for dbus QmlMetaProperty::WriteFlags flags = QmlMetaProperty::BypassInterceptor; - QmlOptimizedBindings *optimizedBindings = 0; - for (int ii = start; !isError() && ii < (start + count); ++ii) { const QmlInstruction &instr = comp->bytecode.at(ii); @@ -175,7 +173,7 @@ QObject *QmlVME::run(QmlVMEStack &stack, QmlContext *ctxt, if (instr.init.contextCache != -1) cp->setIdPropertyData(comp->contextCaches.at(instr.init.contextCache)); if (instr.init.compiledBinding != -1) - optimizedBindings = new QmlOptimizedBindings(datas.at(instr.init.compiledBinding).constData(), ctxt); + cp->optimizedBindings = new QmlOptimizedBindings(datas.at(instr.init.compiledBinding).constData(), ctxt); } break; @@ -622,7 +620,7 @@ QObject *QmlVME::run(QmlVMEStack &stack, QmlContext *ctxt, break; QmlAbstractBinding *binding = - optimizedBindings->configBinding(instr.assignBinding.value, target, scope, property); + cp->optimizedBindings->configBinding(instr.assignBinding.value, target, scope, property); bindValues.append(binding); binding->m_mePtr = &bindValues.values[bindValues.count - 1]; binding->addToObject(target); @@ -894,11 +892,6 @@ QObject *QmlVME::run(QmlVMEStack &stack, QmlContext *ctxt, } } - if (optimizedBindings) { - optimizedBindings->release(); - optimizedBindings = 0; - } - if (isError()) { if (!stack.isEmpty()) { delete stack.at(0); -- cgit v0.12