aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2018-07-02 22:27:11 +0200
committerLorn Potter <lorn.potter@gmail.com>2018-09-05 00:00:09 +0000
commita7472867f407f1226d82aa7bce4cd4d6f9bd652f (patch)
treec4e0bf51bb665264b8ea771d2731ebf04dcac4c6
parenteb6201b2af725d64e5e92f19a512b1ff23ceba51 (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>
-rw-r--r--src/imports/imports.pro4
-rw-r--r--src/plugins/qmltooling/qmltooling.pro10
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp5
-rw-r--r--src/qml/qml/ftw/qqmlthread.cpp10
-rw-r--r--src/qml/qml/qqmlengine.cpp8
-rw-r--r--src/qml/qml/qqmlengine_p.h2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp10
-rw-r--r--src/qml/types/types.pri9
-rw-r--r--src/quick/configure.json2
-rw-r--r--src/quick/items/qquickrendercontrol.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/adaptations.pri2
-rw-r--r--src/quick/scenegraph/qsgcontextplugin.cpp2
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp2
-rw-r--r--src/quick/scenegraph/scenegraph.pri9
-rw-r--r--src/quickwidgets/qquickwidget.cpp2
-rw-r--r--src/src.pro4
-rw-r--r--tools/qmlscene/main.cpp2
17 files changed, 66 insertions, 19 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 653c787384..eb3e336c7f 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -3,10 +3,10 @@ TEMPLATE = subdirs
SUBDIRS += \
builtins \
qtqml \
- folderlistmodel \
models \
labsmodels
+qtConfig(thread): SUBDIRS += folderlistmodel
qtHaveModule(sql): SUBDIRS += localstorage
qtConfig(settings): SUBDIRS += settings
qtConfig(statemachine): SUBDIRS += statemachine
@@ -24,7 +24,7 @@ qtHaveModule(quick) {
qtConfig(quick-particles): \
SUBDIRS += particles
- qtConfig(quick-path): SUBDIRS += shapes
+ qtConfig(quick-path):qtConfig(thread): SUBDIRS += shapes
}
qtHaveModule(xmlpatterns) : SUBDIRS += xmllistmodel
diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro
index fd4a3eac65..30097be77b 100644
--- a/src/plugins/qmltooling/qmltooling.pro
+++ b/src/plugins/qmltooling/qmltooling.pro
@@ -6,9 +6,8 @@ SUBDIRS += \
packetprotocol
# Connectors
-SUBDIRS += \
- qmldbg_native \
- qmldbg_server
+SUBDIRS += qmldbg_native
+qtConfig(thread): SUBDIRS += qmldbg_server
qmldbg_native.depends = packetprotocol
qmldbg_server.depends = packetprotocol
@@ -35,8 +34,9 @@ qmldbg_nativedebugger.depends = packetprotocol
qtHaveModule(quick) {
SUBDIRS += \
qmldbg_inspector \
- qmldbg_quickprofiler \
- qmldbg_preview
+ qmldbg_quickprofiler
+
+ qtConfig(qml-network): SUBDIRS += qmldbg_preview
qmldbg_inspector.depends = packetprotocol
qmldbg_quickprofiler.depends = packetprotocol
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 \
diff --git a/src/quick/configure.json b/src/quick/configure.json
index 9ec3531ef4..9d7bafcb3b 100644
--- a/src/quick/configure.json
+++ b/src/quick/configure.json
@@ -129,7 +129,7 @@
"label": "Path support",
"purpose": "Provides Path elements.",
"section": "Qt Quick",
- "condition": "features.quick-shadereffect",
+ "condition": "features.thread && features.quick-shadereffect",
"output": [
"privateFeature"
]
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 86a64cdeeb..ec74660d96 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -391,6 +391,7 @@ QImage QQuickRenderControl::grab()
grabContent.setDevicePixelRatio(d->window->effectiveDevicePixelRatio());
}
#endif
+#if QT_CONFIG(thread)
} else if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::Software) {
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
cd->polishItems();
@@ -408,6 +409,7 @@ QImage QQuickRenderControl::grab()
render();
softwareRenderer->setCurrentPaintDevice(prevDev);
}
+#endif
} else {
qWarning("QQuickRenderControl: grabs are not supported with the current Qt Quick backend");
}
diff --git a/src/quick/scenegraph/adaptations/adaptations.pri b/src/quick/scenegraph/adaptations/adaptations.pri
index 40fa739e15..bfd7095718 100644
--- a/src/quick/scenegraph/adaptations/adaptations.pri
+++ b/src/quick/scenegraph/adaptations/adaptations.pri
@@ -1 +1 @@
-include(software/software.pri)
+qtConfig(thread): include(software/software.pri)
diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp
index 66add51c55..4f8b1cf332 100644
--- a/src/quick/scenegraph/qsgcontextplugin.cpp
+++ b/src/quick/scenegraph/qsgcontextplugin.cpp
@@ -89,8 +89,10 @@ struct QSGAdaptationBackendData
QSGAdaptationBackendData::QSGAdaptationBackendData()
: flags(nullptr)
{
+#if QT_CONFIG(thread)
// Fill in the table with the built-in adaptations.
builtIns.append(new QSGSoftwareAdaptation);
+#endif
}
QSGAdaptationBackendData::~QSGAdaptationBackendData()
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 2eaed497ef..79bfe95e90 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -221,10 +221,12 @@ QSGRenderLoop *QSGRenderLoop::instance()
}
switch (loopType) {
+#if QT_CONFIG(thread)
case ThreadedRenderLoop:
qCDebug(QSG_LOG_INFO, "threaded render loop");
s_instance = new QSGThreadedRenderLoop();
break;
+#endif
case WindowsRenderLoop:
qCDebug(QSG_LOG_INFO, "windows render loop");
s_instance = new QSGWindowsRenderLoop();
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index f08e8b7863..ddd7fb7f4c 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -115,7 +115,6 @@ qtConfig(opengl(es1|es2)?) {
$$PWD/util/qsgdefaultimagenode.cpp \
$$PWD/util/qsgdefaultninepatchnode.cpp \
$$PWD/qsgdefaultlayer.cpp \
- $$PWD/qsgthreadedrenderloop.cpp \
$$PWD/qsgwindowsrenderloop.cpp
HEADERS += \
$$PWD/qsgdefaultglyphnode_p.h \
@@ -132,9 +131,15 @@ qtConfig(opengl(es1|es2)?) {
$$PWD/util/qsgdefaultimagenode_p.h \
$$PWD/util/qsgdefaultninepatchnode_p.h \
$$PWD/qsgdefaultlayer_p.h \
- $$PWD/qsgthreadedrenderloop_p.h \
$$PWD/qsgwindowsrenderloop_p.h
+ qtConfig(thread) {
+ SOURCES += \
+ $$PWD/qsgthreadedrenderloop.cpp
+ HEADERS += \
+ $$PWD/qsgthreadedrenderloop_p.h
+ }
+
qtConfig(quick-sprite) {
SOURCES += \
$$PWD/qsgdefaultspritenode.cpp
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index a098c94670..8646dd32e3 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -297,6 +297,7 @@ void QQuickWidgetPrivate::render(bool needsSync)
QOpenGLContextPrivate::get(context)->defaultFboRedirect = 0;
#endif
} else {
+#if QT_CONFIG(thread)
//Software Renderer
if (needsSync) {
renderControl->polishItems();
@@ -315,6 +316,7 @@ void QQuickWidgetPrivate::render(bool needsSync)
updateRegion += softwareRenderer->flushRegion();
}
+#endif
}
}
diff --git a/src/src.pro b/src/src.pro
index 2dc6fc2758..ba96bd09a1 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -9,7 +9,9 @@ SUBDIRS += \
qtHaveModule(gui):qtConfig(qml-animation) {
SUBDIRS += \
quick \
- quickshapes
+
+ qtConfig(thread): \
+ SUBDIRS += quickshapes
qtConfig(testlib): \
SUBDIRS += qmltest
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index fab3dcce67..4d18a868a2 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -51,8 +51,10 @@
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/QApplication>
+#if QT_CONFIG(filedialog)
#include <QtWidgets/QFileDialog>
#endif
+#endif
#include <QtCore/QTranslator>
#include <QtCore/QLibraryInfo>