aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-27 14:30:09 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-04 15:22:58 +0100
commit186f8e2f76dc6995d14e6632d9b9d704198feda2 (patch)
tree6213cee17297940c46c9ff0a52160a42152d0b4a /src/qml/qml/qqmlobjectcreator_p.h
parentb02bed1caae6966925b9efb04e1db79c3e9ef687 (diff)
[new compiler] Fix some qqmlincubator tests
We need to track the objects created and pass them over to the VME guard used in the incubator. The incremental build nature of the incubator requires that to avoid crashes. For nested incubators we need to set the activeVMEData field in the root QQmlContext, to allow child incubators to locate the parent. Lastly we need can emulate most of the VME behavior in terms of build states when running with QQmlInstantiationInterrupt by presenting four build steps: The initial state, two build steps, a finalization step and the state when we're done. Change-Id: I16cd7f71744decb9d4735ec77e9d944fad18e88d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator_p.h')
-rw-r--r--src/qml/qml/qqmlobjectcreator_p.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h
index 58cb55e633..cda17fe220 100644
--- a/src/qml/qml/qqmlobjectcreator_p.h
+++ b/src/qml/qml/qqmlobjectcreator_p.h
@@ -61,6 +61,7 @@ struct QQmlObjectCreatorSharedState
QQmlContextData *creationContext;
QFiniteStack<QQmlAbstractBinding*> allCreatedBindings;
QFiniteStack<QQmlParserStatus*> allParserStatusCallbacks;
+ QFiniteStack<QObject*> allCreatedObjects;
QQmlComponentAttached *componentAttached;
QList<QQmlEnginePrivate::FinalizeCallback> finalizeCallbacks;
QRecursionNode recursionNode;
@@ -70,11 +71,12 @@ class QQmlObjectCreator
{
Q_DECLARE_TR_FUNCTIONS(QQmlObjectCreator)
public:
- QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledData *compiledData, QQmlContextData *creationContext);
+ QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledData *compiledData, QQmlContextData *creationContext, void *activeVMEDataForRootContext = 0);
~QQmlObjectCreator();
- QObject *create(int subComponentIndex = -1, QObject *parent = 0);
+ QObject *create(int subComponentIndex = -1, QObject *parent = 0, QQmlInstantiationInterrupt *interrupt = 0);
QQmlContextData *finalize(QQmlInstantiationInterrupt &interrupt);
+ void clear();
QQmlComponentAttached **componentAttachment() { return &sharedState->componentAttached; }
@@ -83,6 +85,7 @@ public:
QList<QQmlError> errors;
QQmlContextData *parentContextData() const { return parentContext; }
+ QFiniteStack<QObject*> &allCreatedObjects() const { return sharedState->allCreatedObjects; }
private:
QQmlObjectCreator(QQmlContextData *contextData, QQmlCompiledData *compiledData, QQmlObjectCreatorSharedState *inheritedSharedState);
@@ -103,6 +106,15 @@ private:
QString stringAt(int idx) const { return qmlUnit->header.stringAt(idx); }
void recordError(const QV4::CompiledData::Location &location, const QString &description);
+ enum Phase {
+ Startup,
+ CreatingObjects,
+ CreatingObjectsPhase2,
+ ObjectsCreated,
+ Finalizing,
+ Done
+ } phase;
+
QQmlEngine *engine;
QQmlCompiledData *compiledData;
const QV4::CompiledData::QmlUnit *qmlUnit;
@@ -113,6 +125,7 @@ private:
const QVector<QByteArray> &vmeMetaObjectData;
QHash<int, int> objectIndexToId;
QFlagPointer<QQmlObjectCreatorSharedState> sharedState;
+ void *activeVMEDataForRootContext;
QObject *_qobject;
QObject *_scopeObject;