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 QQMLTYPELOADERTHREAD_P_H |
5 | #define QQMLTYPELOADERTHREAD_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <private/qqmlthread_p.h> |
19 | #include <private/qv4compileddata_p.h> |
20 | #include <private/qqmldatablob_p.h> |
21 | |
22 | #include <QtQml/qtqmlglobal.h> |
23 | |
24 | #if QT_CONFIG(qml_network) |
25 | #include <private/qqmltypeloadernetworkreplyproxy_p.h> |
26 | #include <QtNetwork/qnetworkaccessmanager.h> |
27 | #endif |
28 | |
29 | QT_BEGIN_NAMESPACE |
30 | |
31 | class QQmlTypeLoader; |
32 | class QQmlEngineExtensionInterface; |
33 | class QQmlExtensionInterface; |
34 | |
35 | namespace QQmlPrivate { |
36 | struct CachedQmlUnit; |
37 | } |
38 | |
39 | class QQmlTypeLoaderThread : public QQmlThread |
40 | { |
41 | typedef QQmlTypeLoaderThread This; |
42 | |
43 | public: |
44 | QQmlTypeLoaderThread(QQmlTypeLoader *loader); |
45 | #if QT_CONFIG(qml_network) |
46 | QNetworkAccessManager *networkAccessManager() const; |
47 | QQmlTypeLoaderNetworkReplyProxy *networkReplyProxy() const; |
48 | #endif // qml_network |
49 | void load(const QQmlDataBlob::Ptr &b); |
50 | void loadAsync(const QQmlDataBlob::Ptr &b); |
51 | void loadWithStaticData(const QQmlDataBlob::Ptr &b, const QByteArray &); |
52 | void loadWithStaticDataAsync(const QQmlDataBlob::Ptr &b, const QByteArray &); |
53 | void loadWithCachedUnit(const QQmlDataBlob::Ptr &b, const QQmlPrivate::CachedQmlUnit *unit); |
54 | void loadWithCachedUnitAsync(const QQmlDataBlob::Ptr &b, const QQmlPrivate::CachedQmlUnit *unit); |
55 | void callCompleted(const QQmlDataBlob::Ptr &b); |
56 | void callDownloadProgressChanged(const QQmlDataBlob::Ptr &b, qreal p); |
57 | void initializeEngine(QQmlExtensionInterface *, const char *); |
58 | void initializeEngine(QQmlEngineExtensionInterface *, const char *); |
59 | |
60 | private: |
61 | void loadThread(const QQmlDataBlob::Ptr &b); |
62 | void loadWithStaticDataThread(const QQmlDataBlob::Ptr &b, const QByteArray &); |
63 | void loadWithCachedUnitThread(const QQmlDataBlob::Ptr &b, const QQmlPrivate::CachedQmlUnit *unit); |
64 | void callCompletedMain(const QQmlDataBlob::Ptr &b); |
65 | void callDownloadProgressChangedMain(const QQmlDataBlob::Ptr &b, qreal p); |
66 | void initializeExtensionMain(QQmlExtensionInterface *iface, const char *uri); |
67 | void initializeEngineExtensionMain(QQmlEngineExtensionInterface *iface, const char *uri); |
68 | |
69 | QQmlTypeLoader *m_loader; |
70 | #if QT_CONFIG(qml_network) |
71 | mutable QNetworkAccessManager *m_networkAccessManager = nullptr; |
72 | mutable QQmlTypeLoaderNetworkReplyProxy *m_networkReplyProxy = nullptr; |
73 | #endif // qml_network |
74 | }; |
75 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif // QQMLTYPELOADERTHREAD_P_H |
79 | |