diff options
author | axis <qt-info@nokia.com> | 2011-02-24 16:07:22 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2011-02-24 16:07:22 (GMT) |
commit | 2b768ad7d4de4862584762a7d106d9cfcc3416df (patch) | |
tree | 0ddfe84f345d7e61ce71daa51fbbfb373c3e3106 /src/declarative/qml/qdeclarativeengine_p.h | |
parent | bb7d9bcc8e0c617091e91f7a40f3d33f8c1cdec1 (diff) | |
parent | ca7be48b7a150952a9657d1000941fb986e5bb2b (diff) | |
download | Qt-2b768ad7d4de4862584762a7d106d9cfcc3416df.zip Qt-2b768ad7d4de4862584762a7d106d9cfcc3416df.tar.gz Qt-2b768ad7d4de4862584762a7d106d9cfcc3416df.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt into earth-master
Conflicts:
src/network/access/qnetworkreplyimpl.cpp
tests/auto/moc/tst_moc.cpp
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine_p.h')
-rw-r--r-- | src/declarative/qml/qdeclarativeengine_p.h | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index fc996b5..88b4e80 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -251,8 +251,12 @@ public: QDeclarativeValueTypeFactory valueTypes; QHash<const QMetaObject *, QDeclarativePropertyCache *> propertyCache; + QHash<QPair<QDeclarativeType *, int>, QDeclarativePropertyCache *> typePropertyCache; inline QDeclarativePropertyCache *cache(QObject *obj); inline QDeclarativePropertyCache *cache(const QMetaObject *); + inline QDeclarativePropertyCache *cache(QDeclarativeType *, int, QDeclarativeError &error); + QDeclarativePropertyCache *createCache(const QMetaObject *); + QDeclarativePropertyCache *createCache(QDeclarativeType *, int, QDeclarativeError &error); void registerCompositeType(QDeclarativeCompiledData *); @@ -330,19 +334,17 @@ Returns a QDeclarativePropertyCache for \a obj if one is available. If \a obj is null, being deleted or contains a dynamic meta object 0 is returned. + +The returned cache is not referenced, so if it is to be stored, call addref(). */ QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QObject *obj) { - Q_Q(QDeclarativeEngine); if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted) return 0; const QMetaObject *mo = obj->metaObject(); QDeclarativePropertyCache *rv = propertyCache.value(mo); - if (!rv) { - rv = new QDeclarativePropertyCache(q, mo); - propertyCache.insert(mo, rv); - } + if (!rv) rv = createCache(mo); return rv; } @@ -352,18 +354,32 @@ Returns a QDeclarativePropertyCache for \a metaObject. As the cache is persisted for the life of the engine, \a metaObject must be a static "compile time" meta-object, or a meta-object that is otherwise known to exist for the lifetime of the QDeclarativeEngine. + +The returned cache is not referenced, so if it is to be stored, call addref(). */ QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(const QMetaObject *metaObject) { - Q_Q(QDeclarativeEngine); Q_ASSERT(metaObject); QDeclarativePropertyCache *rv = propertyCache.value(metaObject); - if (!rv) { - rv = new QDeclarativePropertyCache(q, metaObject); - propertyCache.insert(metaObject, rv); - } + if (!rv) rv = createCache(metaObject); + return rv; +} + +/*! +Returns a QDeclarativePropertyCache for \a type with \a minorVersion. + +The returned cache is not referenced, so if it is to be stored, call addref(). +*/ +QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QDeclarativeType *type, int minorVersion, QDeclarativeError &error) +{ + Q_ASSERT(type); + + if (minorVersion == -1 || !type->containsRevisionedAttributes()) + return cache(type->metaObject()); + QDeclarativePropertyCache *rv = typePropertyCache.value(qMakePair(type, minorVersion)); + if (!rv) rv = createCache(type, minorVersion, error); return rv; } |