aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-09-22 14:09:41 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-09-24 14:56:32 +0200
commitef8e2cd85d380ee9f19cb6642c11e9f7c9fc3a7d (patch)
treeabb06d9ad22ac7548be356fd4296c7b3ce38e79d /src/qml/qml/qqmlmetatype.cpp
parentd2d0bfe830330f30913973a79c080d3cc5b00a21 (diff)
Allow multiple cached qml unit registration functions
Only few will be necessary, but this allows for greater flexibility at run-time. Change-Id: Ia03abeb6296a5dee97544209c578dc2974af7cbc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index c09ab69424..d20fe72d09 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -98,7 +98,7 @@ struct QQmlMetaTypeData
QBitArray lists;
QList<QQmlPrivate::AutoParentFunction> parentFunctions;
- QQmlPrivate::QmlUnitCacheLookupFunction lookupCachedQmlUnit;
+ QVector<QQmlPrivate::QmlUnitCacheLookupFunction> lookupCachedQmlUnit;
QSet<QString> protectedNamespaces;
@@ -135,7 +135,6 @@ static uint qHash(const QQmlMetaTypeData::VersionedUri &v)
}
QQmlMetaTypeData::QQmlMetaTypeData()
- : lookupCachedQmlUnit(0)
{
}
@@ -1347,7 +1346,7 @@ int registerQmlUnitCacheHook(const QQmlPrivate::RegisterQmlUnitCacheHook &hookRe
qFatal("qmlRegisterType(): Cannot mix incompatible QML versions.");
QWriteLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
- data->lookupCachedQmlUnit = hookRegistration.lookupCachedQmlUnit;
+ data->lookupCachedQmlUnit << hookRegistration.lookupCachedQmlUnit;
return 0;
}
@@ -1877,8 +1876,11 @@ const QQmlPrivate::CachedQmlUnit *QQmlMetaType::findCachedCompilationUnit(const
{
QReadLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
- if (data->lookupCachedQmlUnit)
- return data->lookupCachedQmlUnit(uri);
+ for (QVector<QQmlPrivate::QmlUnitCacheLookupFunction>::ConstIterator it = data->lookupCachedQmlUnit.constBegin(), end = data->lookupCachedQmlUnit.constEnd();
+ it != end; ++it) {
+ if (const QQmlPrivate::CachedQmlUnit *unit = (*it)(uri))
+ return unit;
+ }
return 0;
}