diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-28 04:52:26 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-28 04:52:26 (GMT) |
commit | 044c93a48213e325f486c3076837a2a7cebbe9aa (patch) | |
tree | 628c1b627ff97de93a4bcc7d5a1e88a6d1664a18 /src/declarative/qml | |
parent | cfc536842a205a951457e2630b04de2262ffaa46 (diff) | |
download | Qt-044c93a48213e325f486c3076837a2a7cebbe9aa.zip Qt-044c93a48213e325f486c3076837a2a7cebbe9aa.tar.gz Qt-044c93a48213e325f486c3076837a2a7cebbe9aa.tar.bz2 |
Optimization: Skip attached property search where possible
QTBUG-6734
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlcontextscriptclass.cpp | 6 | ||||
-rw-r--r-- | src/declarative/qml/qmlobjectscriptclass.cpp | 32 | ||||
-rw-r--r-- | src/declarative/qml/qmlobjectscriptclass_p.h | 1 |
3 files changed, 22 insertions, 17 deletions
diff --git a/src/declarative/qml/qmlcontextscriptclass.cpp b/src/declarative/qml/qmlcontextscriptclass.cpp index eecc611..80d52ad 100644 --- a/src/declarative/qml/qmlcontextscriptclass.cpp +++ b/src/declarative/qml/qmlcontextscriptclass.cpp @@ -174,7 +174,8 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje if (scopeObject) { QScriptClass::QueryFlags rv = - ep->objectClass->queryProperty(scopeObject, name, flags, bindContext, QmlObjectScriptClass::ImplicitObject); + ep->objectClass->queryProperty(scopeObject, name, flags, bindContext, + QmlObjectScriptClass::ImplicitObject | QmlObjectScriptClass::SkipAttachedProperties); if (rv) { lastScopeObject = scopeObject; lastContext = bindContext; @@ -184,7 +185,8 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje for (int ii = cp->defaultObjects.count() - 1; ii >= 0; --ii) { QScriptClass::QueryFlags rv = - ep->objectClass->queryProperty(cp->defaultObjects.at(ii), name, flags, bindContext, QmlObjectScriptClass::ImplicitObject); + ep->objectClass->queryProperty(cp->defaultObjects.at(ii), name, flags, bindContext, + QmlObjectScriptClass::ImplicitObject | QmlObjectScriptClass::SkipAttachedProperties); if (rv) { lastDefaultObject = ii; diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 7194f33..f8af5a7 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -165,23 +165,25 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name, if (lastData) return QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess; - if (!evalContext && context()) { - // Global object, QScriptContext activation object, QmlContext object - QScriptValue scopeNode = scopeChainValue(context(), -3); - Q_ASSERT(scopeNode.isValid()); - Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass); - - evalContext = enginePrivate->contextClass->contextFromValue(scopeNode); - } + if (!(hints & SkipAttachedProperties)) { + if (!evalContext && context()) { + // Global object, QScriptContext activation object, QmlContext object + QScriptValue scopeNode = scopeChainValue(context(), -3); + Q_ASSERT(scopeNode.isValid()); + Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass); + + evalContext = enginePrivate->contextClass->contextFromValue(scopeNode); + } - if (evalContext) { - QmlContextPrivate *cp = QmlContextPrivate::get(evalContext); + if (evalContext) { + QmlContextPrivate *cp = QmlContextPrivate::get(evalContext); - if (cp->imports) { - QmlTypeNameCache::Data *data = cp->imports->data(name); - if (data) { - lastTNData = data; - return QScriptClass::HandlesReadAccess; + if (cp->imports) { + QmlTypeNameCache::Data *data = cp->imports->data(name); + if (data) { + lastTNData = data; + return QScriptClass::HandlesReadAccess; + } } } } diff --git a/src/declarative/qml/qmlobjectscriptclass_p.h b/src/declarative/qml/qmlobjectscriptclass_p.h index 36ba44f..ebb2c2a 100644 --- a/src/declarative/qml/qmlobjectscriptclass_p.h +++ b/src/declarative/qml/qmlobjectscriptclass_p.h @@ -136,6 +136,7 @@ private: QmlEngine *engine; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QmlObjectScriptClass::QueryHints); QT_END_NAMESPACE |