1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QQMLINCUBATOR_P_H |
5 | #define QQMLINCUBATOR_P_H |
6 | |
7 | #include "qqmlincubator.h" |
8 | |
9 | #include <private/qintrusivelist_p.h> |
10 | #include <private/qqmlvme_p.h> |
11 | #include <private/qrecursionwatcher_p.h> |
12 | #include <private/qqmlengine_p.h> |
13 | #include <private/qqmlguardedcontextdata_p.h> |
14 | |
15 | // |
16 | // W A R N I N G |
17 | // ------------- |
18 | // |
19 | // This file is not part of the Qt API. It exists purely as an |
20 | // implementation detail. This header file may change from version to |
21 | // version without notice, or even be removed. |
22 | // |
23 | // We mean it. |
24 | // |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class RequiredProperties; |
29 | |
30 | class QQmlIncubator; |
31 | class Q_QML_PRIVATE_EXPORT QQmlIncubatorPrivate : public QQmlEnginePrivate::Incubator, public QSharedData |
32 | { |
33 | public: |
34 | QQmlIncubatorPrivate(QQmlIncubator *q, QQmlIncubator::IncubationMode m); |
35 | ~QQmlIncubatorPrivate(); |
36 | |
37 | inline static QQmlIncubatorPrivate *get(QQmlIncubator *incubator) { return incubator->d; } |
38 | |
39 | int subComponentToCreate; |
40 | QQmlIncubator *q; |
41 | |
42 | QQmlIncubator::Status calculateStatus() const; |
43 | void changeStatus(QQmlIncubator::Status); |
44 | QQmlIncubator::Status status; |
45 | |
46 | QQmlIncubator::IncubationMode mode; |
47 | bool isAsynchronous; |
48 | enum Progress : char { Execute, Completing, Completed }; |
49 | Progress progress; |
50 | |
51 | QList<QQmlError> errors; |
52 | |
53 | |
54 | QPointer<QObject> result; |
55 | enum HadTopLevelRequired : bool {No = 0, Yes = 1}; |
56 | /* TODO: unify with Creator pointer once QTBUG-108760 is implemented |
57 | though we don't acutally own the properties here; if we ever end up |
58 | with a use case for async incubation of C++ types, we however could |
59 | not rely on the component to still exist during incubation, and |
60 | would need to store a copy of the required properties instead |
61 | */ |
62 | QTaggedPointer<RequiredProperties, HadTopLevelRequired> requiredPropertiesFromComponent; |
63 | QQmlGuardedContextData rootContext; |
64 | QQmlEnginePrivate *enginePriv; |
65 | QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit; |
66 | QScopedPointer<QQmlObjectCreator> creator; |
67 | QQmlVMEGuard vmeGuard; |
68 | |
69 | QExplicitlySharedDataPointer<QQmlIncubatorPrivate> waitingOnMe; |
70 | typedef QQmlEnginePrivate::Incubator QIPBase; |
71 | QIntrusiveListNode nextWaitingFor; |
72 | QIntrusiveList<QQmlIncubatorPrivate, &QQmlIncubatorPrivate::nextWaitingFor> waitingFor; |
73 | |
74 | QRecursionNode recursion; |
75 | QVariantMap initialProperties; |
76 | |
77 | void clear(); |
78 | |
79 | void forceCompletion(QQmlInstantiationInterrupt &i); |
80 | void incubate(QQmlInstantiationInterrupt &i); |
81 | void incubateCppBasedComponent(QQmlComponent *component, QQmlContext *context); |
82 | RequiredProperties *requiredProperties(); |
83 | bool hadTopLevelRequiredProperties() const; |
84 | }; |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | #endif // QQMLINCUBATOR_P_H |
89 | |
90 | |