diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2018-04-23 09:53:19 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2018-04-24 19:47:33 +0000 |
commit | ee4383c1bef1eb51ab52b0da9db098c4b8c9c7ba (patch) | |
tree | 697fb6c1a05b91e553f04a385b55c474afac7625 | |
parent | 176b62f327198166c4dc691606d562724ea438b6 (diff) |
wasm: make no-tread platform independent
Use QT_NO_THREAD instead of Q_OS_HTML. This way we
can test the no-thread config also on host builds.
Move the render loop loopType override to after applying
platform and environment settings, so that we don’t
enable the threaded render loop by accident. Allow
the windows render loop (whether or not this works
is untested).
Change-Id: I4ea76f386a3914de208a380663c665f962cd2069
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r-- | src/qml/qml/ftw/qqmlthread.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 10 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp index 322d3281c7..a36a599f24 100644 --- a/src/qml/qml/ftw/qqmlthread.cpp +++ b/src/qml/qml/ftw/qqmlthread.cpp @@ -323,14 +323,14 @@ void QQmlThread::internalCallMethodInThread(Message *message) bool wasEmpty = d->threadList.isEmpty(); d->threadList.append(message); -#ifdef Q_OS_HTML5 +#ifdef QT_NO_THREAD d->mainSync = message; #endif if (wasEmpty && d->m_threadProcessing == false) d->triggerThreadEvent(); -#ifndef Q_OS_HTML5 +#ifndef QT_NO_THREAD d->m_mainThreadWaiting = true; do { if (d->mainSync) { @@ -407,7 +407,7 @@ void QQmlThread::waitForNextMessage() d->lock(); Q_ASSERT(d->m_mainThreadWaiting == false); -#ifdef Q_OS_HTML5 +#ifdef QT_NO_THREAD d->triggerThreadEvent(); #endif d->m_mainThreadWaiting = true; diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 5212b49670..81bda2c3bb 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1015,7 +1015,7 @@ struct StaticLoader { void loadThread(QQmlTypeLoader *loader, QQmlDataBlob *blob) const { -#ifdef Q_OS_HTML5 +#ifdef QT_NO_THREAD loader->m_thread->loadWithStaticDataAsync(blob, data); return; #else @@ -1057,7 +1057,7 @@ void QQmlTypeLoader::doLoad(const Loader &loader, QQmlDataBlob *blob, Mode mode) qWarning("QQmlTypeLoader::doLoad(%s): %s thread", qPrintable(blob->urlString()), m_thread->isThisThread()?"Compile":"Engine"); #endif -#ifdef Q_OS_HTML5 +#ifdef QT_NO_THREAD mode = Asynchronous; #endif if (m_thread->isThisThread()) { @@ -1692,7 +1692,7 @@ QQmlTypeData *QQmlTypeLoader::getType(const QUrl &url, Mode mode) } else if ((mode == PreferSynchronous || mode == Synchronous) && QQmlFile::isSynchronous(url)) { // this was started Asynchronous, but we need to force Synchronous // completion now (if at all possible with this type of URL). -#ifndef Q_OS_HTML5 +#ifndef QT_NO_THREAD if (!m_thread->isThisThread()) { // this only works when called directly from the UI thread, but not // when recursively called on the QML thread via resolveTypes() @@ -1717,7 +1717,7 @@ QQmlTypeData will not be cached. */ QQmlTypeData *QQmlTypeLoader::getType(const QByteArray &data, const QUrl &url, Mode mode) { -#ifdef Q_OS_HTML5 +#ifdef QT_NO_THREAD mode = Asynchronous; #endif LockHolder<QQmlTypeLoader> holder(this); diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index a55b7b4ad9..88b9c93448 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -201,12 +201,9 @@ QSGRenderLoop *QSGRenderLoop::instance() loopType = ThreadedRenderLoop; else loopType = WindowsRenderLoop; -#elif defined(Q_OS_HTML5) - loopType = BasicRenderLoop; -#else +#endif if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) loopType = ThreadedRenderLoop; -#endif if (qmlNoThreadedRenderer()) loopType = BasicRenderLoop; @@ -223,6 +220,11 @@ QSGRenderLoop *QSGRenderLoop::instance() loopType = ThreadedRenderLoop; } +#ifdef QT_NO_THREAD + if (loopType == ThreadedRenderLoop) + loopType = BasicRenderLoop; +#endif + switch (loopType) { case ThreadedRenderLoop: qCDebug(QSG_LOG_INFO, "threaded render loop"); |