aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-06-14 15:44:09 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-06-16 18:00:35 +0000
commit0058ac5f28c64979f359972e03ee91ae146b0cd3 (patch)
treeb9063a18a2182668424ce22e5a3cd95f4e1e2b15 /src/qml/compiler/qqmltypecompiler_p.h
parentc2c13cacd450d866e60c58c87ff1ab16ae736804 (diff)
Clean up property cache array handling
The QQmlPropertyCacheVector in the CompilationUnit encapsulates the property caches for the objects declared in the QML tree as well as the bits indicating whether a VME meta-object is needed. The ref-counting for the caches in that vector was done "manually" and thus error prone. This patch replaces the vector with a wrapper container that has explicit move semantics and takes care of the addref() and release() calls upon insertion, replacement and destruction. Change-Id: If805fe016f1a1c70e56f8a90909ab87b653ea026 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler_p.h')
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index 5e8bf4538e..07ad65d473 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -98,8 +98,9 @@ public:
QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference *> *resolvedTypes();
QList<QmlIR::Object*> *qmlObjects();
int rootObjectIndex() const;
- void setPropertyCaches(const QQmlPropertyCacheVector &caches);
- const QQmlPropertyCacheVector &propertyCaches() const;
+ void setPropertyCaches(QQmlPropertyCacheVector &&caches);
+ const QQmlPropertyCacheVector *propertyCaches() const;
+ QQmlPropertyCacheVector &&takePropertyCaches();
void setComponentRoots(const QVector<quint32> &roots) { m_componentRoots = roots; }
const QVector<quint32> &componentRoots() const { return m_componentRoots; }
QQmlJS::MemoryPool *memoryPool();
@@ -173,7 +174,7 @@ private:
const QHash<int, QQmlCustomParser*> &customParsers;
const QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> &resolvedTypes;
const QSet<QString> &illegalNames;
- const QQmlPropertyCacheVector &propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
};
// ### This will go away when the codegen resolves all enums to constant expressions
@@ -200,7 +201,7 @@ private:
const QList<QmlIR::Object*> &qmlObjects;
- const QQmlPropertyCacheVector propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
const QQmlImports *imports;
QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference *> *resolvedTypes;
};
@@ -228,7 +229,7 @@ public:
void annotateBindingsToAliases();
private:
const QList<QmlIR::Object*> &qmlObjects;
- const QQmlPropertyCacheVector propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
};
class QQmlScriptStringScanner : public QQmlCompilePass
@@ -240,7 +241,7 @@ public:
private:
const QList<QmlIR::Object*> &qmlObjects;
- const QQmlPropertyCacheVector propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
};
class QQmlComponentAndAliasResolver : public QQmlCompilePass
@@ -284,7 +285,7 @@ private:
bool scanObject(int objectIndex);
QList<QmlIR::Object*> *qmlObjects;
- QQmlPropertyCacheVector propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
const QHash<int, QQmlCustomParser*> &customParsers;
bool _seenObjectWithId;
@@ -294,7 +295,7 @@ class QQmlPropertyValidator : public QQmlCompilePass
{
Q_DECLARE_TR_FUNCTIONS(QQmlPropertyValidator)
public:
- QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler);
+ QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler, const QQmlPropertyCacheVector *propertyCaches);
bool validate();
@@ -312,7 +313,7 @@ private:
const QV4::CompiledData::Unit *qmlUnit;
const QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> &resolvedTypes;
const QHash<int, QQmlCustomParser*> &customParsers;
- const QQmlPropertyCacheVector &propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
// collected state variables, essentially write-only
mutable QVector<QV4::CompiledData::BindingPropertyData> _bindingPropertyDataPerObject;
@@ -333,7 +334,7 @@ private:
const QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> &resolvedTypes;
const QHash<int, QQmlCustomParser*> &customParsers;
const QList<QmlIR::Object*> &qmlObjects;
- const QQmlPropertyCacheVector &propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
QmlIR::JSCodeGen * const v4CodeGen;
};
@@ -348,7 +349,7 @@ private:
void mergeDefaultProperties(int objectIndex);
const QList<QmlIR::Object*> &qmlObjects;
- const QQmlPropertyCacheVector &propertyCaches;
+ const QQmlPropertyCacheVector * const propertyCaches;
};
class QQmlJavaScriptBindingExpressionSimplificationPass : public QQmlCompilePass