diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2018-01-05 12:29:12 +1000 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2018-01-17 22:22:31 +0000 |
commit | f9beafddd256cd0b79bf2478a812053ef61241fc (patch) | |
tree | 1626e5c8dde13e9c4cea218e090a856cf86e684c /src/qml/qml | |
parent | 4d8237fc695350054980137e0a50cfc6f0f88d7d (diff) |
wasm: various loading fixes
Change-Id: I1d3827fa205dbe5bbfdb2569da3b9073c2adb37e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 451f122cb2..9285328892 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1003,7 +1003,12 @@ struct StaticLoader { void loadThread(QQmlTypeLoader *loader, QQmlDataBlob *blob) const { +#ifdef Q_OS_HTML5 + loader->m_thread->loadWithStaticDataAsync(blob, data); + return; +#else loader->loadWithStaticDataThread(blob, data); +#endif } void load(QQmlTypeLoader *loader, QQmlDataBlob *blob) const { @@ -1040,8 +1045,9 @@ void QQmlTypeLoader::doLoad(const Loader &loader, QQmlDataBlob *blob, Mode mode) qWarning("QQmlTypeLoader::doLoad(%s): %s thread", qPrintable(blob->m_url.toString()), m_thread->isThisThread()?"Compile":"Engine"); #endif - - blob->startLoading(); +#ifdef Q_OS_HTML5 + mode = Asynchronous; +#endif if (m_thread->isThisThread()) { unlock(); loader.loadThread(this, blob); @@ -1049,12 +1055,7 @@ void QQmlTypeLoader::doLoad(const Loader &loader, QQmlDataBlob *blob, Mode mode) } else if (mode == Asynchronous) { blob->m_data.setIsAsync(true); unlock(); - -#ifndef Q_OS_HTML5 - loader.loadThread(this, blob); -#else loader.loadAsync(this, blob); -#endif lock(); } else { unlock(); @@ -1663,7 +1664,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 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() @@ -1674,6 +1675,7 @@ QQmlTypeData *QQmlTypeLoader::getType(const QUrl &url, Mode mode) lock(); } } +#endif } typeData->addref(); @@ -1687,6 +1689,9 @@ QQmlTypeData will not be cached. */ QQmlTypeData *QQmlTypeLoader::getType(const QByteArray &data, const QUrl &url, Mode mode) { +#ifdef Q_OS_HTML5 + mode = Asynchronous; +#endif LockHolder<QQmlTypeLoader> holder(this); QQmlTypeData *typeData = new QQmlTypeData(url, this); |