diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2018-07-02 22:27:11 +0200 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2018-09-05 00:00:09 +0000 |
commit | a7472867f407f1226d82aa7bce4cd4d6f9bd652f (patch) | |
tree | c4e0bf51bb665264b8ea771d2731ebf04dcac4c6 /src/qml | |
parent | eb6201b2af725d64e5e92f19a512b1ff23ceba51 (diff) |
Make QtDeclarative work for the no-thread config
Force use of the basic render loop, adapt qqmlthread
and qqmltypeloader to work on a single thread.
Disable components and features that require worker
threads: qmldb_server, worker script, shapes, folderlistmodel,
threaded render loop, software renderer.
Done-with: Lorn Potter <lorn.potter@gmail.com>
Change-Id: I77d965947f684f8b7d19284b5decd893395316cb
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/animations/qabstractanimationjob.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/ftw/qqmlthread.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 10 | ||||
-rw-r--r-- | src/qml/types/types.pri | 9 |
6 files changed, 37 insertions, 7 deletions
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index 4e82c7a062..ece2f0d692 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -70,17 +70,12 @@ QQmlAnimationTimer::QQmlAnimationTimer() : QQmlAnimationTimer *QQmlAnimationTimer::instance(bool create) { QQmlAnimationTimer *inst; -#ifndef QT_NO_THREAD if (create && !animationTimer()->hasLocalData()) { inst = new QQmlAnimationTimer; animationTimer()->setLocalData(inst); } else { inst = animationTimer() ? animationTimer()->localData() : 0; } -#else - static QQmlAnimationTimer unifiedTimer; - inst = &unifiedTimer; -#endif return inst; } diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp index 96313d7627..2ef1dc7e93 100644 --- a/src/qml/qml/ftw/qqmlthread.cpp +++ b/src/qml/qml/ftw/qqmlthread.cpp @@ -316,6 +316,12 @@ void QQmlThread::shutdownThread() void QQmlThread::internalCallMethodInThread(Message *message) { +#if !QT_CONFIG(thread) + message->call(this); + delete message; + return; +#endif + Q_ASSERT(!isThisThread()); d->lock(); Q_ASSERT(d->m_mainThreadWaiting == false); @@ -376,6 +382,10 @@ void QQmlThread::internalCallMethodInMain(Message *message) void QQmlThread::internalPostMethodToThread(Message *message) { +#if !QT_CONFIG(thread) + internalPostMethodToMain(message); + return; +#endif Q_ASSERT(!isThisThread()); d->lock(); bool wasEmpty = d->threadList.isEmpty(); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 26187ca086..82a3f45784 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -95,7 +95,9 @@ #include <private/qqmldelegatemodel_p.h> #endif #include <private/qqmlobjectmodel_p.h> +#if QT_CONFIG(thread) #include <private/qquickworkerscript_p.h> +#endif #include <private/qqmlinstantiator_p.h> #include <private/qqmlloggingcategory_p.h> @@ -243,7 +245,9 @@ void QQmlEnginePrivate::registerQtQuick2Types(const char *uri, int versionMajor, qmlRegisterType<QQmlListElement>(uri, versionMajor, versionMinor, "ListElement"); // Now in QtQml.Models, here for compatibility qmlRegisterCustomType<QQmlListModel>(uri, versionMajor, versionMinor, "ListModel", new QQmlListModelParser); // Now in QtQml.Models, here for compatibility #endif +#if QT_CONFIG(thread) qmlRegisterType<QQuickWorkerScript>(uri, versionMajor, versionMinor, "WorkerScript"); +#endif qmlRegisterType<QQuickPackage>(uri, versionMajor, versionMinor, "Package"); #if QT_CONFIG(qml_delegate_model) qmlRegisterType<QQmlDelegateModel>(uri, versionMajor, versionMinor, "VisualDataModel"); @@ -687,7 +691,9 @@ QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e) #endif outputWarningsToMsgLog(true), cleanup(nullptr), erroredBindings(nullptr), inProgressCreations(0), +#if QT_CONFIG(thread) workerScriptEngine(nullptr), +#endif activeObjectCreator(nullptr), #if QT_CONFIG(qml_network) networkAccessManager(nullptr), networkAccessManagerFactory(nullptr), @@ -987,6 +993,7 @@ void QQmlEnginePrivate::init() rootContext = new QQmlContext(q,true); } +#if QT_CONFIG(thread) QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine() { Q_Q(QQmlEngine); @@ -994,6 +1001,7 @@ QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine() workerScriptEngine = new QQuickWorkerScriptEngine(q); return workerScriptEngine; } +#endif /*! \class QQmlEngine diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index f606896953..d05f6634ec 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -153,8 +153,10 @@ public: QV8Engine *v8engine() const { return q_func()->handle()->v8Engine; } QV4::ExecutionEngine *v4engine() const { return q_func()->handle(); } +#if QT_CONFIG(thread) QQuickWorkerScriptEngine *getWorkerScriptEngine(); QQuickWorkerScriptEngine *workerScriptEngine; +#endif QUrl baseUrl; diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 929285d0fa..b0db031bf9 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -865,13 +865,23 @@ void QQmlTypeLoaderThread::loadWithCachedUnitAsync(QQmlDataBlob *b, const QV4::C void QQmlTypeLoaderThread::callCompleted(QQmlDataBlob *b) { b->addref(); +#if !QT_CONFIG(thread) + if (!isThisThread()) + postMethodToThread(&This::callCompletedMain, b); +#else postMethodToMain(&This::callCompletedMain, b); +#endif } void QQmlTypeLoaderThread::callDownloadProgressChanged(QQmlDataBlob *b, qreal p) { b->addref(); +#if !QT_CONFIG(thread) + if (!isThisThread()) + postMethodToThread(&This::callDownloadProgressChangedMain, b, p); +#else postMethodToMain(&This::callDownloadProgressChangedMain, b, p); +#endif } void QQmlTypeLoaderThread::initializeEngine(QQmlExtensionInterface *iface, diff --git a/src/qml/types/types.pri b/src/qml/types/types.pri index 492f408271..e0ff57a13e 100644 --- a/src/qml/types/types.pri +++ b/src/qml/types/types.pri @@ -5,7 +5,6 @@ SOURCES += \ $$PWD/qqmlmodelindexvaluetype.cpp \ $$PWD/qqmlobjectmodel.cpp \ $$PWD/qquickpackage.cpp \ - $$PWD/qquickworkerscript.cpp \ $$PWD/qqmlinstantiator.cpp \ $$PWD/qqmltableinstancemodel.cpp @@ -16,11 +15,17 @@ HEADERS += \ $$PWD/qqmlmodelindexvaluetype_p.h \ $$PWD/qqmlobjectmodel_p.h \ $$PWD/qquickpackage_p.h \ - $$PWD/qquickworkerscript_p.h \ $$PWD/qqmlinstantiator_p.h \ $$PWD/qqmlinstantiator_p_p.h \ $$PWD/qqmltableinstancemodel_p.h +qtConfig(thread) { + SOURCES += \ + $$PWD/qquickworkerscript.cpp + HEADERS += \ + $$PWD/qquickworkerscript_p.h +} + qtConfig(qml-list-model) { SOURCES += \ $$PWD/qqmllistmodel.cpp \ |